Commit | Line | Data |
---|---|---|
7faf1d71 AW |
1 | <?xml version="1.0" encoding="UTF-8"?>\r |
2 | <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook MathML Module V1.1b1//EN"\r | |
3 | "http://www.oasis-open.org/docbook/xml/mathml/1.1CR1/dbmathml.dtd">\r | |
4 | <refentry id="glDispatchComputeIndirect">\r | |
5 | <refmeta>\r | |
6 | <refmetainfo>\r | |
7 | <copyright>\r | |
8 | <year>2012</year>\r | |
9 | <holder>Khronos Group</holder>\r | |
10 | </copyright>\r | |
11 | </refmetainfo>\r | |
12 | <refentrytitle>glDispatchComputeIndirect</refentrytitle>\r | |
13 | <manvolnum>3G</manvolnum>\r | |
14 | </refmeta>\r | |
15 | <refnamediv>\r | |
16 | <refname>glDispatchComputeIndirect</refname>\r | |
17 | <refpurpose>launch one or more compute work groups using parameters stored in a buffer</refpurpose>\r | |
18 | </refnamediv>\r | |
19 | <refsynopsisdiv><title>C Specification</title>\r | |
20 | <funcsynopsis>\r | |
21 | <funcprototype>\r | |
22 | <funcdef>void <function>glDispatchComputeIndirect</function></funcdef>\r | |
23 | <paramdef>GLintptr <parameter>indirect</parameter></paramdef>\r | |
24 | </funcprototype>\r | |
25 | </funcsynopsis>\r | |
26 | </refsynopsisdiv>\r | |
27 | <refsect1 id="parameters"><title>Parameters</title>\r | |
28 | <variablelist>\r | |
29 | <varlistentry>\r | |
30 | <term><parameter>indirect</parameter></term>\r | |
31 | <listitem>\r | |
32 | <para>\r | |
33 | The offset into the buffer object currently bound to the\r | |
34 | <constant>GL_DISPATCH_INDIRECT_BUFFER</constant> buffer target at\r | |
35 | which the dispatch parameters are stored.\r | |
36 | </para>\r | |
37 | </listitem>\r | |
38 | </varlistentry>\r | |
39 | </variablelist>\r | |
40 | </refsect1>\r | |
41 | <refsect1 id="description"><title>Description</title>\r | |
42 | <para>\r | |
43 | <function>glDispatchComputeIndirect</function> launches one or more compute\r | |
44 | work groups using parameters stored in the buffer object currently bound\r | |
45 | to the <constant>GL_DISPATCH_INDIRECT_BUFFER</constant> target.\r | |
46 | Each work group is processed by the active program object for the compute\r | |
47 | shader stage. While the individual shader invocations within a work group are\r | |
48 | executed as a unit, work groups are executed completely independently and in\r | |
49 | unspecified order. <parameter>indirect</parameter> contains the offset\r | |
50 | into the data store of the buffer object bound to the <constant>GL_DISPATCH_INDIRECT_BUFFER</constant>\r | |
51 | target at which the parameters are stored.\r | |
52 | </para>\r | |
53 | <para>\r | |
54 | The parameters addressed by <parameter>indirect</parameter> are packed a structure,\r | |
55 | which takes the form (in C):\r | |
56 | <programlisting><![CDATA[ typedef struct {\r | |
57 | uint num_groups_x;\r | |
58 | uint num_groups_y;\r | |
59 | uint num_groups_z;\r | |
60 | } DispatchIndirectCommand;]]></programlisting>\r | |
61 | </para>\r | |
62 | <para>\r | |
63 | A call to <function>glDispatchComputeIndirect</function> is equivalent, assuming no\r | |
64 | errors are generated, to:\r | |
65 | <programlisting><![CDATA[ cmd = (const DispatchIndirectCommand *)indirect;\r | |
66 | glDispatchComputeIndirect(cmd->num_groups_x, cmd->num_groups_y, cmd->num_groups_z);\r | |
67 | }]]></programlisting>\r | |
68 | </para>\r | |
69 | <para>\r | |
70 | Unlike <citerefentry><refentrytitle>glDispatchCompute</refentrytitle></citerefentry>,\r | |
71 | no error is generated if any of the <code>num_groups_x</code>,\r | |
72 | <code>num_groups_y</code> or <code>num_groups_z</code> members\r | |
73 | of the <code>DispatchIndirectCommand</code> is larger than the\r | |
74 | value of <constant>GL_MAX_COMPUTE_WORK_GROUP_COUNT</constant> for the\r | |
75 | corresponding dimension. In such circumstances, behavior is undefined and\r | |
76 | may lead to application termination.\r | |
77 | </para>\r | |
78 | </refsect1>\r | |
79 | <refsect1 id="errors"><title>Errors</title>\r | |
80 | <para>\r | |
81 | <constant>GL_INVALID_OPERATION</constant> is generated if there is no active program\r | |
82 | for the compute shader stage.\r | |
83 | </para>\r | |
84 | <para>\r | |
85 | <constant>GL_INVALID_VALUE</constant> is generated if <parameter>indirect</parameter> is\r | |
86 | less than zero or not a multiple of four.\r | |
87 | </para>\r | |
88 | <para>\r | |
89 | <constant>GL_INVALID_OPERATION</constant> is generated if no buffer is bound to the\r | |
90 | <constant>GL_DISPATCH_INDIRECT_BUFFER</constant> target or if the command would\r | |
91 | source data beyond the end of the buffer object's data store.\r | |
92 | </para>\r | |
93 | </refsect1>\r | |
94 | <refsect1 id="associatedgets"><title>Associated Gets</title>\r | |
95 | <para>\r | |
96 | <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_MAX_COMPUTE_WORK_GROUP_COUNT</constant>\r | |
97 | </para>\r | |
98 | </refsect1>\r | |
99 | <refsect1 id="seealso"><title>See Also</title>\r | |
100 | <para>\r | |
101 | <citerefentry><refentrytitle>glDispatchCompute</refentrytitle></citerefentry>.\r | |
102 | </para>\r | |
103 | </refsect1>\r | |
104 | <refsect1 id="Copyright"><title>Copyright</title>\r | |
105 | <para>\r | |
106 | Copyright <trademark class="copyright"></trademark> 2012 Khronos Group.\r | |
107 | This material may be distributed subject to the terms and conditions set forth in\r | |
108 | the Open Publication License, v 1.0, 8 June 1999.\r | |
109 | <ulink url="http://opencontent.org/openpub/">http://opencontent.org/openpub/</ulink>.\r | |
110 | </para>\r | |
111 | </refsect1>\r | |
112 | </refentry>\r |