From d120e0a4b53cb87fd136af7fb021b3680d8745aa Mon Sep 17 00:00:00 2001 From: Ben Richards Date: Tue, 14 May 2024 16:14:56 +1200 Subject: [PATCH] Fix invalid create and destroy code in Program Wrapper. There is no `deleteUniformLocation` command. (Thanks, AI hallucinations!) --- src/renderer/webgl/wrappers/WebGLProgramWrapper.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/renderer/webgl/wrappers/WebGLProgramWrapper.js b/src/renderer/webgl/wrappers/WebGLProgramWrapper.js index e4a223c14..fee68691a 100644 --- a/src/renderer/webgl/wrappers/WebGLProgramWrapper.js +++ b/src/renderer/webgl/wrappers/WebGLProgramWrapper.js @@ -177,6 +177,16 @@ var WebGLProgramWrapper = new Class({ return; } + // Unbind current program before creating a new one. + // Otherwise, the old program will stay in use, + // and cause errors. + if (renderer.glWrapper.state.bindings.program === this) + { + renderer.glWrapper.updateBindingsProgram({ + bindings: { program: null } + }); + } + var program = gl.createProgram(); this.webGLProgram = program; @@ -466,10 +476,6 @@ var WebGLProgramWrapper = new Class({ } this.glAttributes.length = 0; - this.glUniforms.each(function (name, uniform) - { - gl.deleteUniformLocation(uniform.location); - }); this.glUniforms.clear(); }