Explorar el Código

WebGPURenderer: Improve `compatibilityMode` support for MRT (#32973)

sunag hace 2 semanas
padre
commit
b5d54cfb30

+ 8 - 2
src/renderers/webgl-fallback/utils/WebGLState.js

@@ -8,7 +8,7 @@ import {
 	MaterialBlending
 	MaterialBlending
 } from '../../../constants.js';
 } from '../../../constants.js';
 import { Vector4 } from '../../../math/Vector4.js';
 import { Vector4 } from '../../../math/Vector4.js';
-import { error } from '../../../utils.js';
+import { error, warnOnce } from '../../../utils.js';
 
 
 let equationToGL, factorToGL;
 let equationToGL, factorToGL;
 
 
@@ -276,7 +276,13 @@ class WebGLState {
 		const gl = this.gl;
 		const gl = this.gl;
 		const drawBuffersIndexedExt = this.backend.drawBuffersIndexedExt;
 		const drawBuffersIndexedExt = this.backend.drawBuffersIndexedExt;
 
 
-		if ( ! drawBuffersIndexedExt ) return;
+		if ( ! drawBuffersIndexedExt ) {
+
+			warnOnce( 'WebGPURenderer: Multiple Render Targets (MRT) blending configuration is not fully supported in compatibility mode. The material blending will be used for all render targets.' );
+
+			return;
+
+		}
 
 
 		for ( let i = 0; i < textures.length; i ++ ) {
 		for ( let i = 0; i < textures.length; i ++ ) {
 
 

+ 16 - 6
src/renderers/webgpu/utils/WebGPUPipelineUtils.js

@@ -15,7 +15,7 @@ import {
 	NeverStencilFunc, AlwaysStencilFunc, LessStencilFunc, LessEqualStencilFunc, EqualStencilFunc, GreaterEqualStencilFunc, GreaterStencilFunc, NotEqualStencilFunc
 	NeverStencilFunc, AlwaysStencilFunc, LessStencilFunc, LessEqualStencilFunc, EqualStencilFunc, GreaterEqualStencilFunc, GreaterStencilFunc, NotEqualStencilFunc
 } from '../../../constants.js';
 } from '../../../constants.js';
 
 
-import { error } from '../../../utils.js';
+import { error, warnOnce } from '../../../utils.js';
 
 
 /**
 /**
  * A WebGPU backend utility module for managing pipelines.
  * A WebGPU backend utility module for managing pipelines.
@@ -161,15 +161,25 @@ class WebGPUPipelineUtils {
 
 
 				if ( mrt !== null ) {
 				if ( mrt !== null ) {
 
 
-					const blendMode = mrt.getBlendMode( texture.name );
+					if ( this.backend.compatibilityMode !== true ) {
 
 
-					if ( blendMode.blending === MaterialBlending ) {
+						const blendMode = mrt.getBlendMode( texture.name );
 
 
-						blending = materialBlending;
+						if ( blendMode.blending === MaterialBlending ) {
+
+							blending = materialBlending;
+
+						} else if ( blendMode.blending !== NoBlending ) {
+
+							blending = this._getBlending( blendMode );
 
 
-					} else if ( blendMode.blending !== NoBlending ) {
+						}
 
 
-						blending = this._getBlending( blendMode );
+					} else {
+
+						warnOnce( 'WebGPURenderer: Multiple Render Targets (MRT) blending configuration is not fully supported in compatibility mode. The material blending will be used for all render targets.' );
+
+						blending = materialBlending;
 
 
 					}
 					}
 
 

粤ICP备19079148号