Fix latency issue introduced by G_FPSLimit() handling of videoNextPage() that was causing frames to be delayed presentation until after the next frame is prepared.

videoNextPage() is now called immediately after preparing the frame for drawing, outside of G_FPSLimit() but on the condition that its return value is true.

git-svn-id: https://svn.eduke32.com/eduke32@7730 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
pogokeen 2019-06-25 18:34:56 +00:00 committed by Christoph Oelckers
parent 281ee3358b
commit 19c2c690d3
5 changed files with 15 additions and 8 deletions

View file

@ -899,6 +899,7 @@ nextdemo_nomenu:
if ((g_player[myconnectindex].ps->gm&MODE_MENU) && (g_player[myconnectindex].ps->gm&MODE_EOL)) if ((g_player[myconnectindex].ps->gm&MODE_MENU) && (g_player[myconnectindex].ps->gm&MODE_EOL))
{ {
Demo_FinishProfile(); Demo_FinishProfile();
videoNextPage();
goto RECHECK; goto RECHECK;
} }
@ -957,6 +958,8 @@ nextdemo_nomenu:
if (ud.show_help == 0 && (g_player[myconnectindex].ps->gm&MODE_MENU) == 0) if (ud.show_help == 0 && (g_player[myconnectindex].ps->gm&MODE_MENU) == 0)
rotatesprite_fs((320-50)<<16, 9<<16, 65536L, 0, BETAVERSION, 0, 0, 2+8+16+128); rotatesprite_fs((320-50)<<16, 9<<16, 65536L, 0, BETAVERSION, 0, 0, 2+8+16+128);
} }
videoNextPage();
} }
// NOTE: We must prevent handleevents() and Net_GetPackets() from // NOTE: We must prevent handleevents() and Net_GetPackets() from

View file

@ -6138,13 +6138,7 @@ void G_MaybeAllocPlayer(int32_t pnum)
int G_FPSLimit(void) int G_FPSLimit(void)
{ {
static auto nextPageTicks = (double)timerGetTicksU64(); static auto nextPageTicks = (double)timerGetTicksU64();
static unsigned frameWaiting = 0; int frameWaiting = 0;
if (frameWaiting)
{
frameWaiting--;
videoNextPage();
}
auto const frameTicks = (double)timerGetTicksU64(); auto const frameTicks = (double)timerGetTicksU64();
@ -6154,7 +6148,7 @@ int G_FPSLimit(void)
nextPageTicks = frameTicks; nextPageTicks = frameTicks;
nextPageTicks += g_frameDelay; nextPageTicks += g_frameDelay;
frameWaiting++; ++frameWaiting;
} }
return frameWaiting; return frameWaiting;
@ -6819,6 +6813,7 @@ MAIN_LOOP_RESTART:
if (videoGetRenderMode() >= REND_POLYMOST) if (videoGetRenderMode() >= REND_POLYMOST)
G_DrawBackground(); G_DrawBackground();
G_DisplayRest(smoothRatio); G_DisplayRest(smoothRatio);
videoNextPage();
if (gameUpdate) if (gameUpdate)
{ {

View file

@ -1253,6 +1253,7 @@ void Screen_Play(void)
if (VM_OnEventWithReturn(EVENT_SCREEN, g_player[screenpeek].ps->i, screenpeek, I_CheckAllInput())) if (VM_OnEventWithReturn(EVENT_SCREEN, g_player[screenpeek].ps->i, screenpeek, I_CheckAllInput()))
running = false; running = false;
videoNextPage();
I_ClearAllInput(); I_ClearAllInput();
} while (running); } while (running);
} }

View file

@ -4709,6 +4709,7 @@ void Net_WaitForServer(void)
{ {
display_betascreen(); display_betascreen();
gametext_center_shade(170, "Waiting for server", 14); gametext_center_shade(170, "Waiting for server", 14);
videoNextPage();
} }
// XXX: this looks like something that should be rate limited... // XXX: this looks like something that should be rate limited...

View file

@ -1572,6 +1572,7 @@ void gameDisplay3DRScreen()
P_SetGamePalette(g_player[myconnectindex].ps, g_player[myconnectindex].ps->palette, 0); P_SetGamePalette(g_player[myconnectindex].ps, g_player[myconnectindex].ps->palette, 0);
g_restorePalette = 0; g_restorePalette = 0;
} }
videoNextPage();
} }
} }
@ -1676,6 +1677,9 @@ void gameDisplayTitleScreen(void)
P_SetGamePalette(g_player[myconnectindex].ps, g_player[myconnectindex].ps->palette, 0); P_SetGamePalette(g_player[myconnectindex].ps, g_player[myconnectindex].ps->palette, 0);
g_restorePalette = 0; g_restorePalette = 0;
} }
videoNextPage();
#ifdef LUNATIC #ifdef LUNATIC
if (g_elEventError) if (g_elEventError)
break; break;
@ -1882,6 +1886,7 @@ static void G_BonusCutscenes(void)
rotatesprite_fs(breathe[t+3]<<16, breathe[t+4]<<16, 65536L, 0, breathe[t+2], 0, 0, 2+8+16+64+128+BGSTRETCH); rotatesprite_fs(breathe[t+3]<<16, breathe[t+4]<<16, 65536L, 0, breathe[t+2], 0, 0, 2+8+16+64+128+BGSTRETCH);
} }
} }
videoNextPage();
} }
G_HandleAsync(); G_HandleAsync();
@ -2306,6 +2311,7 @@ void G_BonusScreen(int32_t bonusonly)
{ {
videoClearScreen(0); videoClearScreen(0);
G_DisplayMPResultsScreen(); G_DisplayMPResultsScreen();
videoNextPage();
} }
if (I_CheckAllInput()) if (I_CheckAllInput())
@ -2578,6 +2584,7 @@ void G_BonusScreen(int32_t bonusonly)
break; break;
VM_OnEvent(EVENT_DISPLAYBONUSSCREEN, g_player[screenpeek].ps->i, screenpeek); VM_OnEvent(EVENT_DISPLAYBONUSSCREEN, g_player[screenpeek].ps->i, screenpeek);
videoNextPage();
} }
} while (1); } while (1);
} }