Skip to content

Commit ac6cc54

Browse files
authored
TSL: Fixing invalid GLSL using nested structures (#32724)
1 parent c1fa28d commit ac6cc54

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/nodes/core/StructNode.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,21 @@ class StructNode extends Node {
5252

5353
}
5454

55+
_getChildren() {
56+
57+
// Ensure struct type is the last child for correct code generation order
58+
59+
const children = super._getChildren();
60+
61+
const structTypeProperty = children.find( child => child.childNode === this.structTypeNode );
62+
63+
children.splice( children.indexOf( structTypeProperty ), 1 );
64+
children.push( structTypeProperty );
65+
66+
return children;
67+
68+
}
69+
5570
generate( builder ) {
5671

5772
const nodeVar = builder.getVarFromNode( this );

0 commit comments

Comments
 (0)