* Double-check on the parents of the atomic functions to prevent errors. * Update WGSLNodeBuilder.js
@@ -113,7 +113,7 @@ class AtomicFunctionNode extends Node {
}
const methodSnippet = `${ builder.getMethod( method, type ) }( ${ params.join( ', ' ) } )`;
- const isVoid = parents.length === 1 && parents[ 0 ].isStackNode === true;
+ const isVoid = parents ? ( parents.length === 1 && parents[ 0 ].isStackNode === true ) : false;
if ( isVoid ) {
@@ -801,9 +801,20 @@ class WGSLNodeBuilder extends NodeBuilder {
*/
getNodeAccess( node, shaderStage ) {
- if ( shaderStage !== 'compute' )
+ if ( shaderStage !== 'compute' ) {
+
+ if ( node.isAtomic === true ) {
+ console.warn( 'WebGPURenderer: Atomic operations are only supported in compute shaders.' );
+ return NodeAccess.READ_WRITE;
+ }
return NodeAccess.READ_ONLY;
return node.access;