• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1Name
2
3    ARB_multi_draw_indirect
4
5Name Strings
6
7    GL_ARB_multi_draw_indirect
8
9Contact
10
11    Graham Sellers, AMD (graham.sellers 'at' amd.com)
12
13Contributors
14
15    Graham Sellers
16
17Notice
18
19    Copyright (c) 2012-2013 The Khronos Group Inc. Copyright terms at
20        http://www.khronos.org/registry/speccopyright.html
21
22Specification Update Policy
23
24    Khronos-approved extension specifications are updated in response to
25    issues and bugs prioritized by the Khronos OpenGL Working Group. For
26    extensions which have been promoted to a core Specification, fixes will
27    first appear in the latest version of that core Specification, and will
28    eventually be backported to the extension document. This policy is
29    described in more detail at
30        https://www.khronos.org/registry/OpenGL/docs/update_policy.php
31
32Status
33
34    Complete.
35    Approved by the ARB on 2012/06/12.
36
37Version
38
39    Last Modified Date: June 9, 2014
40    Revision: 4
41
42Number
43
44    ARB Extension #133
45
46Dependencies
47
48    OpenGL 4.0 or ARB_draw_indirect is required.
49
50    The extension is written against the OpenGL 4.1 Specification, Core Profile,
51    July 25, 2010
52
53Overview
54
55    The ARB_draw_indirect extension (included in OpenGL 4.0) introduced
56    mechanisms whereby the parameters for a draw function may be provided in
57    a structure contained in a buffer object rather than as parameters to the
58    drawing procedure. This is known as an indirect draw and is exposed as two
59    new functions, glDrawArraysIndirect and glDrawElementsIndirect. Each of
60    these functions generates a single batch of primitives.
61
62    This extension builds on this functionality by providing procedures to
63    invoke multiple draws from a single procedure call. This allows large
64    batches of drawing commands to be assembled in server memory (via a buffer
65    object) which may then be dispatched through a single function call.
66
67New Procedures and Functions
68
69        void MultiDrawArraysIndirect(enum mode,
70                                        const void *indirect,
71                                        sizei primcount,
72                                        sizei stride);
73
74        void MultiDrawElementsIndirect(enum mode,
75                                          enum type,
76                                          const void *indirect,
77                                          sizei primcount,
78                                          sizei stride);
79
80New Tokens
81
82    None.
83
84Additions to Chapter 2 of the OpenGL 4.1 (Core) Specification (OpenGL Operation)
85
86    Additions to Section 2.8.3, "Drawing Commands"
87
88    After the description of MultiDrawArrays and before the introduction of
89    DrawElementsInstanced, insert the following on p.36:
90
91        The command
92
93        void MultiDrawArraysIndirect(enum mode,
94                                        const void *indirect,
95                                        sizei primcount,
96                                        sizei stride);
97
98    behaves identically to DrawArraysIndirect, except that <indirect> is
99    treated as an array of <primcount> DrawArraysIndirectCommand structures.
100    <indirect> contains the offset of the first element of the array within the
101    buffer currently bound to the DRAW_INDIRECT buffer binding.<stride>
102    specifies the distance, in basic machine units, between the elements of the
103    array. If <stride> is zero, the array elements are treated as tightly
104    packed. <stride> must be a multiple of four, otherwise an INVALID_VALUE
105    error is generated.
106
107    It has the same effect as (assuming no errors are generated):
108
109        if (<mode> is invalid)
110            generate appropriate error
111        else {
112            const ubyte * ptr = (const ubyte *)indirect;
113            for (i = 0; i < primcount; i++) {
114                DrawArraysIndirect(mode,
115                                   (DrawArraysIndirectCommand*)ptr);
116                if (stride == 0)
117                {
118                    ptr += sizeof(DrawArraysIndirectCommand);
119                } else
120                {
121                    ptr += stride;
122                }
123            }
124        }
125
126    <primcount> must be positive, otherwise an INVALID_VALUE error will be
127    generated.
128
129    After the description of DrawElementsIndirect and before the introduction
130    of MultiDrawElementsBaseVertex, insert the following on p.39:
131
132        The command
133
134        void MultiDrawElementsIndirect(enum mode,
135                                       enum type,
136                                       const void *indirect,
137                                       sizei primcount,
138                                       sizei stride);
139
140    behaves identically to DrawElementsIndirect, except that <indirect> is
141    treated as an array of <primcount> DrawElementsIndirectCommand structures.
142    <indirect> contains the offset of the first element of the array within the
143    buffer currently bound to the DRAW_INDIRECT buffer binding. <stride>
144    specifies the distance, in basic machine units, between the elements of the
145    array. If <stride> is zero, the array elements are treated as tightly
146    packed. <stride> must be a multiple of four, otherwise an INVALID_VALUE
147    error is generated.
148
149    It has the same effect as (assuming no errors are generated):
150
151        if (<mode> or <type> is invalid)
152            generate appropriate error
153        else {
154            const ubyte * ptr = (const ubyte *)indirect;
155            for (i = 0; i < primcount; i++) {
156                DrawElementsIndirect(mode,
157                                     type,
158                                     (DrawElementsIndirectCommand*)ptr);
159                if (stride == 0)
160                {
161                    ptr += sizeof(DrawElementsIndirectCommand);
162                } else
163                {
164                    ptr += stride;
165                }
166            }
167        }
168
169    Modifications to Section 2.9.8 "Indirect Commands in Buffer Objects"
170
171    Modify both instances of "DrawArraysIndirect and DrawElementsIndirect" on
172    p.51 to read "DrawArraysIndirect, DrawElementsIndirect,
173    MultiDrawArraysIndirect and MultiDrawElementsIndirect".
174
175Additions to Chapter 3 of the OpenGL 4.1 (Core) Specification (Rasterization)
176
177    None.
178
179Additions to Chapter 4 of the OpenGL 4.1 (Core) Specification (Per-Fragment Operations
180and the Framebuffer)
181
182    None.
183
184Additions to Chapter 5 of the OpenGL 4.1 (Core) Specification (Special
185Functions)
186
187    None.
188
189Additions to Chapter 6 of the OpenGL 4.1 (Core) Specification (State and
190State Requests)
191
192    None.
193
194Additions to the AGL/GLX/WGL Specifications
195
196    None.
197
198GLX Protocol
199
200    None.
201
202Errors
203
204    MultiDrawArraysIndirect and MultiDrawElementsIndirect may generate the
205    same errors as the corresponding DrawArraysIndirect and
206    DrawElementsIndirect commands in the equivalent pseudocode. In addition,
207
208    INVALID_VALUE is generated by MultiDrawArraysIndirect or
209    MultiDrawElementsIndirect if <primcount> is negative.
210
211    INVALID_VALUE is generated by MultiDrawArraysIndirect or
212    MultiDrawElementsIndirect if <stride> is not a multipe of four.
213
214New State
215
216    None.
217
218New Implementation Dependent State
219
220    None.
221
222Issues
223
224    None, so far.
225
226Revision History
227
228    Rev.    Date      Author    Changes
229    ----  --------    --------  -----------------------------------------
230     4    06/09/2014  Jon Leech Note that errors can be generated from
231                                the non-Multi Draw*Indirect commands
232                                in the equivalent pseudocode (Bug 11946).
233     3    06/14/2012  Jon Leech Change to ARB extension & remove suffixes
234     2    02/14/2011  gsellers  Add stride parameters
235     1    01/06/2011  gsellers  Initial draft
236