Browse Source

WebGPURenderer: Fix and clean up (#26671)

* WebGLTextureUtils: Fix extension

* WebGPUBackend: Ignore draw() if instanceCount is 0

* close the box line
sunag 1 year ago
parent
commit
bf7996b9f1

+ 1 - 1
examples/jsm/renderers/webgl/utils/WebGLTextureUtils.js

@@ -177,7 +177,7 @@ class WebGLTextureUtils {
 
 
 		if ( extensions.has( 'EXT_texture_filter_anisotropic' ) === true ) {
 		if ( extensions.has( 'EXT_texture_filter_anisotropic' ) === true ) {
 
 
-			extension = extensions.get( 'EXT_texture_filter_anisotropic' );
+			//extension = extensions.get( 'EXT_texture_filter_anisotropic' );
 
 
 			if ( texture.magFilter === NearestFilter ) return;
 			if ( texture.magFilter === NearestFilter ) return;
 			if ( texture.minFilter !== NearestMipmapLinearFilter && texture.minFilter !== LinearMipmapLinearFilter ) return;
 			if ( texture.minFilter !== NearestMipmapLinearFilter && texture.minFilter !== LinearMipmapLinearFilter ) return;

+ 1 - 0
examples/jsm/renderers/webgpu/WebGPUBackend.js

@@ -643,6 +643,7 @@ class WebGPUBackend extends Backend {
 		const firstVertex = drawRange.start;
 		const firstVertex = drawRange.start;
 
 
 		const instanceCount = this.getInstanceCount( renderObject );
 		const instanceCount = this.getInstanceCount( renderObject );
+		if ( instanceCount === 0 ) return;
 
 
 		if ( hasIndex === true ) {
 		if ( hasIndex === true ) {
 
 

+ 2 - 1
examples/webgpu_sandbox.html

@@ -169,7 +169,8 @@
 					new THREE.Vector3( - 0.5, - 0.5, 0 ),
 					new THREE.Vector3( - 0.5, - 0.5, 0 ),
 					new THREE.Vector3( 0.5, - 0.5, 0 ),
 					new THREE.Vector3( 0.5, - 0.5, 0 ),
 					new THREE.Vector3( 0.5, 0.5, 0 ),
 					new THREE.Vector3( 0.5, 0.5, 0 ),
-					new THREE.Vector3( - 0.5, 0.5, 0 )
+					new THREE.Vector3( - 0.5, 0.5, 0 ),
+					new THREE.Vector3( - 0.5, - 0.5, 0 )
 				] );
 				] );
 
 
 				geometryLine.setAttribute( 'color', geometryLine.getAttribute( 'position' ) );
 				geometryLine.setAttribute( 'color', geometryLine.getAttribute( 'position' ) );