Explorar el Código

WebGPURenderer: Fix unsupported texture sample counts (#33722)

sunag hace 1 semana
padre
commit
b174d0ef38

+ 4 - 4
examples/webgpu_multisampled_renderbuffers.html

@@ -52,7 +52,7 @@
 
 			const params = {
 				animated: true,
-				samples: 4
+				multisampling: true
 			};
 
 			const mat4 = new THREE.Matrix4();
@@ -81,7 +81,7 @@
 			function initGUI() {
 
 				const gui = renderer.inspector.createParameters( 'Settings' );
-				gui.add( params, 'samples', 0, 4, 1 );
+				gui.add( params, 'multisampling' );
 				gui.add( params, 'animated' );
 
 			}
@@ -126,7 +126,7 @@
 				document.body.appendChild( renderer.domElement );
 
 				renderTarget = new THREE.RenderTarget( window.innerWidth * dpr, window.innerHeight * dpr, {
-					samples: params.samples,
+					samples: params.multisampling ? 4 : 1,
 					depthBuffer: true,
 				} );
 
@@ -172,7 +172,7 @@
 
 				}
 
-				renderTarget.samples = params.samples;
+				renderTarget.samples = params.multisampling ? 4 : 1;
 
 				renderer.setRenderTarget( renderTarget );
 				renderer.render( scene, camera );

+ 1 - 1
src/renderers/webgpu/utils/WebGPUUtils.js

@@ -113,7 +113,7 @@ class WebGPUUtils {
 
 		}
 
-		samples = samples || 1;
+		samples = this.getSampleCount( samples || 1 );
 
 		const isMSAA = samples > 1 && texture.renderTarget !== null && ( texture.isDepthTexture !== true && texture.isFramebufferTexture !== true );
 		const primarySamples = isMSAA ? 1 : samples;

粤ICP备19079148号