Fix some webgl bindings

This commit is contained in:
Alex Riedl
2025-08-09 10:47:07 -05:00
parent 786d454443
commit 277c6cac71
3 changed files with 96 additions and 9 deletions
+37
View File
@@ -392,6 +392,9 @@ class WebGLInterface {
BindTexture: (target, texture) => {
this.ctx.bindTexture(target, texture ? this.textures[texture] : null)
},
BindRenderbuffer: (target, renderbuffer) => {
this.ctx.bindRenderbuffer(target, renderbuffer ? this.renderbuffers[renderbuffer] : null)
},
BlendColor: (red, green, blue, alpha) => {
this.ctx.blendColor(red, green, blue, alpha);
},
@@ -809,6 +812,40 @@ class WebGLInterface {
Uniform3i: (location, v0, v1, v2) => { this.ctx.uniform3i(this.uniforms[location], v0, v1, v2); },
Uniform4i: (location, v0, v1, v2, v3) => { this.ctx.uniform4i(this.uniforms[location], v0, v1, v2, v3); },
Uniform1fv: (location, count, addr) => {
let array = this.mem.loadF32Array(addr, 1*count);
this.ctx.uniform1fv(this.uniforms[location], array);
},
Uniform2fv: (location, count, addr) => {
let array = this.mem.loadF32Array(addr, 2*count);
this.ctx.uniform2fv(this.uniforms[location], array);
},
Uniform3fv: (location, count, addr) => {
let array = this.mem.loadF32Array(addr, 3*count);
this.ctx.uniform3fv(this.uniforms[location], array);
},
Uniform4fv: (location, count, addr) => {
let array = this.mem.loadF32Array(addr, 4*count);
this.ctx.uniform4fv(this.uniforms[location], array);
},
Uniform1iv: (location, count, addr) => {
let array = this.mem.loadI32Array(addr, 1*count);
this.ctx.uniform1iv(this.uniforms[location], array);
},
Uniform2iv: (location, count, addr) => {
let array = this.mem.loadI32Array(addr, 2*count);
this.ctx.uniform2iv(this.uniforms[location], array);
},
Uniform3iv: (location, count, addr) => {
let array = this.mem.loadI32Array(addr, 3*count);
this.ctx.uniform3iv(this.uniforms[location], array);
},
Uniform4iv: (location, count, addr) => {
let array = this.mem.loadI32Array(addr, 4*count);
this.ctx.uniform4iv(this.uniforms[location], array);
},
UniformMatrix2fv: (location, addr) => {
let array = this.mem.loadF32Array(addr, 2*2);
this.ctx.uniformMatrix2fv(this.uniforms[location], false, array);