Opentk/Source/Bind/Specifications/Docs/glDispatchComputeIndirect.xml

113 lines
5.3 KiB
XML
Raw Normal View History

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook MathML Module V1.1b1//EN"
"http://www.oasis-open.org/docbook/xml/mathml/1.1CR1/dbmathml.dtd">
<refentry id="glDispatchComputeIndirect">
<refmeta>
<refmetainfo>
<copyright>
<year>2012</year>
<holder>Khronos Group</holder>
</copyright>
</refmetainfo>
<refentrytitle>glDispatchComputeIndirect</refentrytitle>
<manvolnum>3G</manvolnum>
</refmeta>
<refnamediv>
<refname>glDispatchComputeIndirect</refname>
<refpurpose>launch one or more compute work groups using parameters stored in a buffer</refpurpose>
</refnamediv>
<refsynopsisdiv><title>C Specification</title>
<funcsynopsis>
<funcprototype>
<funcdef>void <function>glDispatchComputeIndirect</function></funcdef>
<paramdef>GLintptr <parameter>indirect</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1 id="parameters"><title>Parameters</title>
<variablelist>
<varlistentry>
<term><parameter>indirect</parameter></term>
<listitem>
<para>
The offset into the buffer object currently bound to the
<constant>GL_DISPATCH_INDIRECT_BUFFER</constant> buffer target at
which the dispatch parameters are stored.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 id="description"><title>Description</title>
<para>
<function>glDispatchComputeIndirect</function> launches one or more compute
work groups using parameters stored in the buffer object currently bound
to the <constant>GL_DISPATCH_INDIRECT_BUFFER</constant> 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. <parameter>indirect</parameter> contains the offset
into the data store of the buffer object bound to the <constant>GL_DISPATCH_INDIRECT_BUFFER</constant>
target at which the parameters are stored.
</para>
<para>
The parameters addressed by <parameter>indirect</parameter> are packed a structure,
which takes the form (in C):
<programlisting><![CDATA[ typedef struct {
uint num_groups_x;
uint num_groups_y;
uint num_groups_z;
} DispatchIndirectCommand;]]></programlisting>
</para>
<para>
A call to <function>glDispatchComputeIndirect</function> is equivalent, assuming no
errors are generated, to:
<programlisting><![CDATA[ cmd = (const DispatchIndirectCommand *)indirect;
glDispatchComputeIndirect(cmd->num_groups_x, cmd->num_groups_y, cmd->num_groups_z);
}]]></programlisting>
</para>
<para>
Unlike <citerefentry><refentrytitle>glDispatchCompute</refentrytitle></citerefentry>,
no error is generated if any of the <code>num_groups_x</code>,
<code>num_groups_y</code> or <code>num_groups_z</code> members
of the <code>DispatchIndirectCommand</code> is larger than the
value of <constant>GL_MAX_COMPUTE_WORK_GROUP_COUNT</constant> for the
corresponding dimension. In such circumstances, behavior is undefined and
may lead to application termination.
</para>
</refsect1>
<refsect1 id="errors"><title>Errors</title>
<para>
<constant>GL_INVALID_OPERATION</constant> is generated if there is no active program
for the compute shader stage.
</para>
<para>
<constant>GL_INVALID_VALUE</constant> is generated if <parameter>indirect</parameter> is
less than zero or not a multiple of four.
</para>
<para>
<constant>GL_INVALID_OPERATION</constant> is generated if no buffer is bound to the
<constant>GL_DISPATCH_INDIRECT_BUFFER</constant> target or if the command would
source data beyond the end of the buffer object's data store.
</para>
</refsect1>
<refsect1 id="associatedgets"><title>Associated Gets</title>
<para>
<citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_MAX_COMPUTE_WORK_GROUP_COUNT</constant>
</para>
</refsect1>
<refsect1 id="seealso"><title>See Also</title>
<para>
<citerefentry><refentrytitle>glDispatchCompute</refentrytitle></citerefentry>.
</para>
</refsect1>
<refsect1 id="Copyright"><title>Copyright</title>
<para>
Copyright <trademark class="copyright"></trademark> 2012 Khronos Group.
This material may be distributed subject to the terms and conditions set forth in
the Open Publication License, v 1.0, 8 June 1999.
<ulink url="http://opencontent.org/openpub/">http://opencontent.org/openpub/</ulink>.
</para>
</refsect1>
</refentry>