1 <?xml version=
"1.0" encoding=
"UTF-8"?>
2 <!DOCTYPE book PUBLIC
"-//OASIS//DTD DocBook MathML Module V1.1b1//EN"
3 "http://www.oasis-open.org/docbook/xml/mathml/1.1CR1/dbmathml.dtd">
4 <refentry id=
"glDispatchComputeIndirect">
9 <holder>Khronos Group
</holder>
12 <refentrytitle>glDispatchComputeIndirect
</refentrytitle>
13 <manvolnum>3G
</manvolnum>
16 <refname>glDispatchComputeIndirect
</refname>
17 <refpurpose>launch one or more compute work groups using parameters stored in a buffer
</refpurpose>
19 <refsynopsisdiv><title>C Specification
</title>
22 <funcdef>void
<function>glDispatchComputeIndirect
</function></funcdef>
23 <paramdef>GLintptr
<parameter>indirect
</parameter></paramdef>
27 <refsect1 id=
"parameters"><title>Parameters
</title>
30 <term><parameter>indirect
</parameter></term>
33 The offset into the buffer object currently bound to the
34 <constant>GL_DISPATCH_INDIRECT_BUFFER
</constant> buffer target at
35 which the dispatch parameters are stored.
41 <refsect1 id=
"description"><title>Description
</title>
43 <function>glDispatchComputeIndirect
</function> launches one or more compute
44 work groups using parameters stored in the buffer object currently bound
45 to the
<constant>GL_DISPATCH_INDIRECT_BUFFER
</constant> target.
46 Each work group is processed by the active program object for the compute
47 shader stage. While the individual shader invocations within a work group are
48 executed as a unit, work groups are executed completely independently and in
49 unspecified order.
<parameter>indirect
</parameter> contains the offset
50 into the data store of the buffer object bound to the
<constant>GL_DISPATCH_INDIRECT_BUFFER
</constant>
51 target at which the parameters are stored.
54 The parameters addressed by
<parameter>indirect
</parameter> are packed a structure,
55 which takes the form (in C):
56 <programlisting><![CDATA[ typedef struct {
60 } DispatchIndirectCommand;]]
></programlisting>
63 A call to
<function>glDispatchComputeIndirect
</function> is equivalent, assuming no
64 errors are generated, to:
65 <programlisting><![CDATA[ cmd = (const DispatchIndirectCommand *)indirect;
66 glDispatchComputeIndirect(cmd-
>num_groups_x, cmd-
>num_groups_y, cmd-
>num_groups_z);
70 Unlike
<citerefentry><refentrytitle>glDispatchCompute
</refentrytitle></citerefentry>,
71 no error is generated if any of the
<code>num_groups_x
</code>,
72 <code>num_groups_y
</code> or
<code>num_groups_z
</code> members
73 of the
<code>DispatchIndirectCommand
</code> is larger than the
74 value of
<constant>GL_MAX_COMPUTE_WORK_GROUP_COUNT
</constant> for the
75 corresponding dimension. In such circumstances, behavior is undefined and
76 may lead to application termination.
79 <refsect1 id=
"errors"><title>Errors
</title>
81 <constant>GL_INVALID_OPERATION
</constant> is generated if there is no active program
82 for the compute shader stage.
85 <constant>GL_INVALID_VALUE
</constant> is generated if
<parameter>indirect
</parameter> is
86 less than zero or not a multiple of four.
89 <constant>GL_INVALID_OPERATION
</constant> is generated if no buffer is bound to the
90 <constant>GL_DISPATCH_INDIRECT_BUFFER
</constant> target or if the command would
91 source data beyond the end of the buffer object's data store.
94 <refsect1 id=
"associatedgets"><title>Associated Gets
</title>
96 <citerefentry><refentrytitle>glGet
</refentrytitle></citerefentry> with argument
<constant>GL_MAX_COMPUTE_WORK_GROUP_COUNT
</constant>
99 <refsect1 id=
"seealso"><title>See Also
</title>
101 <citerefentry><refentrytitle>glDispatchCompute
</refentrytitle></citerefentry>.
104 <refsect1 id=
"Copyright"><title>Copyright
</title>
106 Copyright
<trademark class=
"copyright"></trademark> 2012 Khronos Group.
107 This material may be distributed subject to the terms and conditions set forth in
108 the Open Publication License, v
1.0,
8 June
1999.
109 <ulink url=
"http://opencontent.org/openpub/">http://opencontent.org/openpub/
</ulink>.