xref: /aosp_15_r20/external/angle/extensions/ANGLE_base_vertex_base_instance.txt (revision 8975f5c5ed3d1c378011245431ada316dfb6f244)
1Name
2
3    ANGLE_base_vertex_base_instance
4
5Name Strings
6
7    GL_ANGLE_base_vertex_base_instance
8
9Contributors
10
11    Shrek Shao, Google Inc.
12    Contributors to the OES_draw_elements_base_vertex specification
13    Contributors to the EXT_draw_elements_base_vertex specification
14    Contributors to the EXT_multi_draw_arrays specification
15    Contributors to the ARB_shader_draw_parameters specification
16
17Contact
18
19    Shrek Shao (shrekshao 'at' google.com)
20
21Status
22
23    Incomplete
24
25Version
26
27    Last Modified Date: Nov 19, 2021
28    Author Revision: 3
29
30Number
31
32    OpenGL ES Extension XX
33
34Dependencies
35
36    OpenGL ES 3.1 is required.
37
38    This extension is written against the OpenGL ES 3.1 specification, the
39    OpenGL ES 3.2 specification, and the OpenGL ES Shading Language 3.0
40    specification.
41
42    GL_ANGLE_multi_draw is required.
43
44Overview
45
46    This extension exposes the *BaseVertex* draw call in
47    OES_draw_elements_base_vertex/EXT_draw_elements_base_vertex together with
48    their newly added *BaseInstance and MultiDraw* variants in addition to the
49    vertex shader builtins <gl_BaseVertex> and <gl_BaseInstance> exposed by
50    ARB_shader_draw_parameters for OpenGL.
51
52    *BaseInstance behaves identically to its counterpart draw calls except that
53    <instanceCount> instances of the range of elements are executed and the
54    value of <instance> advances for each iteration. Those attributes that have
55    non-zero values for <divisor>, as specified by VertexAttribDivisor, advance
56    once per <divisor> instances of the set(s) of vertices being rendered.
57    Additionally, <baseInstance> specifies the first element within the
58    instanced vertex attributes.
59
60    *BaseVertex* is equivalent to its counterpart draw calls except that
61    the value of the base vertex passed into the driver is <baseVertex> instead
62    of zero, and that <instances> of the set of elements are executed and the
63    value of <instance> advances between each set.
64
65IP Status
66
67    No known IP claims.
68
69New Procedures and Functions
70
71    void DrawArraysInstancedBaseInstanceANGLE(enum mode,
72                                              int first,
73                                              sizei count,
74                                              sizei instanceCount,
75                                              uint baseInstance);
76
77    void DrawElementsInstancedBaseVertexBaseInstanceANGLE(enum mode,
78                                                          sizei count,
79                                                          enum type,
80                                                          const void *indices,
81                                                          sizei instanceCount,
82                                                          int baseVertex,
83                                                          uint baseInstance);
84
85    void MultiDrawArraysInstancedBaseInstanceANGLE(enum mode,
86                                                   const int *firsts,
87                                                   const sizei *counts,
88                                                   const sizei *instanceCounts,
89                                                   const uint *baseInstances,
90                                                   sizei drawcount);
91
92    void MultiDrawElementsInstancedBaseVertexBaseInstanceANGLE(enum mode,
93                                                               const sizei *counts,
94                                                               enum type,
95                                                               const void *const *indices,
96                                                               const sizei *instanceCounts,
97                                                               const int *baseVertices,
98                                                               const uint *baseInstances,
99                                                               sizei drawcount);
100
101New Tokens
102
103    None.
104
105Additions to Chapter 10 of the OpenGL ES 3.2 Specification
106
107    Section 10.5 Drawing Commands Using Vertex Arrays:
108
109    The command
110
111    void DrawArraysInstancedBaseInstanceANGLE(
112        enum mode,
113        int first,
114        sizei count,
115        sizei instanceCount,
116        uint baseInstance);
117
118    Behaves identically to DrawArraysInstanced except that <baseInstance> is
119    passed down to DrawArraysOneInstance instead of zero.
120
121    The command
122
123    void MultiDrawArraysInstancedBaseInstanceANGLE(
124        enum mode,
125        const int *firsts,
126        const sizei *counts,
127        const sizei *instanceCounts,
128        const uint *baseInstances,
129        sizei drawcount);
130
131    Behaves identically to DrawArraysInstancedBaseInstanceANGLE except that a
132    list of arrays is specified instead. The number of lists is specified in
133    the <drawcount> parameter. It has the same effect as:
134
135      for(i=0; i<drawcount; i++) {
136        if (*(counts+i)>0) DrawArraysInstancedBaseInstance(
137                mode,
138                *(counts+i),
139                *(instanceCounts+i),
140                *(firsts+i),
141                *(baseInstance+i)
142            );
143      }
144
145    The index of the draw (<i> in the above pseudo-code) may be read by
146    a vertex shader as <gl_DrawID> which is defined in GL_ANGLE_multi_draw.
147
148    The command
149
150    void DrawElementsInstancedBaseVertexBaseInstanceANGLE(
151        enum mode,
152        sizei count,
153        enum type,
154        const void *indices,
155        sizei instanceCount,
156        int baseVertex,
157        uint baseInstance);
158
159    Behaves identically to DrawElementsInstanced except that <baseVertex> and
160    <baseInstance> are passed down to DrawElementsOneInstance instead of zero.
161
162    The command
163
164    void MultiDrawElementsInstancedBaseVertexBaseInstanceANGLE(
165        enum mode,
166        const sizei *counts,
167        enum type,
168        const void *const *indices,
169        const sizei *instanceCounts,
170        const int *baseVertices,
171        const uint *baseInstances,
172        sizei drawcount);
173
174    Behaves identically to DrawElementsInstancedBaseVertexBaseInstanceANGLE
175    except that a list of arrays is specified instead. The number of lists is
176    specified in the <drawcount> parameter. It has the same effect as:
177
178      for(i=0; i<drawcount; i++) {
179        if (*(counts+i)>0) DrawElementsInstancedBaseVertexBaseInstanceANGLE(
180                mode,
181                *(counts+i),
182                type,
183                *(instanceCounts+i),
184                *(indices+i),
185                *(baseVertices+i),
186                *(baseInstances+i)
187            );
188      }
189
190    The index of the draw (<i> in the above pseudo-code) may be read by
191    a vertex shader as <gl_DrawID> which is defined in GL_ANGLE_multi_draw.
192
193Errors
194
195    DrawArraysInstancedBaseInstanceANGLE and
196    DrawElementsInstancedBaseVertexBaseInstanceANGLE
197    generate the same errors as DrawArraysInstanced and DrawElementsInstanced.
198
199    MultiDrawArraysInstancedBaseInstanceANGLE and
200    MultiDrawElementsInstancedBaseVertexBaseInstanceANGLE
201    generate the same errors as DrawArraysInstanced and DrawElementsInstanced,
202    respectively, for any draw <i> where an error is generated. If any call
203    would produce an error, no drawing is performed.
204
205    The error INVALID_VALUE is generated by the MultiDraw* functions if
206    <drawcount> is less than zero.
207
208Dependencies on GL_OES_draw_elements_base_vertex and
209GL_EXT_draw_elements_base_vertex
210
211    If the OpenGL ES context version is less than 3.2, this extension is only
212    available when GL_OES_draw_elements_base_vertex or
213    GL_EXT_draw_elements_base_vertex are available.
214
215Issues
216
217    None
218
219Revision History
220
221    Rev.    Date    Author            Changes
222    ----  --------  ----------------  --------------------------------------------
223    1     08/13/19   Shrek Shao       First revision.
224    2     07/14/20   Shrek Shao       Fix baseInstance type from GLint to GLuint.
225    3     11/19/21   Shrek Shao       Decouple gl_BaseVertex/gl_BaseInstance.
226    4     06/21/22   Alexey Knyazev   Fixed typos and type usage.
227