March 2013
Intermediate to advanced
984 pages
26h 18m
English
Once your compute shader is executing, it likely has the responsibility to set the value of one or more elements of some output array (such as an image or an array of atomic counters), or to read data from a specific location in an input array. To do this, you will need to know where in the local workgroup you are and where that workgroup is within the larger global workgroup. For these purposes, OpenGL provides several built-in variables to compute shaders. These built-in variables are implicitly declared as shown in Example 12.4.
Example 12.4. Declaration of Compute Shader Built-in Variables
const uvec3 gl_WorkGroupSize;in uvec3 gl_NumWorkGroups;in uvec3 gl_LocalInvocationID;in uvec3 ...