aboutsummaryrefslogtreecommitdiff
path: root/src/library_gl.js
diff options
context:
space:
mode:
authorEhsan Akhgari <ehsan.akhgari@gmail.com>2012-06-19 19:52:46 -0400
committerEhsan Akhgari <ehsan.akhgari@gmail.com>2012-06-19 19:52:46 -0400
commit5a73bed81884ef9ff577981d875836cbad92650b (patch)
treeaebf4ba9abe1f168a69dab53e42445a7a5c3eda9 /src/library_gl.js
parentdf16a752c4cc580891aecdd4387c11e1b1f7443f (diff)
Check for supported capabilities explicitly
This prevents a bunch of warning messages for things which we don't support.
Diffstat (limited to 'src/library_gl.js')
-rw-r--r--src/library_gl.js25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/library_gl.js b/src/library_gl.js
index 68f8248b..212ccc4e 100644
--- a/src/library_gl.js
+++ b/src/library_gl.js
@@ -917,27 +917,28 @@ var LibraryGL = {
// Add some emulation workarounds
Module.printErr('WARNING: using emscripten GL emulation. This is a collection of limited workarounds, do not expect it to work');
- // XXX some of these ignored capabilities may lead to incorrect rendering, if we do not emulate them in shaders
- var ignoredCapabilities = {
- 0x0B20: 1, // GL_LINE_SMOOTH
- 0x0B60: 1, // GL_FOG
- 0x0BA1: 1, // GL_NORMALIZE
- 0x0C60: 1, // GL_TEXTURE_GEN_S
- 0x0C61: 1, // GL_TEXTURE_GEN_T
- 0x0DE1: 1, // GL_TEXTURE_2D
- 0x8513: 1, // GL_TEXTURE_CUBE_MAP
- 0x2A02: 1 // GL_POLYGON_OFFSET_LINE
+ // XXX some of the capabilities we don't support may lead to incorrect rendering, if we do not emulate them in shaders
+ var validCapabilities = {
+ 0x0B44: 1, // GL_CULL_FACE
+ 0x0BE2: 1, // GL_BLEND
+ 0x0BD0: 1, // GL_DITHER,
+ 0x0B90: 1, // GL_STENCIL_TEST
+ 0x0B71: 1, // GL_DEPTH_TEST
+ 0x0C11: 1, // GL_SCISSOR_TEST
+ 0x8037: 1, // GL_POLYGON_OFFSET_FILL
+ 0x809E: 1, // GL_SAMPLE_ALPHA_TO_COVERAGE
+ 0x80A0: 1 // GL_SAMPLE_COVERAGE
};
_glEnable = function(cap) {
// Clean up the renderer on any change to the rendering state. The optimization of
// skipping renderer setup is aimed at the case of multiple glDraw* right after each other
if (GL.immediate.lastRenderer) GL.immediate.lastRenderer.cleanup();
- if (cap in ignoredCapabilities) return;
+ if (!(cap in validCapabilities)) return;
Module.ctx.enable(cap);
};
_glDisable = function(cap) {
if (GL.immediate.lastRenderer) GL.immediate.lastRenderer.cleanup();
- if (cap in ignoredCapabilities) return;
+ if (!(cap in validCapabilities)) return;
Module.ctx.disable(cap);
};