Skip to content

Commit

Permalink
WebGPUBindings: Make texture update more robust.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mugen87 committed Sep 16, 2020
1 parent 6956e6c commit 16353c9
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions examples/jsm/renderers/webgpu/WebGPUBindings.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,18 @@ class WebGPUBindings {
const material = object.material;
const texture = material[ binding.name ];

textures.updateSampler( texture );
if ( texture !== null ) {

const samplerGPU = textures.getSampler( texture );
textures.updateSampler( texture );

if ( binding.samplerGPU !== samplerGPU ) {
const samplerGPU = textures.getSampler( texture );

binding.samplerGPU = samplerGPU;
needsBindGroupRefresh = true;
if ( binding.samplerGPU !== samplerGPU ) {

binding.samplerGPU = samplerGPU;
needsBindGroupRefresh = true;

}

}

Expand All @@ -137,13 +141,17 @@ class WebGPUBindings {
const material = object.material;
const texture = material[ binding.name ];

const forceUpdate = textures.updateTexture( texture );
const textureGPU = textures.getTextureGPU( texture );
if ( texture !== null ) {

const forceUpdate = textures.updateTexture( texture );
const textureGPU = textures.getTextureGPU( texture );

if ( binding.textureGPU !== textureGPU || forceUpdate === true ) {

if ( binding.textureGPU !== textureGPU || forceUpdate === true ) {
binding.textureGPU = textureGPU;
needsBindGroupRefresh = true;

binding.textureGPU = textureGPU;
needsBindGroupRefresh = true;
}

}

Expand Down

0 comments on commit 16353c9

Please sign in to comment.