diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/jsifier.js | 2 | ||||
-rw-r--r-- | src/library.js | 7 | ||||
-rw-r--r-- | src/library_browser.js | 12 | ||||
-rw-r--r-- | src/library_gl.js | 4 |
4 files changed, 22 insertions, 3 deletions
diff --git a/src/jsifier.js b/src/jsifier.js index ab10f455..ef15088e 100644 --- a/src/jsifier.js +++ b/src/jsifier.js @@ -325,7 +325,7 @@ function JSify(data, functionsOnly) { // NOTE: This is the only place that could potentially create static // allocations in a shared library. - if (typeof constant === 'object') { + if (typeof constant !== 'string') { constant = makePointer(constant, null, allocator, item.type, index); } diff --git a/src/library.js b/src/library.js index 26ce8457..3a5f6480 100644 --- a/src/library.js +++ b/src/library.js @@ -3510,11 +3510,18 @@ LibraryManager.library = { return ret; }, + emscripten_memcpy_big: function(dest, src, num) { + HEAPU8.set(HEAPU8.subarray(src, src+num), dest); + return dest; + }, + memcpy__asm: true, memcpy__sig: 'iiii', + memcpy__deps: ['emscripten_memcpy_big'], memcpy: function(dest, src, num) { dest = dest|0; src = src|0; num = num|0; var ret = 0; + if ((num|0) >= 4096) return _emscripten_memcpy_big(dest|0, src|0, num|0)|0; ret = dest|0; if ((dest&3) == (src&3)) { while (dest & 3) { diff --git a/src/library_browser.js b/src/library_browser.js index 458a8dd2..5d53b867 100644 --- a/src/library_browser.js +++ b/src/library_browser.js @@ -13,6 +13,7 @@ mergeInto(LibraryManager.library, { $Browser: { mainLoop: { scheduler: null, + method: '', shouldPause: false, paused: false, queue: [], @@ -784,6 +785,11 @@ mergeInto(LibraryManager.library, { GL.newRenderingFrameStarted(); #endif + if (Browser.mainLoop.method === 'timeout' && Module.ctx) { + Module.printErr('Looks like you are rendering without using requestAnimationFrame for the main loop. You should use 0 for the frame rate in emscripten_set_main_loop in order to use requestAnimationFrame, as that can greatly improve your frame rates!'); + Browser.mainLoop.method = ''; // just warn once per call to set main loop + } + if (Module['preMainLoop']) { Module['preMainLoop'](); } @@ -814,11 +820,13 @@ mergeInto(LibraryManager.library, { if (fps && fps > 0) { Browser.mainLoop.scheduler = function Browser_mainLoop_scheduler() { setTimeout(Browser.mainLoop.runner, 1000/fps); // doing this each time means that on exception, we stop - } + }; + Browser.mainLoop.method = 'timeout'; } else { Browser.mainLoop.scheduler = function Browser_mainLoop_scheduler() { Browser.requestAnimationFrame(Browser.mainLoop.runner); - } + }; + Browser.mainLoop.method = 'rAF'; } Browser.mainLoop.scheduler(); diff --git a/src/library_gl.js b/src/library_gl.js index 0a30292a..baa0597d 100644 --- a/src/library_gl.js +++ b/src/library_gl.js @@ -210,6 +210,7 @@ var LibraryGL = { } }, +#if LEGACY_GL_EMULATION // Find a token in a shader source string findToken: function(source, token) { function isIdentChar(ch) { @@ -238,6 +239,7 @@ var LibraryGL = { } while (true); return false; }, +#endif getSource: function(shader, count, string, length) { var source = ''; @@ -255,6 +257,7 @@ var LibraryGL = { } source += frag; } +#if LEGACY_GL_EMULATION // Let's see if we need to enable the standard derivatives extension type = GLctx.getShaderParameter(GL.shaders[shader], 0x8B4F /* GL_SHADER_TYPE */); if (type == 0x8B30 /* GL_FRAGMENT_SHADER */) { @@ -270,6 +273,7 @@ var LibraryGL = { #endif } } +#endif return source; }, |