logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

glDispatchComputeIndirect - launch one or more compute work groups using parameters stored in a buffer

Associated Gets

glGet() with argument GL_MAX_COMPUTE_WORK_GROUP_COUNT

C Specification

voidglDispatchComputeIndirect(GLintptrindirect);

Description

glDispatchComputeIndirect launches one or more compute work groups using parameters stored in the buffer
       object currently bound to the GL_DISPATCH_INDIRECT_BUFFER target. Each work group is processed by the
       active program object for the compute shader stage. While the individual shader invocations within a work
       group are executed as a unit, work groups are executed completely independently and in unspecified order.
       indirect contains the offset into the data store of the buffer object bound to the
       GL_DISPATCH_INDIRECT_BUFFER target at which the parameters are stored.

       The parameters addressed by indirect are packed a structure, which takes the form (in C):

               typedef  struct {
                   uint  num_groups_x;
                   uint  num_groups_y;
                   uint  num_groups_z;
               } DispatchIndirectCommand;

       A call to glDispatchComputeIndirect is equivalent, assuming no errors are generated, to:

               cmd = (const DispatchIndirectCommand  *)indirect;
               glDispatchComputeIndirect(cmd->num_groups_x, cmd->num_groups_y, cmd->num_groups_z);

       Unlike glDispatchCompute(), no error is generated if any of the num_groups_x, num_groups_y or
       num_groups_z members of the DispatchIndirectCommand is larger than the value of
       GL_MAX_COMPUTE_WORK_GROUP_COUNT for the corresponding dimension. In such circumstances, behavior is
       undefined and may lead to application termination.

Errors

GL_INVALID_OPERATION is generated if there is no active program for the compute shader stage.

       GL_INVALID_VALUE is generated if indirect is less than zero or not a multiple of four.

       GL_INVALID_OPERATION is generated if no buffer is bound to the GL_DISPATCH_INDIRECT_BUFFER target or if
       the command would source data beyond the end of the buffer object's data store.

Name

       glDispatchComputeIndirect - launch one or more compute work groups using parameters stored in a buffer

Parameters

indirect
           The offset into the buffer object currently bound to the GL_DISPATCH_INDIRECT_BUFFER buffer target at
           which the dispatch parameters are stored.

See Also

glDispatchCompute().

Version Support

       ┌───────────────────────────┬───────────────────────────────────────────────────────────────────────┐
       │                           │                OpenGLVersion                                         │
       ├───────────────────────────┼─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┤
       │ Function2.02.13.03.13.23.34.04.14.24.34.44.5 │
       │ /                         │     │     │     │     │     │     │     │     │     │     │     │     │
       │ Feature                   │     │     │     │     │     │     │     │     │     │     │     │     │
       │ Name                      │     │     │     │     │     │     │     │     │     │     │     │     │
       ├───────────────────────────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤
       │ glDispatchComputeIndirect │  -  │  -  │  -  │  -  │  -  │  -  │  -  │  -  │  -  │  ✔  │  ✔  │  ✔  │
       └───────────────────────────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┘

See Also