I have a rgba16f texture that I fill with values using nvidia GL_NV_shader_atomic_fp16_vector extension, which allows to perform imageAtomicAdd on half float RGBA images, with multiple shader threads using same index. However, it doesn't support rgba32f.

Can I use imageLoad/imageStore to perform same thing with such image buffer as written below?

vec4 prevVal = imageLoad(tex, index);
prevVal += currVal;
imageStore(tex, index, prevVal);


I'm not sure how correctly set the coherency of such operations with correct barriers usage because I have not found any example. Or if it is even possible.

• I would not expect that to work reliably if different threads are going to be touching the same pixels; that’s why an atomic add is a distinct operation, because it provides that guarantee. It should be fine (albeit probably slow) if you can ensure that each pixel is only touched by one thread in a given dispatch. Nov 13 '20 at 20:56
• Yes, setting local sizes as 1 is an option because its still quite fast. It gets the performance drop abouth 6 times though. Nov 13 '20 at 21:07

If you could use imageLoad/Store to do atomic operations, there would be no need for atomic operations as a distinct class of operations. So no, you can't. There is no correct set of barriers or other properties that will allow this to work generally the way atomic operations do.