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

Using imageLoad/imageStore to read modify writeperform atomic add

Source Link
mdkdy
  • 2.2k
  • 1
  • 13
  • 21

Using imageLoad/imageStore to read modify write

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.