File tree Expand file tree Collapse file tree 2 files changed +31
-4
lines changed Expand file tree Collapse file tree 2 files changed +31
-4
lines changed Original file line number Diff line number Diff line change @@ -87,6 +87,14 @@ class Node extends EventDispatcher {
87
87
*/
88
88
this . global = false ;
89
89
90
+ /**
91
+ * Create a list of parents for this node during the build process.
92
+ *
93
+ * @type {boolean }
94
+ * @default false
95
+ */
96
+ this . parents = false ;
97
+
90
98
/**
91
99
* This flag can be used for type testing.
92
100
*
@@ -643,6 +651,14 @@ class Node extends EventDispatcher {
643
651
644
652
if ( childNode && childNode . isNode === true ) {
645
653
654
+ if ( childNode . parents === true ) {
655
+
656
+ const childProperties = builder . getNodeProperties ( childNode ) ;
657
+ childProperties . parents = childProperties . parents || [ ] ;
658
+ childProperties . parents . push ( this ) ;
659
+
660
+ }
661
+
646
662
childNode . build ( builder ) ;
647
663
648
664
}
Original file line number Diff line number Diff line change 1
- import TempNode from '../core/TempNode .js' ;
1
+ import Node from '../core/Node .js' ;
2
2
import { nodeProxy } from '../tsl/TSLCore.js' ;
3
3
4
4
/**
@@ -10,9 +10,9 @@ import { nodeProxy } from '../tsl/TSLCore.js';
10
10
*
11
11
* This node can only be used with a WebGPU backend.
12
12
*
13
- * @augments TempNode
13
+ * @augments Node
14
14
*/
15
- class AtomicFunctionNode extends TempNode {
15
+ class AtomicFunctionNode extends Node {
16
16
17
17
static get type ( ) {
18
18
@@ -52,6 +52,14 @@ class AtomicFunctionNode extends TempNode {
52
52
*/
53
53
this . valueNode = valueNode ;
54
54
55
+ /**
56
+ * Creates a list of the parents for this node for detecting if the node needs to return a value.
57
+ *
58
+ * @type {boolean }
59
+ * @default true
60
+ */
61
+ this . parents = true ;
62
+
55
63
}
56
64
57
65
/**
@@ -81,6 +89,8 @@ class AtomicFunctionNode extends TempNode {
81
89
82
90
generate ( builder ) {
83
91
92
+ const parents = builder . getNodeProperties ( this ) . parents ;
93
+
84
94
const method = this . method ;
85
95
86
96
const type = this . getNodeType ( builder ) ;
@@ -101,8 +111,9 @@ class AtomicFunctionNode extends TempNode {
101
111
}
102
112
103
113
const methodSnippet = `${ builder . getMethod ( method , type ) } ( ${ params . join ( ', ' ) } )` ;
114
+ const isVoid = parents . length === 1 && parents [ 0 ] . isStackNode === true ;
104
115
105
- if ( b !== null ) {
116
+ if ( isVoid ) {
106
117
107
118
builder . addLineFlowCode ( methodSnippet , this ) ;
108
119
You can’t perform that action at this time.
0 commit comments