atomicLoad
Performs a thread-safe read operation on a shared memory location (usually a Storage Buffer), ensuring the fetched value is complete and relatively 'fresh', avoiding the risks of 'torn reads' and 'stale reads'.
Core Advantages
Provides read integrity and a memory synchronization guarantee. It is the cornerstone of reliable inter-thread communication, ensuring a 'consumer' thread can safely access the complete data written by a 'producer' thread.
Common Uses
As the 'consumer' in a producer-consumer pattern to safely read data prepared by a producer.
Fetching the final value of a counter that has been aggregated by other atomic operations (like atomicAdd).
Monitoring a global 'stop' flag within a loop to implement interruptible parallel computations.
How to adjust
This node itself has no adjustable parameters (other than the `pointerNode` address). Its visual effect depends entirely on the data it reads and how that data is subsequently used. For example, in a heatmap visualization, if the data written to the buffer has larger values, `atomicLoad` will read these larger values, resulting in a 'hotter' final color. It faithfully relays the data; the effect is determined by the data source.
Code Examples
1// Safely load the density value computed by other threads
2const density = atomicLoad(densityGridBuffer.element(index));
3
4// Calculate color based on the loaded value
5const color = heatmapGradient(float(density));