Преглед изворни кода

GLSLNodeBuilder: Fix usage of `flat` qualifier. (#30428)

Michael Herzog пре 11 месеци
родитељ
комит
8137a7ed7a
1 измењених фајлова са 12 додато и 2 уклоњено
  1. 12 2
      src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js

+ 12 - 2
src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js

@@ -769,10 +769,20 @@ ${ flowData.code }
 			for ( const varying of varyings ) {
 
 				if ( shaderStage === 'compute' ) varying.needsInterpolation = true;
+
 				const type = this.getType( varying.type );
-				const flat = type.includes( 'int' ) || type.includes( 'uv' ) || type.includes( 'iv' ) ? 'flat ' : '';
 
-				snippet += `${flat}${varying.needsInterpolation ? 'out' : '/*out*/'} ${type} ${varying.name};\n`;
+				if ( varying.needsInterpolation ) {
+
+					const flat = type.includes( 'int' ) || type.includes( 'uv' ) || type.includes( 'iv' ) ? 'flat ' : '';
+
+					snippet += `${flat} out ${type} ${varying.name};\n`;
+
+				} else {
+
+					snippet += `${type} ${varying.name};\n`; // generate variable (no varying required)
+
+				}
 
 			}
 

粤ICP备19079148号