September 2018
Intermediate to advanced
472 pages
15h 36m
English
When we execute the compute shader, we define the compute space. The number of work groups are determined by the parameters to glDispatchCompute. For example, to execute the compute shader with a two-dimensional compute space with 4 work groups in the x dimension and 5 work groups in the y dimension (matching the preceding diagram), we'd use the following call:
glDispatchCompute( 4, 5, 1 );
The number of local invocations within each work group is not specified on the OpenGL side. Instead, it is specified within the compute shader itself with a layout specifier. For example, here, we specify nine local invocations per work group, 3 in the x direction and 3 in the y direction:
layout (local_size_x = 3, local_size_y ...
Read now
Unlock full access