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