From d302f6121076f6a7c1191d4e5a27e35d3dd149b2 Mon Sep 17 00:00:00 2001 From: Jukka Jylänki Date: Thu, 2 Jan 2014 19:36:04 +0200 Subject: Optimize glBindBuffer when GL emulation modes are not used. In that case, currently bound buffers do not need to be tracked. --- src/library_gl.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/library_gl.js') 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); }, -- cgit v1.2.3-18-g5258