Path: blob/main_old/extensions/ANGLE_multi_draw.txt
1693 views
Name12ANGLE_multi_draw34Name Strings56GL_ANGLE_multi_draw78Contributors910Austin Eng, Google Inc.11Kai Ninomiya, Google Inc.12Kenneth Russell, Google Inc.13Contributors to the EXT_multi_draw_arrays specification14Contributors to the ARB_shader_draw_parameters specification1516Contact1718Austin Eng (enga 'at' google.com)1920Status2122Incomplete2324Version2526Last Modified Date: October 24, 201827Author Revision: 12829Number3031OpenGL ES Extension XX3233Dependencies3435OpenGL ES 2.0 is required.3637This extension is written against the OpenGL ES 2.0 specification,38the OpenGL ES 3.0 specification, and the OpenGL ES Shading Language 3.039specification.4041The presence of the GL_ANGLE_instanced_arrays or GL_EXT_instanced_arrays42extensions affects the definition of this extension.4344Overview4546This extension exposes the Multi* draw call variants in47EXT_multi_draw_arrays functionality in addition to the vertex shader builtin48gl_DrawID exposed by ARB_shader_draw_parameters for OpenGL.4950These functions behave identically to the standard functions51DrawArrays() and DrawElements() except they handle multiple lists of52vertices in one call. Their main purpose is to allow one function call53to render more than one primitive such as triangle strip, triangle fan,54etc.5556Additionally, this extension adds a further built-in variable, gl_DrawID57to the shading language. This variable contains the index of the draw58currently being processed by a Multi* variant of a drawing command.5960IP Status6162No known IP claims.6364New Procedures and Functions6566void MultiDrawArraysANGLE(enum mode,67const GLint* firsts,68const GLsizei* counts,69const GLsizei drawcount);7071void MultiDrawElementsANGLE(enum mode,72const GLint* counts,73GLenum type,74const GLvoid* const* indices,75const GLsizei drawcount);7677void MultiDrawArraysInstancedANGLE(enum mode,78const GLint* firsts,79const GLsizei* counts,80const GLsizei* instanceCounts,81const GLsizei drawcount);8283void MultiDrawElementsInstancedANGLE(enum mode,84const GLint* counts,85GLenum type,86const GLvoid* const* indices,87const GLsizei* instanceCounts,88const GLsizei drawcount);8990New Tokens9192None.9394Additions to Chapter 2 of the OpenGL ES 2.0 Specification9596Section 2.8 Vertex Arrays:9798The command99100void MultiDrawArraysANGLE(GLenum mode,101const GLint* firsts,102const GLsizei *counts,103GLsizei drawcount)104105Behaves identically to DrawArrays except that a list of arrays is106specified instead. The number of lists is specified in the drawcount107parameter. It has the same effect as:108109for(i=0; i<drawcount; i++) {110if (*(counts+i)>0) DrawArrays(mode, *(firsts+i), *(counts+i));111}112113The index of the draw (<i> in the above pseudo-code) may be read by114a vertex shader as <gl_DrawID>.115116The command117118void MultiDrawElementsANGLE(GLenum mode,119GLsizei* counts,120GLenum type,121const GLvoid* const* indices,122GLsizei drawcount)123124Behaves identically to DrawElements except that a list of arrays is125specified instead. The number of lists is specified in the drawcount126parameter. It has the same effect as:127128for(i=0; i<drawcount; i++) {129if (*(counts+i)>0) {130DrawElements(mode, *(counts+i), type, *(indices+i));131}132}133134The index of the draw (<i> in the above pseudo-code) may be read by135a vertex shader as <gl_DrawID>.136137Additions to Chapter 2 of the OpenGL ES 3.0 Specification138139Section 2.9.3 Drawing Commands:140141The command142143void MultiDrawArraysInstancedANGLE(144GLenum mode,145const GLint* firsts,146const GLsizei *counts,147const GLsizei* instanceCounts,148GLsizei drawcount)149150Behaves identically to DrawArraysInstanced except that a list of arrays is151specified instead. The number of lists is specified in the drawcount152parameter. It has the same effect as:153154for(i=0; i<drawcount; i++) {155if (*(counts+i)>0) DrawArraysInstanced(mode, *(firsts+i), *(counts+i),156*(instanceCounts+1));157}158159The index of the draw (<i> in the above pseudo-code) may be read by160a vertex shader as <gl_DrawID>.161162The command163164void MultiDrawElementsInstancedANGLE(165GLenum mode,166GLsizei* counts,167GLenum type,168const GLvoid* const* indices,169const GLsizei* instanceCounts,170GLsizei drawcount)171172Behaves identically to DrawElementsInstanced except that a list of arrays is173specified instead. The number of lists is specified in the drawcount174parameter. It has the same effect as:175176for(i=0; i<drawcount; i++) {177if (*(counts+i)>0) {178DrawElementsInstanced(mode, *(counts+i), type,179*(indices+i), *(instanceCounts+1));180}181}182183The index of the draw (<i> in the above pseudo-code) may be read by184a vertex shader as <gl_DrawID>.185186Errors187188The error INVALID_VALUE is generated by the new functions if <drawcount>189is less than 0.190191MultiDrawArraysANGLE, MultiDrawElementsANGLE,192MultiDrawArraysInstancedANGLE, and MultiDrawElementsInstancedANGLE generate193the same errors as DrawArrays, DrawElements, DrawArraysInstanced,194and DrawElementsInstanced, respectively, for any draw <i> where an error195is generated. If any call would produce an error, no drawing is performed.196197Modifications to the OpenGL ES Shading Language Specification, Version 3.00198199Including the following line in a shader can be used to control the200language featured described in this extension:201202#extension GL_ANGLE_multi_draw : <behavior>203204where <behavior> is as specified in section 3.5.205206A new preprocessor #define is added to the OpenGL ES Shading Language:207208#define GL_ANGLE_multi_draw 1209210Dependencies on GL_ANGLE_instanced_arrays211212If GL_ANGLE_instanced_arrays or GL_EXT_instanced_arrays is enabled,213append the lanuage in "Additions to Chapter 2 of the OpenGL ES 3.0214Specification, Section 2.9.3 Drawing Commands" to the language in215"Additions to Chapter 2 of the OpenGL ES 2.0 Specification, Section2162.8 Vertex Arrays".217218If GL_ANGLE_instanced_arrays or GL_EXT_instanced_arrays is not enabled219and the context is less than a OpenGL ES 3.0 context, the error220INVALID_OPERATION is generated by any call to the functions221MultiDrawArraysInstancedANGLE and MultiDrawElementsInstancedANGLE.222223Issues224None225226Revision History227228Rev. Date Author Changes229---- -------- ---------- --------------------------------------------2301 10/24/18 Austin Eng First revision.2312 10/25/18 Austin Eng Second revision. Add instanced variants232233234