[Compute-Shader]How to reset hidden counter of a StructuredBuffer?


how exactly can I reset the value of the internal counter of a strucuted buffer prior to a .DispatchCompute()-Call? Is it even possible? Or do I have to create seperate “dummy” buffer recreating it every frame?

Best regards

Just set StructuredBuffer.CounterResetValue to zero or whatever reset value you want. On every draw/dispatch call invloving the structured buffer the counter will be reset to this value. When you don’t want to reset the counter anymore you set CounterResetValue to -1.


Thanks, makes sense. I, at first, assumed I have to assign -1 to it in order to reset it, but this makes more sense.

Best regards