Why does invoking GL.Finish after swapping buffers prevent lower end hardware from massive stuttering, but not on modern GPUs?

Viewed 47

I'm rendering at many hundreds of frames per second. Turning vsync on is not desirable because the game is an FPS.

For some reason I do not understand, on any modern GPU (any discrete GPU in the last 7 or so years) it renders flawlessly, fast, and smooth.

However, if done on any integrated GPU or older GPU, there's massive stuttering that happens to the point of it being unplayable. Further, there seems to be a 100ms delay that users feel.

For some reason, if I do GL.Finish() immediately after a SwapBuffers(), this problem is strongly mitigated for integrated/older GPUs.

Why is this?

It makes no sense to me that calling GL.Finish() after swapping the buffers would do anything, because I thought the rendering commands need to be executed completely before swapping the buffers so that the monitor can get all of the drawing commands issued before the swap.

1 Answers

Swapping the default framebuffer may cause a pipeline flush, but it also may decide not to do so. [Reference]

There is not even a guarantee that SwapBuffer really waits until the buffer swapping has finished. Some implementations may decide to only enqueue the buffer swap in the command queue and return immediately after that. So in case the GPU doesn't flush on a swap, GL.Finish will flush the pipeline.

You might also want to read this thread: https://community.khronos.org/t/swapbuffers-and-synchronization/107667 since it discusses the topic in more detail.

Related