From b8a99d1330fd3604ab46caa6b96312332920e12e Mon Sep 17 00:00:00 2001 From: Robert Beckebans Date: Tue, 28 Feb 2023 10:40:25 +0100 Subject: [PATCH] Tweaked DrawFPS maxTime to reduce flickering if V-Sync is on --- neo/framework/Console.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neo/framework/Console.cpp b/neo/framework/Console.cpp index d260a6f6..02d17d05 100644 --- a/neo/framework/Console.cpp +++ b/neo/framework/Console.cpp @@ -301,7 +301,7 @@ float idConsoleLocal::DrawFPS( float y ) // SRS - Calculate max fps and max frame time based on glConfig.displayFrequency if vsync enabled and lower than engine Hz, otherwise use com_engineHz_latched const int maxFPS = ( r_swapInterval.GetInteger() > 0 && glConfig.displayFrequency > 0 ? std::min( glConfig.displayFrequency, int( com_engineHz_latched ) ) : com_engineHz_latched ); - const int maxTime = 1000.0 / maxFPS * 1000; + const int maxTime = ( 1000.0 / maxFPS ) * 1050; // slight 5% tolerance offset to avoid flickering of the stats // SRS - Frame idle and busy time calculations are based on direct frame-over-frame measurement relative to finishSyncTime const int64 frameIdleTime = int64( commonLocal.mainFrameTiming.startGameTime ) - int64( commonLocal.mainFrameTiming.finishSyncTime );