Browse Source

WebGPUBackend: Clean up

sunag 1 year ago
parent
commit
7fa81b3655
1 changed files with 10 additions and 10 deletions
  1. 10 10
      examples/jsm/renderers/webgpu/WebGPUBackend.js

+ 10 - 10
examples/jsm/renderers/webgpu/WebGPUBackend.js

@@ -546,9 +546,9 @@ class WebGPUBackend extends Backend {
 			const buffer = currentOcclusionQueryBuffer.getMappedRange();
 			const buffer = currentOcclusionQueryBuffer.getMappedRange();
 			const results = new BigUint64Array( buffer );
 			const results = new BigUint64Array( buffer );
 
 
-			for ( let i = 0; i < currentOcclusionQueryObjects.length; i++ ) {
+			for ( let i = 0; i < currentOcclusionQueryObjects.length; i ++ ) {
 
 
-				if ( results[ i ] !== 0n ) {
+				if ( results[ i ] !== 0 ) {
 
 
 					occluded.add( currentOcclusionQueryObjects[ i ] );
 					occluded.add( currentOcclusionQueryObjects[ i ] );
 
 
@@ -567,7 +567,7 @@ class WebGPUBackend extends Backend {
 	updateViewport( renderContext ) {
 	updateViewport( renderContext ) {
 
 
 		const { currentPass } = this.get( renderContext );
 		const { currentPass } = this.get( renderContext );
-		let { x, y, width, height, minDepth, maxDepth } = renderContext.viewportValue;
+		const { x, y, width, height, minDepth, maxDepth } = renderContext.viewportValue;
 
 
 		currentPass.setViewport( x, renderContext.height - height - y, width, height, minDepth, maxDepth );
 		currentPass.setViewport( x, renderContext.height - height - y, width, height, minDepth, maxDepth );
 
 
@@ -612,11 +612,11 @@ class WebGPUBackend extends Backend {
 
 
 					colorAttachment.view = this.colorBuffer.createView();
 					colorAttachment.view = this.colorBuffer.createView();
 					colorAttachment.resolveTarget = this.context.getCurrentTexture().createView();
 					colorAttachment.resolveTarget = this.context.getCurrentTexture().createView();
-		
+
 				} else {
 				} else {
-		
+
 					colorAttachment.view = this.context.getCurrentTexture().createView();
 					colorAttachment.view = this.context.getCurrentTexture().createView();
-		
+
 				}
 				}
 
 
 				colorAttachment.clearValue = clearValue;
 				colorAttachment.clearValue = clearValue;
@@ -846,7 +846,7 @@ class WebGPUBackend extends Backend {
 
 
 		// occlusion queries - handle multiple consecutive draw calls for an object
 		// occlusion queries - handle multiple consecutive draw calls for an object
 
 
-		if ( contextData.occlusionQuerySet !== undefined  ) {
+		if ( contextData.occlusionQuerySet !== undefined ) {
 
 
 			const lastObject = contextData.lastOcclusionObject;
 			const lastObject = contextData.lastOcclusionObject;
 
 
@@ -930,7 +930,7 @@ class WebGPUBackend extends Backend {
 			data.side !== material.side || data.alphaToCoverage !== material.alphaToCoverage ||
 			data.side !== material.side || data.alphaToCoverage !== material.alphaToCoverage ||
 			data.sampleCount !== sampleCount || data.colorSpace !== colorSpace ||
 			data.sampleCount !== sampleCount || data.colorSpace !== colorSpace ||
 			data.colorFormat !== colorFormat || data.depthStencilFormat !== depthStencilFormat ||
 			data.colorFormat !== colorFormat || data.depthStencilFormat !== depthStencilFormat ||
-			data.primitiveTopology !== primitiveTopology 
+			data.primitiveTopology !== primitiveTopology
 		) {
 		) {
 
 
 			data.material = material; data.materialVersion = material.version;
 			data.material = material; data.materialVersion = material.version;
@@ -1140,7 +1140,7 @@ class WebGPUBackend extends Backend {
 		return 16;
 		return 16;
 
 
 	}
 	}
-		
+
 	async hasFeatureAsync( name ) {
 	async hasFeatureAsync( name ) {
 
 
 		const adapter = this.adapter || await WebGPU.getStaticAdapter();
 		const adapter = this.adapter || await WebGPU.getStaticAdapter();
@@ -1153,7 +1153,7 @@ class WebGPUBackend extends Backend {
 
 
 	hasFeature( name ) {
 	hasFeature( name ) {
 
 
-		if ( !this.adapter ) {
+		if ( ! this.adapter ) {
 
 
 			console.warn( 'WebGPUBackend: WebGPU adapter has not been initialized yet. Please use detectSupportAsync instead' );
 			console.warn( 'WebGPUBackend: WebGPU adapter has not been initialized yet. Please use detectSupportAsync instead' );