What happens when you call RWByteAddressBuffer.InterlockedAdd?

Viewed 243

I usually program in OpenGL but I need to translate some code from HLSL.

I have seen the documentation of RWByteAddressBuffer, but I'm not sure how it works with InterlockedAdd.

Suposedly, RWByteAddressBuffer is addressed by bytes. However, I think InterlockedAdd works on uints, which are 32-bit unsigned integers.

My doubt is, what happens when I do this?

uint c;
buffer.InterlockedAdd(0, 1, c);

Am I incrementing the first byte of the buffer, or the first 32-bit word of the buffer? What if I use offsets that are not multiples of 4?

1 Answers
Related