Sfoglia il codice sorgente

GLSLNodeBuilder: Check texture type when declaring usampler3D/sampler3D uniforms (#30608)

* Check texture type when declaring usampler3D/sampler3D uniforms

* Check texture3D before texture.compareFunction
ZonkyPop 10 mesi fa
parent
commit
fcc8bd6555
1 ha cambiato i file con 8 aggiunte e 9 eliminazioni
  1. 8 9
      src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js

+ 8 - 9
src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js

@@ -524,14 +524,13 @@ ${ flowData.code }
 			let snippet = null;
 			let group = false;
 
-			if ( uniform.type === 'texture' ) {
+			if ( uniform.type === 'texture' || uniform.type === 'texture3D' ) {
 
 				const texture = uniform.node.value;
 
 				let typePrefix = '';
 
-				if ( texture.isDataTexture === true ) {
-
+				if ( texture.isDataTexture === true || texture.isData3DTexture === true ) {
 
 					if ( texture.type === UnsignedIntType ) {
 
@@ -545,7 +544,11 @@ ${ flowData.code }
 
 				}
 
-				if ( texture.compareFunction ) {
+				if ( uniform.type === 'texture3D' ) {
+
+					snippet = `${typePrefix}sampler3D ${ uniform.name };`;
+
+				} else if ( texture.compareFunction ) {
 
 					snippet = `sampler2DShadow ${ uniform.name };`;
 
@@ -563,10 +566,6 @@ ${ flowData.code }
 
 				snippet = `samplerCube ${ uniform.name };`;
 
-			} else if ( uniform.type === 'texture3D' ) {
-
-				snippet = `sampler3D ${ uniform.name };`;
-
 			} else if ( uniform.type === 'buffer' ) {
 
 				const bufferNode = uniform.node;
@@ -1115,7 +1114,7 @@ ${vars}
 
 ${ this.getSignature() }
 
-// extensions 
+// extensions
 ${shaderData.extensions}
 
 // precision

粤ICP备19079148号