Skip to content

Commit

Permalink
Merge pull request #20272 from takahirox/FixBindGroupRefresh
Browse files Browse the repository at this point in the history
WebGPURenderer: Detect needsBindGroupRefresh more properly
  • Loading branch information
Mugen87 authored Sep 6, 2020
2 parents 329cb62 + 9308105 commit 5c302a5
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions examples/jsm/renderers/webgpu/WebGPUBindings.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,13 @@ class WebGPUBindings {
const material = object.material;
const texture = material[ binding.name ];

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

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

binding.samplerGPU = this.textures.getSampler( texture );
binding.samplerGPU = samplerGPU;
needsBindGroupRefresh = true;

}

Expand All @@ -128,11 +130,13 @@ class WebGPUBindings {
const material = object.material;
const texture = material[ binding.name ];

needsBindGroupRefresh = this.textures.updateTexture( texture );
this.textures.updateTexture( texture );
const textureGPU = this.textures.getTextureGPU( texture );

if ( needsBindGroupRefresh === true ) {
if ( binding.textureGPU !== textureGPU ) {

binding.textureGPU = this.textures.getTextureGPU( texture );
binding.textureGPU = textureGPU;
needsBindGroupRefresh = true;

}

Expand Down

0 comments on commit 5c302a5

Please sign in to comment.