Access buffer counter in compute shader

Hi,

I would like to use ID3D11DeviceContext::CopyStructureCount to access the current count of an AppendStructuredBuffer on the GPU. Is this possible? If so, how would I go about doing it?

I’m aware that I can use CopyCount to retrieve the value on the CPU side.

Thanks

About Unity and Append Buffers, you can see following resources:

1 Like

Thanks for your reply. I have been using this blog already and find it very helpful. Being unable to get the Append buffer counter on the GPU side is rather frustrating. Where I need it I have been using regular RWStructuredBuffers and ComputeBuffer.IncrementCounter(), as a workaround.

CopyCount copies the value into another buffer on the GPU. Just access the value from your Shader.

https://docs.unity3d.com/ScriptReference/ComputeBuffer.CopyCount.html

1 Like

I came to this conclusion after a few more hours of thinking/reading about it. Many thanks for confirming it though, much appreciated.