diff options
author | Jukka Jylänki <jujjyl@gmail.com> | 2014-01-02 19:36:04 +0200 |
---|---|---|
committer | Jukka Jylänki <jujjyl@gmail.com> | 2014-01-09 20:05:28 +0200 |
commit | d302f6121076f6a7c1191d4e5a27e35d3dd149b2 (patch) | |
tree | d04ddc1a5c9b6154cd8da3348f4f3a800b84ff33 /src/library_gl.js | |
parent | 8e69ae1e19523a15c1f9328f3c0e757c0661dc4b (diff) |
Optimize glBindBuffer when GL emulation modes are not used. In that case, currently bound buffers do not need to be tracked.
Diffstat (limited to 'src/library_gl.js')
-rw-r--r-- | src/library_gl.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/library_gl.js b/src/library_gl.js index 203721f8..70ba105e 100644 --- a/src/library_gl.js +++ b/src/library_gl.js @@ -22,9 +22,13 @@ var LibraryGL = { #if FULL_ES2 clientBuffers: [], + currArrayBuffer: 0, + currElementArrayBuffer: 0, #endif +#if LEGACY_GL_EMULATION currArrayBuffer: 0, currElementArrayBuffer: 0, +#endif byteSizeByTypeRoot: 0x1400, // GL_BYTE byteSizeByType: [ @@ -1335,11 +1339,20 @@ var LibraryGL = { #endif var bufferObj = buffer ? GL.buffers[buffer] : null; +#if FULL_ES2 if (target == Module.ctx.ARRAY_BUFFER) { GL.currArrayBuffer = buffer; } else if (target == Module.ctx.ELEMENT_ARRAY_BUFFER) { GL.currElementArrayBuffer = buffer; } +#endif +#if LEGACY_GL_EMULATION + if (target == Module.ctx.ARRAY_BUFFER) { + GL.currArrayBuffer = buffer; + } else if (target == Module.ctx.ELEMENT_ARRAY_BUFFER) { + GL.currElementArrayBuffer = buffer; + } +#endif Module.ctx.bindBuffer(target, bufferObj); }, |