Compute shader - append buffer - reset counter

Why does the content (seemingly the order of the content) of an append buffer change every frame when ‘reset counter’ is enabled?

What I expect to happen at the beginning of a frame is - the counter is reset and the CS appends to the buffer, starting from the beginning.

Attached is an edited girlpower example to show what I mean

indirectbasic.zip (9.2 kB)

This is exactly what is done. But Append does not guarantee order so several threads can push data in parallel, it is designed as a fast unordered stack.

In most cases this is not so important (for rendering mostly), if you really need order you’ll need 3 passes with a prefix sum, which is rather easy to do.

Of course!

Sounds obvious now…

I’d just imagined I’d be able to append some data, then consume the same data if needed.

Does the order of cs shaders in one group, adding a set of data to the same buffer, guarantee order of those sets?