2
0
Эх сурвалжийг харах

WebGPURenderer: Detect needsBindGroupRefresh more properly

Takahiro 4 жил өмнө
parent
commit
9308105fe8

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