GL_EXT_shader_group_vote

Valid APIs

OpenGL ES 3.0+

Description

Implementations in some cases may group shader invocations and execute them in an SIMD fashion. When executing divergent conditional code paths, a SIMD implementation might stall one set of thread groups. This extension provides the ability to avoid divergent execution by evaluting a condition across an entire SIMD invocation group using code like:

if (allInvocationsEXT(condition)) {
                result = do_fast_path();
                } else {
                result = do_general_path();
                }
                

The built-in function allInvocationsEXT() will return the same value for all invocations in the group, so the group will either execute do_fast_path() or do_general_path(), but never both.

The built-in output values from the vertex shader stage are redefined when this extension exists, to the following:

Registry Link

https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT_shader_group_vote.txt

Example GLSL

                //all SIMD threads execute one path, never both
                if (allInvocationsEXT(condition)) {
                result = do_fast_path();
                } else {
                result = do_general_path();
                }