diff options
author | Alon Zakai <alonzakai@gmail.com> | 2014-02-09 16:36:28 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2014-02-09 16:36:28 -0800 |
commit | b5f3e7a6700eef8c5bfb90e957257cf94b23f21b (patch) | |
tree | 46d3d68ffa9a3777aaf95bf3bbc923ffa1a3d3ff | |
parent | 97a464a654fdadf5dfb8aa082b48516e6bf8d402 (diff) |
improve gl function copying code
-rw-r--r-- | src/library_gl.js | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/library_gl.js b/src/library_gl.js index 7a272dd9..978fb87e 100644 --- a/src/library_gl.js +++ b/src/library_gl.js @@ -5356,10 +5356,21 @@ if (LEGACY_GL_EMULATION) { DEFAULT_LIBRARY_FUNCS_TO_INCLUDE.push('$GLEmulation'); } +function copyLibEntry(a, b) { + LibraryGL[a] = LibraryGL[b]; + LibraryGL[a + '__postset'] = LibraryGL[b + '__postset']; + LibraryGL[a + '__sig'] = LibraryGL[b + '__sig']; + LibraryGL[a + '__asm'] = LibraryGL[b + '__asm']; + LibraryGL[a + '__deps'] = LibraryGL[b + '__deps'].slice(0); +} + // GL proc address retrieval - allow access through glX and emscripten_glX, to allow name collisions with user-implemented things having the same name (see gl.c) keys(LibraryGL).forEach(function(x) { if (x.substr(-6) == '__deps' || x.substr(-9) == '__postset' || x.substr(-5) == '__sig' || x.substr(-5) == '__asm' || x.substr(0, 2) != 'gl') return; - while (typeof LibraryGL[x] === 'string') LibraryGL[x] = LibraryGL[LibraryGL[x]]; // resolve aliases right here, simpler for fastcomp + while (typeof LibraryGL[x] === 'string') { + // resolve aliases right here, simpler for fastcomp + copyLibEntry(x, LibraryGL[x]); + } var y = 'emscripten_' + x; LibraryGL[x + '__deps'] = LibraryGL[x + '__deps'].map(function(dep) { // prefix dependencies as well @@ -5373,11 +5384,7 @@ keys(LibraryGL).forEach(function(x) { return dep; }); // copy it - LibraryGL[y] = LibraryGL[x]; - LibraryGL[y + '__postset'] = LibraryGL[x + '__postset']; - LibraryGL[y + '__sig'] = LibraryGL[x + '__sig']; - LibraryGL[y + '__asm'] = LibraryGL[x + '__asm']; - LibraryGL[y + '__deps'] = LibraryGL[x + '__deps'].slice(0); + copyLibEntry(y, x); }); // Final merge |