Commit | Line | Data |
---|---|---|
7faf1d71 AW |
1 | <?xml version="1.0" encoding="UTF-8"?> |
2 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "xhtml1-transitional.dtd"> | |
3 | <!-- saved from url=(0013)about:internet --> | |
4 | <?xml-stylesheet type="text/xsl" href="mathml.xsl"?><html xmlns="http://www.w3.org/1999/xhtml" xmlns:pref="http://www.w3.org/2002/Math/preference" pref:renderer="mathplayer-dl"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><link rel="stylesheet" type="text/css" href="opengl-man.css" /><title>glMultiDrawArraysIndirect - OpenGL 4 Reference Pages</title><meta name="generator" content="DocBook XSL Stylesheets V1.69.1" /></head><body><div class="refentry" lang="en" xml:lang="en"><a id="glMultiDrawArraysIndirect"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>glMultiDrawArraysIndirect — render multiple sets of primitives from array data, taking parameters from memory</p></div><div class="refsynopsisdiv"><h2>C Specification</h2><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0"><tr><td><code class="funcdef">void <b class="fsfunc">glMultiDrawArraysIndirect</b>(</code></td><td>GLenum </td><td><var class="pdparam">mode</var>, </td></tr><tr><td> </td><td>const void * </td><td><var class="pdparam">indirect</var>, </td></tr><tr><td> </td><td>GLsizei </td><td><var class="pdparam">drawcount</var>, </td></tr><tr><td> </td><td>GLsizei </td><td><var class="pdparam">stride</var><code>)</code>;</td></tr></table></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="parameters"></a><h2>Parameters</h2><div class="variablelist"><dl><dt><span class="term"><em class="parameter"><code>mode</code></em></span></dt><dd><p> | |
5 | Specifies what kind of primitives to render. | |
6 | Symbolic constants | |
7 | <code class="constant">GL_POINTS</code>, | |
8 | <code class="constant">GL_LINE_STRIP</code>, | |
9 | <code class="constant">GL_LINE_LOOP</code>, | |
10 | <code class="constant">GL_LINES</code>, | |
11 | <code class="constant">GL_LINE_STRIP_ADJACENCY</code>, | |
12 | <code class="constant">GL_LINES_ADJACENCY</code>, | |
13 | <code class="constant">GL_TRIANGLE_STRIP</code>, | |
14 | <code class="constant">GL_TRIANGLE_FAN</code>, | |
15 | <code class="constant">GL_TRIANGLES</code>, | |
16 | <code class="constant">GL_TRIANGLE_STRIP_ADJACENCY</code>, | |
17 | <code class="constant">GL_TRIANGLES_ADJACENCY</code>, and | |
18 | <code class="constant">GL_PATCHES</code> | |
19 | are accepted. | |
20 | </p></dd><dt><span class="term"><em class="parameter"><code>indirect</code></em></span></dt><dd><p> | |
21 | Specifies the address of an array of structures containing the draw parameters. | |
22 | </p></dd><dt><span class="term"><em class="parameter"><code>drawcount</code></em></span></dt><dd><p> | |
23 | Specifies the the number of elements in the array of draw parameter structures. | |
24 | </p></dd><dt><span class="term"><em class="parameter"><code>stride</code></em></span></dt><dd><p> | |
25 | Specifies the distance in basic machine units between elements of the draw parameter array. | |
26 | </p></dd></dl></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="description"></a><h2>Description</h2><p> | |
27 | <code class="function">glMultiDrawArraysIndirect</code> specifies multiple geometric primitives | |
28 | with very few subroutine calls. <code class="function">glMultiDrawArraysIndirect</code> behaves | |
29 | similarly to a multitude of calls to <a href="glDrawArraysInstancedBaseInstance.xml"><span class="citerefentry"><span class="refentrytitle">glDrawArraysInstancedBaseInstance</span></span></a>, | |
30 | execept that the parameters to each call to <a href="glDrawArraysInstancedBaseInstance.xml"><span class="citerefentry"><span class="refentrytitle">glDrawArraysInstancedBaseInstance</span></span></a> | |
31 | are stored in an array in memory at the address given by <em class="parameter"><code>indirect</code></em>, separated | |
32 | by the stride, in basic machine units, specified by <em class="parameter"><code>stride</code></em>. If <em class="parameter"><code>stride</code></em> | |
33 | is zero, then the array is assumed to be tightly packed in memory. | |
34 | </p><p> | |
35 | The parameters addressed by <em class="parameter"><code>indirect</code></em> are packed into an array of structures, | |
36 | each element of which takes the form (in C): | |
37 | </p><pre class="programlisting"> typedef struct { | |
38 | uint count; | |
39 | uint primCount; | |
40 | uint first; | |
41 | uint baseInstance; | |
42 | } DrawArraysIndirectCommand;</pre><p> | |
43 | </p><p> | |
44 | A single call to <code class="function">glMultiDrawArraysIndirect</code> is equivalent, assuming no errors | |
45 | are generated to: | |
46 | </p><pre class="programlisting"> GLsizei n; | |
47 | for (n = 0; n < drawcount; n++) | |
48 | { | |
49 | const DrawArraysIndirectCommand *cmd; | |
50 | if (stride != 0) | |
51 | { | |
52 | cmd = (const DrawArraysIndirectCommand *)((uintptr)indirect + n * stride); | |
53 | } | |
54 | else | |
55 | { | |
56 | cmd = (const DrawArraysIndirectCommand *)indirect + n; | |
57 | } | |
58 | ||
59 | glDrawArraysInstancedBaseInstance(mode, cmd->first, cmd->count, cmd->primCount, cmd->baseInstance); | |
60 | }</pre><p> | |
61 | </p><p> | |
62 | If a buffer is bound to the <code class="constant">GL_DRAW_INDIRECT_BUFFER</code> binding at the time | |
63 | of a call to <code class="function">glMultiDrawArraysIndirect</code>, <em class="parameter"><code>indirect</code></em> | |
64 | is interpreted as an offset, in basic machine units, into that buffer and the parameter | |
65 | data is read from the buffer rather than from client memory. | |
66 | </p><p> | |
67 | In contrast to <a href="glDrawArraysInstancedBaseInstance.xml"><span class="citerefentry"><span class="refentrytitle">glDrawArraysInstancedBaseInstance</span></span></a>, | |
68 | the <code class="code">first</code> member of the parameter structure is unsigned, and out-of-range indices | |
69 | do not generate an error. | |
70 | </p><p> | |
71 | Vertex attributes that are modified by <code class="function">glMultiDrawArraysIndirect</code> have an | |
72 | unspecified value after <code class="function">glMultiDrawArraysIndirect</code> returns. Attributes that aren't | |
73 | modified remain well defined. | |
74 | </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="notes"></a><h2>Notes</h2><p> | |
75 | The <em class="parameter"><code>baseInstance</code></em> member of the <em class="parameter"><code>DrawArraysIndirectCommand</code></em> | |
76 | structure is defined only if the GL version is 4.2 or greater. For versions of the GL less than 4.2, | |
77 | this parameter is present but is reserved and should be set to zero. On earlier versions of the GL, | |
78 | behavior is undefined if it is non-zero. | |
79 | </p><p> | |
80 | <code class="function">glMultiDrawArraysIndirect</code> is available only if the GL version is 4.3 or greater. | |
81 | </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="errors"></a><h2>Errors</h2><p> | |
82 | <code class="constant">GL_INVALID_ENUM</code> is generated if <em class="parameter"><code>mode</code></em> is not an accepted value. | |
83 | </p><p> | |
84 | <code class="constant">GL_INVALID_VALUE</code> is generated if <em class="parameter"><code>stride</code></em> is not a multiple | |
85 | of four. | |
86 | </p><p> | |
87 | <code class="constant">GL_INVALID_VALUE</code> is generated if <em class="parameter"><code>drawcount</code></em> is negative. | |
88 | </p><p> | |
89 | <code class="constant">GL_INVALID_OPERATION</code> is generated if a non-zero buffer object name is bound to an | |
90 | enabled array or to the <code class="constant">GL_DRAW_INDIRECT_BUFFER</code> binding and the buffer object's data store is currently mapped. | |
91 | </p><p> | |
92 | <code class="constant">GL_INVALID_OPERATION</code> is generated if a geometry shader is active and <em class="parameter"><code>mode</code></em> | |
93 | is incompatible with the input primitive type of the geometry shader in the currently installed program object. | |
94 | </p><p> | |
95 | <code class="constant">GL_INVALID_OPERATION</code> is generated if <em class="parameter"><code>mode</code></em> is <code class="constant">GL_PATCHES</code> | |
96 | and no tessellation control shader is active. | |
97 | </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="seealso"></a><h2>See Also</h2><p> | |
98 | <a href="glDrawArrays.xml"><span class="citerefentry"><span class="refentrytitle">glDrawArrays</span></span></a>, | |
99 | <a href="glDrawArraysInstanced.xml"><span class="citerefentry"><span class="refentrytitle">glDrawArraysInstanced</span></span></a>, | |
100 | <a href="glDrawElements.xml"><span class="citerefentry"><span class="refentrytitle">glDrawElements</span></span></a>, | |
101 | <a href="glDrawRangeElements.xml"><span class="citerefentry"><span class="refentrytitle">glDrawRangeElements</span></span></a>, | |
102 | <a href="glDrawArraysIndirect.xml"><span class="citerefentry"><span class="refentrytitle">glDrawArraysIndirect</span></span></a>, | |
103 | <a href="glMultiDrawElementsIndirect.xml"><span class="citerefentry"><span class="refentrytitle">glMultiDrawElementsIndirect</span></span></a> | |
104 | </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="Copyright"></a><h2>Copyright</h2><p> | |
105 | Copyright <span class="trademark"></span>© 2012 Khronos Group. | |
106 | This material may be distributed subject to the terms and conditions set forth in | |
107 | the Open Publication License, v 1.0, 8 June 1999. | |
108 | <a href="http://opencontent.org/openpub/" target="_top">http://opencontent.org/openpub/</a>. | |
109 | </p></div></div></body></html> |