diff options
-rw-r--r-- | src/webGLWorker.js | 19 | ||||
-rw-r--r-- | tests/test_browser.py | 2 |
2 files changed, 13 insertions, 8 deletions
diff --git a/src/webGLWorker.js b/src/webGLWorker.js index 4911c098..38aafc11 100644 --- a/src/webGLWorker.js +++ b/src/webGLWorker.js @@ -557,16 +557,11 @@ function WebGLWorker() { commandBuffer.push('bindAttribLocation', 3, program.id, index, name); }; this.getAttribLocation = function(program, name) { - // manually bound attribs are cached locally + // all existing attribs are cached locally if (name in program.attributes) return program.attributes[name]; - if (!(name in program.existingAttributes)) return -1; - // if not manually bound, bind it to the next index so we update the client - var index = program.attributeVec.length; - this.bindAttribLocation(program, index, name); - return index; + return -1; }; this.linkProgram = function(program) { - commandBuffer.push('linkProgram', 1, program.id); // parse shader sources function parseElementType(shader, type, obj, vec) { var newItems = shader.source.match(new RegExp(type + '\\s+\\w+\\s+[\\w,\\s\[\\]]+;', 'g')); @@ -599,6 +594,16 @@ function WebGLWorker() { parseElementType(shader, 'uniform', program.uniforms, program.uniformVec); parseElementType(shader, 'attribute', program.existingAttributes, null); }); + + // bind not-yet bound attributes + for (var attr in program.existingAttributes) { + if (!(attr in program.attributes)) { + var index = program.attributeVec.length; + this.bindAttribLocation(program, index, attr); + } + } + + commandBuffer.push('linkProgram', 1, program.id); }; this.getProgramParameter = function(program, name) { switch (name) { diff --git a/tests/test_browser.py b/tests/test_browser.py index 839d55e3..fbb8f3fe 100644 --- a/tests/test_browser.py +++ b/tests/test_browser.py @@ -1511,7 +1511,7 @@ void *getBindBuffer() { self.btest('cubegeom_color.c', reference='cubegeom_color.png', args=['-s', 'LEGACY_GL_EMULATION=1']) def test_cubegeom_normal(self): - self.btest('cubegeom_normal.c', reference='cubegeom_normal.png', args=['-s', 'LEGACY_GL_EMULATION=1']) + self.btest('cubegeom_normal.c', reference='cubegeom_normal.png', args=['-s', 'LEGACY_GL_EMULATION=1'], also_proxied=True) def test_cubegeom_normal_dap(self): # draw is given a direct pointer to clientside memory, no element array buffer self.btest('cubegeom_normal_dap.c', reference='cubegeom_normal.png', args=['-s', 'LEGACY_GL_EMULATION=1']) |