Skip to content

Commit fcc8bd6

Browse files
authored
GLSLNodeBuilder: Check texture type when declaring usampler3D/sampler3D uniforms (#30608)
* Check texture type when declaring usampler3D/sampler3D uniforms * Check texture3D before texture.compareFunction
1 parent 2676030 commit fcc8bd6

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -524,14 +524,13 @@ ${ flowData.code }
524524
let snippet = null;
525525
let group = false;
526526

527-
if ( uniform.type === 'texture' ) {
527+
if ( uniform.type === 'texture' || uniform.type === 'texture3D' ) {
528528

529529
const texture = uniform.node.value;
530530

531531
let typePrefix = '';
532532

533-
if ( texture.isDataTexture === true ) {
534-
533+
if ( texture.isDataTexture === true || texture.isData3DTexture === true ) {
535534

536535
if ( texture.type === UnsignedIntType ) {
537536

@@ -545,7 +544,11 @@ ${ flowData.code }
545544

546545
}
547546

548-
if ( texture.compareFunction ) {
547+
if ( uniform.type === 'texture3D' ) {
548+
549+
snippet = `${typePrefix}sampler3D ${ uniform.name };`;
550+
551+
} else if ( texture.compareFunction ) {
549552

550553
snippet = `sampler2DShadow ${ uniform.name };`;
551554

@@ -563,10 +566,6 @@ ${ flowData.code }
563566

564567
snippet = `samplerCube ${ uniform.name };`;
565568

566-
} else if ( uniform.type === 'texture3D' ) {
567-
568-
snippet = `sampler3D ${ uniform.name };`;
569-
570569
} else if ( uniform.type === 'buffer' ) {
571570

572571
const bufferNode = uniform.node;
@@ -1115,7 +1114,7 @@ ${vars}
11151114
11161115
${ this.getSignature() }
11171116
1118-
// extensions
1117+
// extensions
11191118
${shaderData.extensions}
11201119
11211120
// precision

0 commit comments

Comments
 (0)