- Home /
How (Or Why) to use Consume Buffers safely on arbitrary data lengths
Hey guys, I wanted to use compute shaders to write object position into a texture, then manipulate the texture and sometimes read a value back from the texture.
To avoid too much stalling, I wanted to write positions into the texture every 100ms (for example). So every update write position into a list, then send that list as a consume buffer on that 100ms tick.
But I do not know how many samples I will be sending per time, which is why I thought consume buffers were the solution, but now I learned they are rather "dumb".
But if I consume more elements than it contains, I start getting into trouble.
So how do I do this? Do I have to have a 1x1x1 sized thread group and just dispatch only enough groups for the list length? Or is there a smarter way?
Or maybe I should use a different approach altogether?