Browse Source

Merge pull request #20272 from takahirox/FixBindGroupRefresh

WebGPURenderer: Detect needsBindGroupRefresh more properly
Michael Herzog 4 years ago
parent
commit
5c302a59fd
1 changed files with 10 additions and 6 deletions
  1. 10 6
      examples/jsm/renderers/webgpu/WebGPUBindings.js

+ 10 - 6
examples/jsm/renderers/webgpu/WebGPUBindings.js

@@ -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;
 
 				}
 
@@ -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;
 
 				}