Răsfoiți Sursa

Revert "WebGPUBackend: Align frontFace and cullMode values to WebGL backend. (#31769)" (#31778)

This reverts commit fd74f49b18b8e028eef2fad214d90ec47cf54e25.
sunag 4 luni în urmă
părinte
comite
b59b2d6d0a

+ 0 - 6
src/renderers/webgpu/WebGPUBackend.js

@@ -1806,11 +1806,6 @@ class WebGPUBackend extends Backend {
 		const utils = this.utils;
 		const utils = this.utils;
 		const renderContext = renderObject.context;
 		const renderContext = renderObject.context;
 
 
-		// meshes with negative scale have a different frontFace render pipeline
-		// descriptor value so the following must be honored in the cache key
-
-		const frontFaceCW = ( object.isMesh && object.matrixWorld.determinant() < 0 );
-
 		return [
 		return [
 			material.transparent, material.blending, material.premultipliedAlpha,
 			material.transparent, material.blending, material.premultipliedAlpha,
 			material.blendSrc, material.blendDst, material.blendEquation,
 			material.blendSrc, material.blendDst, material.blendEquation,
@@ -1821,7 +1816,6 @@ class WebGPUBackend extends Backend {
 			material.stencilFail, material.stencilZFail, material.stencilZPass,
 			material.stencilFail, material.stencilZFail, material.stencilZPass,
 			material.stencilFuncMask, material.stencilWriteMask,
 			material.stencilFuncMask, material.stencilWriteMask,
 			material.side,
 			material.side,
-			frontFaceCW,
 			utils.getSampleCountRenderContext( renderContext ),
 			utils.getSampleCountRenderContext( renderContext ),
 			utils.getCurrentColorSpace( renderContext ), utils.getCurrentColorFormat( renderContext ), utils.getCurrentDepthStencilFormat( renderContext ),
 			utils.getCurrentColorSpace( renderContext ), utils.getCurrentColorFormat( renderContext ), utils.getCurrentDepthStencilFormat( renderContext ),
 			utils.getPrimitiveTopology( object, material ),
 			utils.getPrimitiveTopology( object, material ),

+ 18 - 9
src/renderers/webgpu/utils/WebGPUPipelineUtils.js

@@ -5,7 +5,7 @@ import {
 } from './WebGPUConstants.js';
 } from './WebGPUConstants.js';
 
 
 import {
 import {
-	BackSide, DoubleSide,
+	FrontSide, BackSide, DoubleSide,
 	NeverDepth, AlwaysDepth, LessDepth, LessEqualDepth, EqualDepth, GreaterEqualDepth, GreaterDepth, NotEqualDepth,
 	NeverDepth, AlwaysDepth, LessDepth, LessEqualDepth, EqualDepth, GreaterEqualDepth, GreaterDepth, NotEqualDepth,
 	NoBlending, NormalBlending, AdditiveBlending, SubtractiveBlending, MultiplyBlending, CustomBlending,
 	NoBlending, NormalBlending, AdditiveBlending, SubtractiveBlending, MultiplyBlending, CustomBlending,
 	ZeroFactor, OneFactor, SrcColorFactor, OneMinusSrcColorFactor, SrcAlphaFactor, OneMinusSrcAlphaFactor, DstColorFactor,
 	ZeroFactor, OneFactor, SrcColorFactor, OneMinusSrcColorFactor, SrcAlphaFactor, OneMinusSrcAlphaFactor, DstColorFactor,
@@ -672,8 +672,6 @@ class WebGPUPipelineUtils {
 		const descriptor = {};
 		const descriptor = {};
 		const utils = this.backend.utils;
 		const utils = this.backend.utils;
 
 
-		//
-
 		descriptor.topology = utils.getPrimitiveTopology( object, material );
 		descriptor.topology = utils.getPrimitiveTopology( object, material );
 
 
 		if ( geometry.index !== null && object.isLine === true && object.isLineSegments !== true ) {
 		if ( geometry.index !== null && object.isLine === true && object.isLineSegments !== true ) {
@@ -682,17 +680,28 @@ class WebGPUPipelineUtils {
 
 
 		}
 		}
 
 
-		//
+		switch ( material.side ) {
 
 
-		let flipSided = ( material.side === BackSide );
+			case FrontSide:
+				descriptor.frontFace = GPUFrontFace.CCW;
+				descriptor.cullMode = GPUCullMode.Back;
+				break;
 
 
-		if ( object.isMesh && object.matrixWorld.determinant() < 0 ) flipSided = ! flipSided;
+			case BackSide:
+				descriptor.frontFace = GPUFrontFace.CCW;
+				descriptor.cullMode = GPUCullMode.Front;
+				break;
 
 
-		descriptor.frontFace = ( flipSided === true ) ? GPUFrontFace.CW : GPUFrontFace.CCW;
+			case DoubleSide:
+				descriptor.frontFace = GPUFrontFace.CCW;
+				descriptor.cullMode = GPUCullMode.None;
+				break;
 
 
-		//
+			default:
+				console.error( 'THREE.WebGPUPipelineUtils: Unknown material.side value.', material.side );
+				break;
 
 
-		descriptor.cullMode = ( material.side === DoubleSide ) ? GPUCullMode.None : GPUCullMode.Back;
+		}
 
 
 		return descriptor;
 		return descriptor;
 
 

粤ICP备19079148号