Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 30 additions & 12 deletions src/renderers/webgl-fallback/WebGLBackend.js
Original file line number Diff line number Diff line change
Expand Up @@ -1845,28 +1845,46 @@ class WebGLBackend extends Backend {

for ( const binding of bindGroup.bindings ) {

const map = this.get( binding );

if ( binding.isUniformsGroup || binding.isUniformBuffer ) {

const data = binding.buffer;
const bufferGPU = gl.createBuffer();
let { bufferGPU } = this.get( data );

gl.bindBuffer( gl.UNIFORM_BUFFER, bufferGPU );
gl.bufferData( gl.UNIFORM_BUFFER, data, gl.DYNAMIC_DRAW );
if ( bufferGPU === undefined ) {

this.set( binding, {
index: i ++,
bufferGPU
} );
// create

bufferGPU = gl.createBuffer();
gl.bindBuffer( gl.UNIFORM_BUFFER, bufferGPU );
gl.bufferData( gl.UNIFORM_BUFFER, data, gl.DYNAMIC_DRAW );

this.set( data, { bufferGPU } );

} else {

// update

gl.bindBuffer( gl.UNIFORM_BUFFER, bufferGPU );
gl.bufferSubData( gl.UNIFORM_BUFFER, 0, data );

}

map.index = i ++;
map.bufferGPU = bufferGPU;

this.set( binding, map );

} else if ( binding.isSampledTexture ) {

const { textureGPU, glTextureType } = this.get( binding.texture );

this.set( binding, {
Copy link
Collaborator Author

@Mugen87 Mugen87 Aug 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The set() calls are changed to avoid inline object creation via {}.

index: t ++,
textureGPU,
glTextureType
} );
map.index = t ++;
map.textureGPU = textureGPU;
map.glTextureType = glTextureType;

this.set( binding, map );

}

Expand Down
Loading