From 971e91238a303134d6ea97367fcccf411475c692 Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Sat, 31 Jul 2021 16:19:55 +1000 Subject: [PATCH] [client] main: bump the minimum fps to 60fps when showing the overlay --- client/src/main.c | 7 ++++++- client/src/main.h | 3 ++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/client/src/main.c b/client/src/main.c index 6ff0144d..cf0891d2 100644 --- a/client/src/main.c +++ b/client/src/main.c @@ -174,7 +174,8 @@ static int renderThread(void * unused) { /* only update the time if we woke up early */ clock_gettime(CLOCK_MONOTONIC, &time); - tsAdd(&time, g_state.frameTime); + tsAdd(&time, g_state.overlayInput ? + g_state.overlayFrameTime : g_state.frameTime); } } @@ -945,6 +946,10 @@ static int lg_run(void) g_state.frameTime = 1000000000ULL / (unsigned long long)g_params.fpsMin; } + // when the overlay is shown we should run at a minimum of 60 fps for + // interactivity. + g_state.overlayFrameTime = min(g_state.frameTime, 1000000000ULL / 60ULL); + keybind_register(); // setup the startup condition diff --git a/client/src/main.h b/client/src/main.h index 18ea70fd..68df03fc 100644 --- a/client/src/main.h +++ b/client/src/main.h @@ -109,7 +109,8 @@ struct AppState LGEvent * frameEvent; atomic_bool invalidateWindow; bool formatValid; - atomic_uint_least64_t frameTime; + uint64_t frameTime; + uint64_t overlayFrameTime; uint64_t lastFrameTime; bool lastFrameTimeValid; uint64_t lastRenderTime;