From 76d9ba6bf1acfb21229a42a076fa7b09aee6cfa8 Mon Sep 17 00:00:00 2001 From: "Ben \"root\" Anderson" Date: Sun, 15 Mar 2015 19:06:52 -0500 Subject: [PATCH] glFinish() to force the tightest input-to-screen coupling possible --- src/RageDisplay_OGL.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/RageDisplay_OGL.cpp b/src/RageDisplay_OGL.cpp index 41fe31c823..192a40ffd7 100644 --- a/src/RageDisplay_OGL.cpp +++ b/src/RageDisplay_OGL.cpp @@ -798,12 +798,21 @@ bool RageDisplay_Legacy::BeginFrame() void RageDisplay_Legacy::EndFrame() { - glFlush(); - FrameLimitBeforeVsync( g_pWind->GetActualVideoModeParams().rate ); g_pWind->SwapBuffers(); FrameLimitAfterVsync(); + // Some would advise against glFinish(), ever. Those people don't realize + // the degree of freedom GL hosts are permitted in queueing commands. + // If left to its own devices, the host could lag behind several frames' worth + // of commands. + // glFlush() only forces the host to not wait to execute all commands + // sent so far; it does NOT block on those commands until they finish. + // glFinish() blocks. We WANT to block. Why? This puts the engine state + // reflected by the next frame as close as possible to the on-screen + // appearance of that frame. + glFinish(); + g_pWind->Update(); RageDisplay::EndFrame();