aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJukka Jylänki <jujjyl@gmail.com>2013-11-25 14:20:58 +0200
committerJukka Jylänki <jujjyl@gmail.com>2013-11-26 23:24:55 +0200
commitb53ec8392ee2bfd2791bc30d089f3170909ab300 (patch)
tree7b6ce7a15c2d611132831b44e83a2e2a902d182d /src
parent29906a675d9da025fc428d1cb95ed1a0f7bfb691 (diff)
Added new configuration parameter support 'GL_MAX_TEXTURE_IMAGE_UNITS' to the emscripten Module object so that codebases using fixed-function GL emulation mode can hint to the emulation code how many texture units they are using at maximum. This optimizes the emulation code path to avoid having to examine an unnecessary amount of texture units at each draw call (at minimum the code would loop over to confirm that the unused texunits are really unused, which would burn up some unneeded cycles.)
Diffstat (limited to 'src')
-rw-r--r--src/library_gl.js14
1 files changed, 4 insertions, 10 deletions
diff --git a/src/library_gl.js b/src/library_gl.js
index afd36197..12e814f9 100644
--- a/src/library_gl.js
+++ b/src/library_gl.js
@@ -3243,14 +3243,8 @@ var LibraryGL = {
NORMAL: 1,
COLOR: 2,
TEXTURE0: 3,
- TEXTURE1: 4,
- TEXTURE2: 5,
- TEXTURE3: 6,
- TEXTURE4: 7,
- TEXTURE5: 8,
- TEXTURE6: 9,
- NUM_ATTRIBUTES: 10, // Overwritten in init().
- MAX_TEXTURES: 7, // Overwritten in init().
+ NUM_ATTRIBUTES: -1, // Initialized in GL emulation init().
+ MAX_TEXTURES: -1, // Initialized in GL emulation init().
totalEnabledClientAttributes: 0,
enabledClientAttributes: [0, 0],
@@ -3858,8 +3852,8 @@ var LibraryGL = {
this.TexEnvJIT.init(Module.ctx);
- GL.immediate.MAX_TEXTURES = Module.ctx.getParameter(Module.ctx.MAX_TEXTURE_IMAGE_UNITS);
- GL.immediate.NUM_ATTRIBUTES = GL.immediate.TEXTURE0 + GL.immediate.MAX_TEXTURES;
+ GL.immediate.MAX_TEXTURES = Module['GL_MAX_TEXTURE_IMAGE_UNITS'] || Module.ctx.getParameter(Module.ctx.MAX_TEXTURE_IMAGE_UNITS);
+ GL.immediate.NUM_ATTRIBUTES = 3 /*pos+normal+color attributes*/ + GL.immediate.MAX_TEXTURES;
GL.immediate.clientAttributes = [];
for (var i = 0; i < GL.immediate.NUM_ATTRIBUTES; i++) {
GL.immediate.clientAttributes.push({});