glFinish() to force the tightest input-to-screen coupling possible

This commit is contained in:
Ben "root" Anderson
2015-03-15 19:06:52 -05:00
parent d85ac9af85
commit 76d9ba6bf1
+11 -2
View File
@@ -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();