rename upstream-man-pages to upstream-doc
[clinton/guile-figl.git] / upstream-doc / man4 / glMultiDrawArraysIndirect.xml
CommitLineData
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="glMultiDrawArraysIndirect">\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>glMultiDrawArraysIndirect</refentrytitle>\r
13 <manvolnum>3G</manvolnum>\r
14 </refmeta>\r
15 <refnamediv>\r
16 <refname>glMultiDrawArraysIndirect</refname>\r
17 <refpurpose>render multiple sets of primitives from array data, taking parameters from memory</refpurpose>\r
18 </refnamediv>\r
19 <refsynopsisdiv><title>C Specification</title>\r
20 <funcsynopsis>\r
21 <funcprototype>\r
22 <funcdef>void <function>glMultiDrawArraysIndirect</function></funcdef>\r
23 <paramdef>GLenum <parameter>mode</parameter></paramdef>\r
24 <paramdef>const void *<parameter>indirect</parameter></paramdef>\r
25 <paramdef>GLsizei <parameter>drawcount</parameter></paramdef>\r
26 <paramdef>GLsizei <parameter>stride</parameter></paramdef>\r
27 </funcprototype>\r
28 </funcsynopsis>\r
29 </refsynopsisdiv>\r
30 <!-- eqn: ignoring delim $$ -->\r
31 <refsect1 id="parameters"><title>Parameters</title>\r
32 <variablelist>\r
33 <varlistentry>\r
34 <term><parameter>mode</parameter></term>\r
35 <listitem>\r
36 <para>\r
37 Specifies what kind of primitives to render.\r
38 Symbolic constants\r
39 <constant>GL_POINTS</constant>,\r
40 <constant>GL_LINE_STRIP</constant>,\r
41 <constant>GL_LINE_LOOP</constant>,\r
42 <constant>GL_LINES</constant>,\r
43 <constant>GL_LINE_STRIP_ADJACENCY</constant>,\r
44 <constant>GL_LINES_ADJACENCY</constant>,\r
45 <constant>GL_TRIANGLE_STRIP</constant>,\r
46 <constant>GL_TRIANGLE_FAN</constant>,\r
47 <constant>GL_TRIANGLES</constant>,\r
48 <constant>GL_TRIANGLE_STRIP_ADJACENCY</constant>,\r
49 <constant>GL_TRIANGLES_ADJACENCY</constant>, and\r
50 <constant>GL_PATCHES</constant>\r
51 are accepted.\r
52 </para>\r
53 </listitem>\r
54 </varlistentry>\r
55 <varlistentry>\r
56 <term><parameter>indirect</parameter></term>\r
57 <listitem>\r
58 <para>\r
59 Specifies the address of an array of structures containing the draw parameters.\r
60 </para>\r
61 </listitem>\r
62 </varlistentry>\r
63 <varlistentry>\r
64 <term><parameter>drawcount</parameter></term>\r
65 <listitem>\r
66 <para>\r
67 Specifies the the number of elements in the array of draw parameter structures.\r
68 </para>\r
69 </listitem>\r
70 </varlistentry>\r
71 <varlistentry>\r
72 <term><parameter>stride</parameter></term>\r
73 <listitem>\r
74 <para>\r
75 Specifies the distance in basic machine units between elements of the draw parameter array.\r
76 </para>\r
77 </listitem>\r
78 </varlistentry>\r
79 </variablelist>\r
80 </refsect1>\r
81 <refsect1 id="description"><title>Description</title>\r
82 <para>\r
83 <function>glMultiDrawArraysIndirect</function> specifies multiple geometric primitives\r
84 with very few subroutine calls. <function>glMultiDrawArraysIndirect</function> behaves\r
85 similarly to a multitude of calls to <citerefentry><refentrytitle>glDrawArraysInstancedBaseInstance</refentrytitle></citerefentry>,\r
86 execept that the parameters to each call to <citerefentry><refentrytitle>glDrawArraysInstancedBaseInstance</refentrytitle></citerefentry>\r
87 are stored in an array in memory at the address given by <parameter>indirect</parameter>, separated\r
88 by the stride, in basic machine units, specified by <parameter>stride</parameter>. If <parameter>stride</parameter>\r
89 is zero, then the array is assumed to be tightly packed in memory.\r
90 </para>\r
91 <para>\r
92 The parameters addressed by <parameter>indirect</parameter> are packed into an array of structures,\r
93 each element of which takes the form (in C):\r
94 <programlisting><![CDATA[ typedef struct {\r
95 uint count;\r
96 uint primCount;\r
97 uint first;\r
98 uint baseInstance;\r
99 } DrawArraysIndirectCommand;]]></programlisting>\r
100 </para>\r
101 <para>\r
102 A single call to <function>glMultiDrawArraysIndirect</function> is equivalent, assuming no errors\r
103 are generated to:\r
104 <programlisting><![CDATA[ GLsizei n;\r
105 for (n = 0; n < drawcount; n++)\r
106 {\r
107 const DrawArraysIndirectCommand *cmd;\r
108 if (stride != 0)\r
109 {\r
110 cmd = (const DrawArraysIndirectCommand *)((uintptr)indirect + n * stride);\r
111 }\r
112 else\r
113 {\r
114 cmd = (const DrawArraysIndirectCommand *)indirect + n;\r
115 }\r
116\r
117 glDrawArraysInstancedBaseInstance(mode, cmd->first, cmd->count, cmd->primCount, cmd->baseInstance);\r
118 }]]></programlisting>\r
119 </para>\r
120 <para>\r
121 If a buffer is bound to the <constant>GL_DRAW_INDIRECT_BUFFER</constant> binding at the time\r
122 of a call to <function>glMultiDrawArraysIndirect</function>, <parameter>indirect</parameter>\r
123 is interpreted as an offset, in basic machine units, into that buffer and the parameter\r
124 data is read from the buffer rather than from client memory.\r
125 </para>\r
126 <para>\r
127 In contrast to <citerefentry><refentrytitle>glDrawArraysInstancedBaseInstance</refentrytitle></citerefentry>,\r
128 the <code>first</code> member of the parameter structure is unsigned, and out-of-range indices\r
129 do not generate an error.\r
130 </para>\r
131 <para>\r
132 Vertex attributes that are modified by <function>glMultiDrawArraysIndirect</function> have an\r
133 unspecified value after <function>glMultiDrawArraysIndirect</function> returns. Attributes that aren't\r
134 modified remain well defined.\r
135 </para>\r
136 </refsect1>\r
137 <refsect1 id="notes"><title>Notes</title>\r
138 <para>\r
139 The <parameter>baseInstance</parameter> member of the <parameter>DrawArraysIndirectCommand</parameter>\r
140 structure is defined only if the GL version is 4.2 or greater. For versions of the GL less than 4.2,\r
141 this parameter is present but is reserved and should be set to zero. On earlier versions of the GL,\r
142 behavior is undefined if it is non-zero.\r
143 </para>\r
144 <para>\r
145 <function>glMultiDrawArraysIndirect</function> is available only if the GL version is 4.3 or greater.\r
146 </para>\r
147 </refsect1>\r
148 <refsect1 id="errors"><title>Errors</title>\r
149 <para>\r
150 <constant>GL_INVALID_ENUM</constant> is generated if <parameter>mode</parameter> is not an accepted value.\r
151 </para>\r
152 <para>\r
153 <constant>GL_INVALID_VALUE</constant> is generated if <parameter>stride</parameter> is not a multiple\r
154 of four.\r
155 </para>\r
156 <para>\r
157 <constant>GL_INVALID_VALUE</constant> is generated if <parameter>drawcount</parameter> is negative.\r
158 </para>\r
159 <para>\r
160 <constant>GL_INVALID_OPERATION</constant> is generated if a non-zero buffer object name is bound to an\r
161 enabled array or to the <constant>GL_DRAW_INDIRECT_BUFFER</constant> binding and the buffer object's data store is currently mapped.\r
162 </para>\r
163 <para>\r
164 <constant>GL_INVALID_OPERATION</constant> is generated if a geometry shader is active and <parameter>mode</parameter>\r
165 is incompatible with the input primitive type of the geometry shader in the currently installed program object.\r
166 </para>\r
167 <para>\r
168 <constant>GL_INVALID_OPERATION</constant> is generated if <parameter>mode</parameter> is <constant>GL_PATCHES</constant>\r
169 and no tessellation control shader is active.\r
170 </para>\r
171 </refsect1>\r
172 <refsect1 id="seealso"><title>See Also</title>\r
173 <para>\r
174 <citerefentry><refentrytitle>glDrawArrays</refentrytitle></citerefentry>,\r
175 <citerefentry><refentrytitle>glDrawArraysInstanced</refentrytitle></citerefentry>,\r
176 <citerefentry><refentrytitle>glDrawElements</refentrytitle></citerefentry>,\r
177 <citerefentry><refentrytitle>glDrawRangeElements</refentrytitle></citerefentry>,\r
178 <citerefentry><refentrytitle>glDrawArraysIndirect</refentrytitle></citerefentry>,\r
179 <citerefentry><refentrytitle>glMultiDrawElementsIndirect</refentrytitle></citerefentry>\r
180 </para>\r
181 </refsect1>\r
182 <refsect1 id="Copyright"><title>Copyright</title>\r
183 <para>\r
184 Copyright <trademark class="copyright"></trademark> 2012 Khronos Group.\r
185 This material may be distributed subject to the terms and conditions set forth in \r
186 the Open Publication License, v 1.0, 8 June 1999.\r
187 <ulink url="http://opencontent.org/openpub/">http://opencontent.org/openpub/</ulink>.\r
188 </para>\r
189 </refsect1>\r
190</refentry>\r