From 661a72c8f672a5f07835185ec065f21234901ae7 Mon Sep 17 00:00:00 2001 From: Tony Wasserka Date: Sun, 5 Jan 2025 12:07:15 +0100 Subject: [PATCH] Frontend: Fix thread starvation caused by spamming the Vulkan mutex --- source/gui-sdl/main.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/gui-sdl/main.cpp b/source/gui-sdl/main.cpp index 98ee3c6..0dda979 100644 --- a/source/gui-sdl/main.cpp +++ b/source/gui-sdl/main.cpp @@ -690,6 +690,9 @@ if (bootstrap_nand) // Experimental system bootstrapper continue; } + // Limit to ~60 FPS. This avoids starving the emulation thread when locking g_vulkan_queue_mutex + std::this_thread::sleep_for(std::chrono::milliseconds { 15 }); + // Process next frame from the emulation core, if any (and do so three times for each screen id... TODO: Find a nicer way of doing this) display->BeginFrame();