diff options
-rw-r--r-- | src/library_gl.js | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/library_gl.js b/src/library_gl.js index 29f78c8a..efe3b868 100644 --- a/src/library_gl.js +++ b/src/library_gl.js @@ -547,6 +547,9 @@ var LibraryGL = { Module.ctx.getExtension('WEBKIT_EXT_texture_filter_anisotropic'); GL.floatExt = Module.ctx.getExtension('OES_texture_float'); + + // Extension available from Firefox 26 and Google Chrome 30 + GL.instancedArraysExt = Module.ctx.getExtension('ANGLE_instanced_arrays'); // These are the 'safe' feature-enabling extensions that don't add any performance impact related to e.g. debugging, and // should be enabled by default so that client GLES2/GL code will not need to go through extra hoops to get its stuff working. @@ -4959,6 +4962,45 @@ var LibraryGL = { return Module.ctx.getError(); } }, + + // ANGLE_instanced_arrays WebGL extension related functions + + glVertexAttribDivisor__sig: 'vii', + glVertexAttribDivisor: function(index, divisor) { +#if GL_ASSERTIONS + assert(GL.instancedArraysExt, 'Must have ANGLE_instanced_arrays extension to use WebGL instancing'); +#endif + GL.instancedArraysExt.vertexAttribDivisorANGLE(index, divisor); + }, + + glDrawArraysInstanced_sig: 'viiii', + glDrawArraysInstanced: function(mode, first, count, primcount) { +#if GL_ASSERTIONS + assert(GL.instancedArraysExt, 'Must have ANGLE_instanced_arrays extension to use WebGL instancing'); +#endif + GL.instancedArraysExt.drawArraysInstancedANGLE(mode, first, count, primcount); + }, + + glDrawElementsInstanced_sig: 'viiiii', + glDrawElementsInstanced: function(mode, count, type, indices, primcount) { +#if GL_ASSERTIONS + assert(GL.instancedArraysExt, 'Must have ANGLE_instanced_arrays extension to use WebGL instancing'); +#endif + GL.instancedArraysExt.drawElementsInstancedANGLE(mode, count, type, indices, primcount); + }, + + // OpenGL Desktop/ES 2.0 instancing extensions compatibility + + glVertexAttribDivisorNV: 'glVertexAttribDivisor', + glDrawArraysInstancedNV: 'glDrawArraysInstanced', + glDrawElementsInstancedNV: 'glDrawElementsInstanced', + glVertexAttribDivisorEXT: 'glVertexAttribDivisor', + glDrawArraysInstancedEXT: 'glDrawArraysInstanced', + glDrawElementsInstancedEXT: 'glDrawElementsInstanced', + glVertexAttribDivisorARB: 'glVertexAttribDivisor', + glDrawArraysInstancedARB: 'glDrawArraysInstanced', + glDrawElementsInstancedARB: 'glDrawElementsInstanced', + // signatures of simple pass-through functions, see later glActiveTexture__sig: 'vi', |