File: ANGLE_base_vertex_base_instance.txt

package info (click to toggle)
webkit2gtk 2.51.2-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 457,708 kB
  • sloc: cpp: 3,884,629; javascript: 198,661; ansic: 165,298; python: 49,171; asm: 21,849; ruby: 18,095; perl: 16,914; xml: 4,623; sh: 2,397; yacc: 2,356; java: 2,019; lex: 1,330; pascal: 372; makefile: 197
file content (226 lines) | stat: -rw-r--r-- 8,061 bytes parent folder | download | duplicates (24)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
Name

    ANGLE_base_vertex_base_instance

Name Strings

    GL_ANGLE_base_vertex_base_instance

Contributors

    Shrek Shao, Google Inc.
    Contributors to the OES_draw_elements_base_vertex specification
    Contributors to the EXT_draw_elements_base_vertex specification
    Contributors to the EXT_multi_draw_arrays specification
    Contributors to the ARB_shader_draw_parameters specification

Contact

    Shrek Shao (shrekshao 'at' google.com)

Status

    Incomplete

Version

    Last Modified Date: Nov 19, 2021
    Author Revision: 3

Number

    OpenGL ES Extension XX

Dependencies

    OpenGL ES 3.1 is required.

    This extension is written against the OpenGL ES 3.1 specification, the
    OpenGL ES 3.2 specification, and the OpenGL ES Shading Language 3.0
    specification.

    GL_ANGLE_multi_draw is required.

Overview

    This extension exposes the *BaseVertex* draw call in
    OES_draw_elements_base_vertex/EXT_draw_elements_base_vertex together with
    their newly added *BaseInstance and MultiDraw* variants in addition to the
    vertex shader builtins <gl_BaseVertex> and <gl_BaseInstance> exposed by
    ARB_shader_draw_parameters for OpenGL.

    *BaseInstance behaves identically to its counterpart draw calls except that
    <instanceCount> instances of the range of elements are executed and the
    value of <instance> advances for each iteration. Those attributes that have
    non-zero values for <divisor>, as specified by VertexAttribDivisor, advance
    once per <divisor> instances of the set(s) of vertices being rendered.
    Additionally, <baseInstance> specifies the first element within the
    instanced vertex attributes.

    *BaseVertex* is equivalent to its counterpart draw calls except that
    the value of the base vertex passed into the driver is <baseVertex> instead
    of zero, and that <instances> of the set of elements are executed and the
    value of <instance> advances between each set.

IP Status

    No known IP claims.

New Procedures and Functions

    void DrawArraysInstancedBaseInstanceANGLE(enum mode,
                                              int first,
                                              sizei count,
                                              sizei instanceCount,
                                              uint baseInstance);

    void DrawElementsInstancedBaseVertexBaseInstanceANGLE(enum mode,
                                                          sizei count,
                                                          enum type,
                                                          const void *indices,
                                                          sizei instanceCount,
                                                          int baseVertex,
                                                          uint baseInstance);

    void MultiDrawArraysInstancedBaseInstanceANGLE(enum mode,
                                                   const int *firsts,
                                                   const sizei *counts,
                                                   const sizei *instanceCounts,
                                                   const uint *baseInstances,
                                                   sizei drawcount);

    void MultiDrawElementsInstancedBaseVertexBaseInstanceANGLE(enum mode,
                                                               const sizei *counts,
                                                               enum type,
                                                               const void *const *indices,
                                                               const sizei *instanceCounts,
                                                               const int *baseVertices,
                                                               const uint *baseInstances,
                                                               sizei drawcount);

New Tokens

    None.

Additions to Chapter 10 of the OpenGL ES 3.2 Specification

    Section 10.5 Drawing Commands Using Vertex Arrays:

    The command

    void DrawArraysInstancedBaseInstanceANGLE(
        enum mode,
        int first,
        sizei count,
        sizei instanceCount,
        uint baseInstance);

    Behaves identically to DrawArraysInstanced except that <baseInstance> is
    passed down to DrawArraysOneInstance instead of zero.

    The command

    void MultiDrawArraysInstancedBaseInstanceANGLE(
        enum mode,
        const int *firsts,
        const sizei *counts,
        const sizei *instanceCounts,
        const uint *baseInstances,
        sizei drawcount);

    Behaves identically to DrawArraysInstancedBaseInstanceANGLE except that a
    list of arrays is specified instead. The number of lists is specified in
    the <drawcount> parameter. It has the same effect as:

      for(i=0; i<drawcount; i++) {
        if (*(counts+i)>0) DrawArraysInstancedBaseInstance(
                mode,
                *(counts+i),
                *(instanceCounts+i),
                *(firsts+i),
                *(baseInstance+i)
            );
      }

    The index of the draw (<i> in the above pseudo-code) may be read by
    a vertex shader as <gl_DrawID> which is defined in GL_ANGLE_multi_draw.

    The command

    void DrawElementsInstancedBaseVertexBaseInstanceANGLE(
        enum mode,
        sizei count,
        enum type,
        const void *indices,
        sizei instanceCount,
        int baseVertex,
        uint baseInstance);

    Behaves identically to DrawElementsInstanced except that <baseVertex> and
    <baseInstance> are passed down to DrawElementsOneInstance instead of zero.

    The command

    void MultiDrawElementsInstancedBaseVertexBaseInstanceANGLE(
        enum mode,
        const sizei *counts,
        enum type,
        const void *const *indices,
        const sizei *instanceCounts,
        const int *baseVertices,
        const uint *baseInstances,
        sizei drawcount);

    Behaves identically to DrawElementsInstancedBaseVertexBaseInstanceANGLE
    except that a list of arrays is specified instead. The number of lists is
    specified in the <drawcount> parameter. It has the same effect as:

      for(i=0; i<drawcount; i++) {
        if (*(counts+i)>0) DrawElementsInstancedBaseVertexBaseInstanceANGLE(
                mode,
                *(counts+i),
                type,
                *(instanceCounts+i),
                *(indices+i),
                *(baseVertices+i),
                *(baseInstances+i)
            );
      }

    The index of the draw (<i> in the above pseudo-code) may be read by
    a vertex shader as <gl_DrawID> which is defined in GL_ANGLE_multi_draw.

Errors

    DrawArraysInstancedBaseInstanceANGLE and
    DrawElementsInstancedBaseVertexBaseInstanceANGLE
    generate the same errors as DrawArraysInstanced and DrawElementsInstanced.

    MultiDrawArraysInstancedBaseInstanceANGLE and
    MultiDrawElementsInstancedBaseVertexBaseInstanceANGLE
    generate the same errors as DrawArraysInstanced and DrawElementsInstanced,
    respectively, for any draw <i> where an error is generated. If any call
    would produce an error, no drawing is performed.

    The error INVALID_VALUE is generated by the MultiDraw* functions if
    <drawcount> is less than zero.

Dependencies on GL_OES_draw_elements_base_vertex and
GL_EXT_draw_elements_base_vertex

    If the OpenGL ES context version is less than 3.2, this extension is only
    available when GL_OES_draw_elements_base_vertex or
    GL_EXT_draw_elements_base_vertex are available.

Issues

    None

Revision History

    Rev.    Date    Author            Changes
    ----  --------  ----------------  --------------------------------------------
    1     08/13/19   Shrek Shao       First revision.
    2     07/14/20   Shrek Shao       Fix baseInstance type from GLint to GLuint.
    3     11/19/21   Shrek Shao       Decouple gl_BaseVertex/gl_BaseInstance.
    4     06/21/22   Alexey Knyazev   Fixed typos and type usage.