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 GLint first, 73 GLsizei count, 74 GLsizei instanceCount, 75 GLuint baseInstance); 76 77 void DrawElementsInstancedBaseVertexBaseInstanceANGLE(GLenum mode, 78 GLsizei count, 79 GLenum type, 80 const GLvoid *indices, 81 GLsizei instanceCount, 82 GLint baseVertex, 83 GLuint baseInstance); 84 85 void MultiDrawArraysInstancedBaseInstanceANGLE(enum mode, 86 const GLint* firsts, 87 const GLsizei* counts, 88 const GLsizei* instanceCounts, 89 const GLuint* baseInstances, 90 const GLsizei drawcount); 91 92 void MultiDrawElementsInstancedBaseVertexBaseInstanceANGLE(enum mode, 93 const GLint* counts, 94 GLenum type, 95 const GLvoid* const* indices, 96 const GLsizei* instanceCounts, 97 const GLint* baseVertices, 98 const GLuint* baseInstances, 99 const GLsizei 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 (GLenum mode, 112 GLint first, 113 GLsizei count, 114 GLsizei instanceCount, 115 GLuint baseInstance); 116 117 Behaves identically to DrawArraysInstanced except that <baseInstance> is 118 passed down to DrawArraysOneInstance instead of zero. 119 120 The command 121 122 void MultiDrawArraysInstancedBaseInstanceANGLE(GLenum mode, 123 const GLint* firsts, 124 const GLsizei* counts, 125 const GLsizei* instanceCounts, 126 const GLuint* baseInstances, 127 GLsizei drawcount); 128 129 Behaves identically to DrawArraysInstancedBaseInstanceANGLE except that a 130 list of arrays is specified instead. The number of lists is specified in 131 the <drawcount> parameter. It has the same effect as: 132 133 for(i=0; i<drawcount; i++) { 134 if (*(counts+i)>0) DrawArraysInstancedBaseInstance( 135 mode, 136 *(counts+i), 137 *(instanceCounts+i), 138 *(firsts+i), 139 *(baseInstance+i) 140 ); 141 } 142 143 The index of the draw (<i> in the above pseudo-code) may be read by 144 a vertex shader as <gl_DrawID> which is defined in GL_ANGLE_multi_draw. 145 146 The command 147 148 void DrawElementsInstancedBaseVertexBaseInstanceANGLE (GLenum mode, 149 GLsizei count, 150 GLenum type, 151 const GLvoid* indices, 152 GLsizei instanceCount, 153 GLint baseVertex, 154 GLuint baseInstance); 155 156 Behaves identically to DrawElementsInstanced except that <baseVertex> and 157 <baseInstance> are passed down to DrawElementsOneInstance instead of zero. 158 159 The command 160 161 void MultiDrawElementsInstancedBaseVertexBaseInstanceANGLE(GLenum mode, 162 const GLsizei* counts, 163 GLenum type, 164 const GLvoid* const* indices, 165 const GLsizei* instanceCounts, 166 const GLint* baseVertices, 167 const GLuint* baseInstances, 168 GLsizei drawcount); 169 170 Behaves identically to DrawElementsInstancedBaseVertexBaseInstanceANGLE 171 except that a list of arrays is specified instead. The number of lists is 172 specified in the <drawcount> parameter. It has the same effect as: 173 174 for(i=0; i<drawcount; i++) { 175 if (*(counts+i)>0) DrawElementsInstancedBaseVertexBaseInstanceANGLE( 176 mode, 177 *(counts+i), 178 type, 179 *(instanceCounts+i), 180 *(indices+i), 181 *(baseVertices+i), 182 *(baseInstances+i) 183 ); 184 } 185 186 The index of the draw (<i> in the above pseudo-code) may be read by 187 a vertex shader as <gl_DrawID> which is defined in GL_ANGLE_multi_draw. 188 189Errors 190 191 DrawArraysInstancedBaseInstanceANGLE and 192 DrawElementsInstancedBaseVertexBaseInstanceANGLE 193 generate the same errors as DrawArraysInstanced and DrawElementsInstanced. 194 195 MultiDrawArraysInstancedBaseInstanceANGLE and 196 MultiDrawElementsInstancedBaseVertexBaseInstanceANGL 197 generate the same errors as DrawArraysInstanced and DrawElementsInstanced, 198 respectively, for any draw <i> where an error is generated. If any call 199 would produce an error, no drawing is performed. 200 201 The error INVALID_VALUE is generated by the MultiDraw* functions if 202 <drawcount> is less than zero. 203 204Dependencies on GL_OES_draw_elements_base_vertex and 205GL_EXT_draw_elements_base_vertex 206 207 If the OpenGL ES context version is less than 3.2, this extension is only 208 available when GL_OES_draw_elements_base_vertex or 209 GL_EXT_draw_elements_base_vertex are available. 210 211Issues 212 213 None 214 215Revision History 216 217 Rev. Date Author Changes 218 ---- -------- ---------- -------------------------------------------- 219 1 08/13/19 Shrek Shao First revision. 220 2 07/14/20 Shrek Shao Fix baseInstance type from GLint to GLuint. 221 3 11/19/21 Shrek Shao Decouple gl_BaseVertex/gl_BaseInstance. 222