Skip to content

Commit eb84a0d

Browse files
committed
TSL: Fixes the return value of atomic* nodes
1 parent 1620328 commit eb84a0d

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

src/nodes/gpgpu/AtomicFunctionNode.js

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import TempNode from '../core/TempNode.js';
1+
import Node from '../core/Node.js';
22
import { nodeProxy } from '../tsl/TSLCore.js';
33

44
/**
@@ -10,9 +10,9 @@ import { nodeProxy } from '../tsl/TSLCore.js';
1010
*
1111
* This node can only be used with a WebGPU backend.
1212
*
13-
* @augments TempNode
13+
* @augments Node
1414
*/
15-
class AtomicFunctionNode extends TempNode {
15+
class AtomicFunctionNode extends Node {
1616

1717
static get type() {
1818

@@ -52,6 +52,14 @@ class AtomicFunctionNode extends TempNode {
5252
*/
5353
this.valueNode = valueNode;
5454

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+
5563
}
5664

5765
/**
@@ -81,6 +89,8 @@ class AtomicFunctionNode extends TempNode {
8189

8290
generate( builder ) {
8391

92+
const parents = builder.getNodeProperties( this ).parents;
93+
8494
const method = this.method;
8595

8696
const type = this.getNodeType( builder );
@@ -101,8 +111,9 @@ class AtomicFunctionNode extends TempNode {
101111
}
102112

103113
const methodSnippet = `${ builder.getMethod( method, type ) }( ${ params.join( ', ' ) } )`;
114+
const isVoid = parents.length === 1 && parents[ 0 ].isStackNode === true;
104115

105-
if ( b !== null ) {
116+
if ( isVoid ) {
106117

107118
builder.addLineFlowCode( methodSnippet, this );
108119

0 commit comments

Comments
 (0)