The procedure is:
- UAVBuffer.IncrementCounter() in first dispatch.
- UAV barrier waits for the previous op is done.
- Read the counter value by UAVBuffer.Load(0)
I always got the value "0".
I used PIX to check what's going on:
It shows that the reading op should be fine.
And below is what a counter buffer view in PIX(in the first dispatch):
what the counter buffer view show in counter reading dispatch:
I init counter as a 32-bit(4 bytes) buffer, I don't understand why PIX showed the buffer count is 27,550. Does this make my counter reading got the wrong value?