瀏覽代碼

WebGPURenderer: Fix SampledTexture not correctly bound (#28289)

* Update texture when binding is updated

* better fix

* fix

* needsBinding cleanup
Renaud Rohlinger 1 年之前
父節點
當前提交
2ab4c88758

+ 4 - 4
examples/jsm/renderers/common/Bindings.js

@@ -128,18 +128,18 @@ class Bindings extends DataMap {
 
 			} else if ( binding.isSampledTexture ) {
 
-				const texture = binding.texture;
-
-				if ( binding.needsBindingsUpdate ) needsBindingsUpdate = true;
-
 				const updated = binding.update();
 
 				if ( updated ) {
 
 					this.textures.updateTexture( binding.texture );
 
+					needsBindingsUpdate = true;
+
 				}
 
+				const texture = binding.texture;
+
 				if ( texture.isStorageTexture === true ) {
 
 					const textureData = this.get( texture );

+ 0 - 8
examples/jsm/renderers/common/SampledTexture.js

@@ -18,14 +18,6 @@ class SampledTexture extends Binding {
 
 	}
 
-	get needsBindingsUpdate() {
-
-		const { texture, version } = this;
-
-		return texture.isVideoTexture ? true : version !== texture.version; // @TODO: version === 0 && texture.version > 0 ( add it just to External Textures like PNG,JPG )
-
-	}
-
 	update() {
 
 		const { texture, version } = this;

+ 0 - 6
examples/jsm/renderers/common/nodes/NodeSampledTexture.js

@@ -10,12 +10,6 @@ class NodeSampledTexture extends SampledTexture {
 
 	}
 
-	get needsBindingsUpdate() {
-
-		return this.textureNode.value !== this.texture || super.needsBindingsUpdate;
-
-	}
-
 	update() {
 
 		const { textureNode } = this;