From 33f316ded22afa494072b17b66b6a87b574ba34c Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Sat, 26 Mar 2022 16:32:43 -0400 Subject: [PATCH] Calculate FPS stuff even if frame is skipped I decided ultimately to actually keep the frame skip optimization disabled, because I think it is actually a little bit helpful that you can still get accurate rendering perfstats while paused, however if we decide otherwise then we can have this optimization back without making the game act like it's lagging. --- src/screen.c | 25 ++++++++++++++----------- src/sdl/i_video.c | 19 +++++-------------- 2 files changed, 19 insertions(+), 25 deletions(-) diff --git a/src/screen.c b/src/screen.c index 5ca870cfe..9b26b4fa1 100644 --- a/src/screen.c +++ b/src/screen.c @@ -522,6 +522,7 @@ boolean SCR_IsAspectCorrect(INT32 width, INT32 height) // moved out of os-specific code for consistency static boolean ticsgraph[TICRATE]; static tic_t lasttic; +static tic_t totaltics; static UINT32 fpstime = 0; static UINT32 lastupdatetime = 0; @@ -537,6 +538,11 @@ double aproxfps = 0.0f; void SCR_CalcAproxFps(void) { tic_t i = 0; + tic_t ontic = I_GetTime(); + + totaltics = 0; + + // Update FPS time if (I_PreciseToMicros(fpstime - lastupdatetime) > 1000000 * FPSUPDATERATE) { if (fpssampleslen == FPSMAXSAMPLES) @@ -558,15 +564,8 @@ void SCR_CalcAproxFps(void) } fpstime = I_GetPreciseTime(); -} - -void SCR_DisplayTicRate(void) -{ - tic_t i; - tic_t ontic = I_GetTime(); - tic_t totaltics = 0; - const UINT8 *ticcntcolor = NULL; + // Update ticrate time for (i = lasttic + 1; i < TICRATE+lasttic && i < ontic; ++i) ticsgraph[i % TICRATE] = false; @@ -576,6 +575,13 @@ void SCR_DisplayTicRate(void) if (ticsgraph[i]) ++totaltics; + lasttic = ontic; +} + +void SCR_DisplayTicRate(void) +{ + const UINT8 *ticcntcolor = NULL; + // draw "FPS" V_DrawFixedPatch(306<