Skip to main content
2 of 2
edited title
mdkdy
  • 2.2k
  • 1
  • 13
  • 21

Using imageLoad/imageStore to perform atomic add

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.

mdkdy
  • 2.2k
  • 1
  • 13
  • 21