rename upstream-man-pages to upstream-doc
[clinton/guile-figl.git] / upstream-doc / man4 / glDispatchComputeIndirect.xml
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">
5 <refmeta>
6 <refmetainfo>
7 <copyright>
8 <year>2012</year>
9 <holder>Khronos Group</holder>
10 </copyright>
11 </refmetainfo>
12 <refentrytitle>glDispatchComputeIndirect</refentrytitle>
13 <manvolnum>3G</manvolnum>
14 </refmeta>
15 <refnamediv>
16 <refname>glDispatchComputeIndirect</refname>
17 <refpurpose>launch one or more compute work groups using parameters stored in a buffer</refpurpose>
18 </refnamediv>
19 <refsynopsisdiv><title>C Specification</title>
20 <funcsynopsis>
21 <funcprototype>
22 <funcdef>void <function>glDispatchComputeIndirect</function></funcdef>
23 <paramdef>GLintptr <parameter>indirect</parameter></paramdef>
24 </funcprototype>
25 </funcsynopsis>
26 </refsynopsisdiv>
27 <refsect1 id="parameters"><title>Parameters</title>
28 <variablelist>
29 <varlistentry>
30 <term><parameter>indirect</parameter></term>
31 <listitem>
32 <para>
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.
36 </para>
37 </listitem>
38 </varlistentry>
39 </variablelist>
40 </refsect1>
41 <refsect1 id="description"><title>Description</title>
42 <para>
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.
52 </para>
53 <para>
54 The parameters addressed by <parameter>indirect</parameter> are packed a structure,
55 which takes the form (in C):
56 <programlisting><![CDATA[ typedef struct {
57 uint num_groups_x;
58 uint num_groups_y;
59 uint num_groups_z;
60 } DispatchIndirectCommand;]]></programlisting>
61 </para>
62 <para>
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);
67 }]]></programlisting>
68 </para>
69 <para>
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.
77 </para>
78 </refsect1>
79 <refsect1 id="errors"><title>Errors</title>
80 <para>
81 <constant>GL_INVALID_OPERATION</constant> is generated if there is no active program
82 for the compute shader stage.
83 </para>
84 <para>
85 <constant>GL_INVALID_VALUE</constant> is generated if <parameter>indirect</parameter> is
86 less than zero or not a multiple of four.
87 </para>
88 <para>
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.
92 </para>
93 </refsect1>
94 <refsect1 id="associatedgets"><title>Associated Gets</title>
95 <para>
96 <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_MAX_COMPUTE_WORK_GROUP_COUNT</constant>
97 </para>
98 </refsect1>
99 <refsect1 id="seealso"><title>See Also</title>
100 <para>
101 <citerefentry><refentrytitle>glDispatchCompute</refentrytitle></citerefentry>.
102 </para>
103 </refsect1>
104 <refsect1 id="Copyright"><title>Copyright</title>
105 <para>
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>.
110 </para>
111 </refsect1>
112 </refentry>