diff options
author | Antoine Lambert <antoine-e.lambert@thalesgroup.com> | 2013-12-17 11:19:33 +0100 |
---|---|---|
committer | Antoine Lambert <antoine-e.lambert@thalesgroup.com> | 2013-12-17 11:19:33 +0100 |
commit | 6c0ea453a4a83636ab7abda7e7b689a87d5e87f2 (patch) | |
tree | 8b46431a16fdbfbb5e8dbcf1fcbb2df3f0baeff3 | |
parent | 611d08896c7e5a52c359ba30055a1f804d1effaa (diff) |
add support for WebGL hardware instancing through extension ANGLE_instanced_arrays
-rw-r--r-- | src/library_gl.js | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/library_gl.js b/src/library_gl.js index 29f78c8a..f21bbf54 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,33 @@ var LibraryGL = { return Module.ctx.getError(); } }, + + // ANGLE_instanced_arrays WebGL extension related functions + + glVertexAttribDivisor__sig: 'vii', + glVertexAttribDivisor: function(index, divisor) { +#if 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 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 ASSERTIONS + assert(GL.instancedArraysExt, 'Must have ANGLE_instanced_arrays extension to use WebGL instancing'); +#endif + GL.instancedArraysExt.drawElementsInstancedANGLE(mode, count, type, indices, primcount); + }, + // signatures of simple pass-through functions, see later glActiveTexture__sig: 'vi', |