Hacker News new | ask | show | jobs
by PaulKeeble 229 days ago
I have often found limiting the buffer size as a simple way to communicate back to producers that more work can't be taken. Then what happens is all a producer strategy to drop work or wait for a period of time then drop or just hold onto the work until the buffer has a clear space. Its about the simplest message from consumer to producer you can do and how games tend to do backpressure and how Go channels work.
1 comments

Can you give examples of which games have implemented this (if open source) for reference?
It is how DirectX works. The call to present that ends the stream of the commands to the GPU and tells it to render causes the CPU to be stalled waiting for this to be possible. This causes a backpressure into the game engine as the next simulation can't start or at the very least the next frame can't be started to be processed until it returns. It has been used by GPU makers to frame pace games as well to avoid stuttering.

So its not just some games, its all games its part of the core of how DX works.