Bläddra i källkod

WebGPURenderer: Add flat qualifiers for integer attributes in GLSLNodeBuilder (#26987)

Co-authored-by: aardgoose <[email protected]>
aardgoose 1 år sedan
förälder
incheckning
55a4fc1743
1 ändrade filer med 8 tillägg och 2 borttagningar
  1. 8 2
      examples/jsm/renderers/webgl/nodes/GLSLNodeBuilder.js

+ 8 - 2
examples/jsm/renderers/webgl/nodes/GLSLNodeBuilder.js

@@ -279,7 +279,10 @@ ${ flowData.code }
 
 			for ( const varying of varyings ) {
 
-				snippet += `${varying.needsInterpolation ? 'out' : '/*out*/'} ${varying.type} ${varying.name};\n`;
+				const type = varying.type;
+				const flat = type === 'int' || type === 'uint' ? 'flat ' : '';
+
+				snippet += `${flat}${varying.needsInterpolation ? 'out' : '/*out*/'} ${type} ${varying.name};\n`;
 
 			}
 
@@ -289,7 +292,10 @@ ${ flowData.code }
 
 				if ( varying.needsInterpolation ) {
 
-					snippet += `in ${varying.type} ${varying.name};\n`;
+					const type = varying.type;
+					const flat = type === 'int' || type === 'uint' ? 'flat ' : '';
+
+					snippet += `${flat}in ${type} ${varying.name};\n`;
 
 				}