aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/library_gl.js5
-rw-r--r--src/settings.js4
-rwxr-xr-xtests/runner.py12
3 files changed, 17 insertions, 4 deletions
diff --git a/src/library_gl.js b/src/library_gl.js
index 38b330f7..537dce53 100644
--- a/src/library_gl.js
+++ b/src/library_gl.js
@@ -2867,5 +2867,10 @@ LibraryGL.$GLEmulation__deps.push(function() {
for (var func in Functions.getIndex.tentative) Functions.getIndex(func);
});
+if (FORCE_GL_EMULATION) {
+ LibraryGL.glDrawElements__deps = LibraryGL.glDrawElements__deps.concat('$GLEmulation');
+ LibraryGL.glDrawArrays__deps = LibraryGL.glDrawArrays__deps.concat('$GLEmulation');
+}
+
mergeInto(LibraryManager.library, LibraryGL);
diff --git a/src/settings.js b/src/settings.js
index 4d742060..dbce836d 100644
--- a/src/settings.js
+++ b/src/settings.js
@@ -166,6 +166,10 @@ var GL_DEBUG = 0; // Print out all calls into WebGL. As with LIBRARY_DEBUG, you
var GL_TESTING = 0; // When enabled, sets preserveDrawingBuffer in the context, to allow tests to work (but adds overhead)
var GL_MAX_TEMP_BUFFER_SIZE = 2097152; // How large GL emulation temp buffers are
var GL_UNSAFE_OPTS = 1; // Enables some potentially-unsafe optimizations in GL emulation code
+var FORCE_GL_EMULATION = 0; // Forces inclusion of GL emulation code. This lets you use non-WebGL features
+ // like clientside data. GL commands that are not in WebGL will automatically
+ // include this feature, but if you just use pure GLES commands *and* need
+ // emualation, you will need to enable it manually with this flag.
var DISABLE_EXCEPTION_CATCHING = 0; // Disables generating code to actually catch exceptions. If the code you
// are compiling does not actually rely on catching exceptions (but the
diff --git a/tests/runner.py b/tests/runner.py
index d3bdaaac..50568762 100755
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -10625,10 +10625,14 @@ elif 'browser' in str(sys.argv):
self.run_browser('something.html', 'You should see animating gears.', '/report_result?0')
def test_glgears_animation(self):
- Popen([PYTHON, EMCC, path_from_root('tests', 'hello_world_gles.c'), '-o', 'something.html',
- '-DHAVE_BUILTIN_SINCOS', '-s', 'GL_TESTING=1',
- '--shell-file', path_from_root('tests', 'hello_world_gles_shell.html')]).communicate()
- self.run_browser('something.html', 'You should see animating gears.', '/report_gl_result?true')
+ for emulation in [0, 1]:
+ print emulation
+ Popen([PYTHON, EMCC, path_from_root('tests', 'hello_world_gles.c'), '-o', 'something.html',
+ '-DHAVE_BUILTIN_SINCOS', '-s', 'GL_TESTING=1',
+ '--shell-file', path_from_root('tests', 'hello_world_gles_shell.html')] +
+ (['-s', 'FORCE_GL_EMULATION=1'] if emulation else [])).communicate()
+ self.run_browser('something.html', 'You should see animating gears.', '/report_gl_result?true')
+ assert ('var GLEmulation' in open(self.in_dir('something.html')).read()) == emulation, "emulation code should be added when asked for"
def test_glgears_bad(self):
# Make sure that OpenGL ES is not available if typed arrays are not used