I'd like to use an InterlockedAdd operation on floats. Unfortunately, the documentation says it’s allowed on ints and uints only. So, I’m looking for some sort of workaround.
Here is my scenario: I have pixel shaders that need to write multiple times into a resource (at different positions). The problem is, the number of writes differs from pixel to pixel and is somewhere between zero (not that unlikely actually) and about five. The write operation is a simple addition of a float (so, a simple scattering via rasterization would do the trick, if I wouldn’t have to write more than once...)
Btw, what is the globallycoherent modifier doing in pixel shaders? Will this ensure that different primitives will see the writes of each other?
Any thoughts or ideas on that would be greatly appreciated!
Thanks in advance!
Cheers,
Tsus