فهرست منبع

TSL: Add missing Support (#30371)

Renaud Rohlinger 11 ماه پیش
والد
کامیت
7e76dc4499
2فایلهای تغییر یافته به همراه18 افزوده شده و 1 حذف شده
  1. 1 0
      src/Three.TSL.js
  2. 17 1
      src/nodes/gpgpu/AtomicFunctionNode.js

+ 1 - 0
src/Three.TSL.js

@@ -57,6 +57,7 @@ export const atomicOr = TSL.atomicOr;
 export const atomicStore = TSL.atomicStore;
 export const atomicStore = TSL.atomicStore;
 export const atomicSub = TSL.atomicSub;
 export const atomicSub = TSL.atomicSub;
 export const atomicXor = TSL.atomicXor;
 export const atomicXor = TSL.atomicXor;
+export const atomicLoad = TSL.atomicLoad;
 export const attenuationColor = TSL.attenuationColor;
 export const attenuationColor = TSL.attenuationColor;
 export const attenuationDistance = TSL.attenuationDistance;
 export const attenuationDistance = TSL.attenuationDistance;
 export const attribute = TSL.attribute;
 export const attribute = TSL.attribute;

+ 17 - 1
src/nodes/gpgpu/AtomicFunctionNode.js

@@ -103,7 +103,13 @@ class AtomicFunctionNode extends TempNode {
 		const params = [];
 		const params = [];
 
 
 		params.push( `&${ a.build( builder, inputType ) }` );
 		params.push( `&${ a.build( builder, inputType ) }` );
-		params.push( b.build( builder, inputType ) );
+
+		if ( b !== null ) {
+
+			params.push( b.build( builder, inputType ) );
+
+
+		}
 
 
 		const methodSnippet = `${ builder.getMethod( method, type ) }( ${params.join( ', ' )} )`;
 		const methodSnippet = `${ builder.getMethod( method, type ) }( ${params.join( ', ' )} )`;
 
 
@@ -166,6 +172,16 @@ export const atomicFunc = ( method, pointerNode, valueNode, storeNode = null ) =
 
 
 };
 };
 
 
+/**
+ * Loads the value stored in the atomic variable.
+ *
+ * @function
+ * @param {Node} pointerNode - An atomic variable or element of an atomic buffer.
+ * @param {Node?} [storeNode=null] - A variable storing the return value of an atomic operation, typically the value of the atomic variable before the operation.
+ * @returns {AtomicFunctionNode}
+ */
+export const atomicLoad = ( pointerNode, storeNode = null ) => atomicFunc( AtomicFunctionNode.ATOMIC_LOAD, pointerNode, null, storeNode );
+
 /**
 /**
  * Stores a value in the atomic variable.
  * Stores a value in the atomic variable.
  *
  *

粤ICP备19079148号