From 074a8a265319d3793b7f8f9ab8ae50c50d9a11a3 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Thu, 16 Jan 2025 21:38:45 +1000 Subject: [PATCH] GPUThread: Fix input OSD with threaded rendering off --- src/core/gpu_thread.cpp | 13 +++++++++++++ src/core/gpu_thread.h | 1 + src/core/imgui_overlays.cpp | 2 +- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/core/gpu_thread.cpp b/src/core/gpu_thread.cpp index 6834f10a0a..5f2f8edbc8 100644 --- a/src/core/gpu_thread.cpp +++ b/src/core/gpu_thread.cpp @@ -1013,6 +1013,19 @@ std::pair GPUThread::BeginASyncBufferCall(AsyncBufferC return std::make_pair(static_cast(cmd), buffer); } +void GPUThread::EndASyncBufferCall(GPUThreadCommand* cmd) +{ + if (!s_state.use_gpu_thread) [[unlikely]] + { + GPUThreadAsyncCallCommand* const acmd = static_cast(cmd); + acmd->func(); + acmd->~GPUThreadAsyncCallCommand(); + return; + } + + PushCommand(cmd); +} + void GPUThread::UpdateSettings(bool gpu_settings_changed, bool device_settings_changed) { if (device_settings_changed) diff --git a/src/core/gpu_thread.h b/src/core/gpu_thread.h index 1737a5d1cf..57c0614369 100644 --- a/src/core/gpu_thread.h +++ b/src/core/gpu_thread.h @@ -73,6 +73,7 @@ bool IsUsingThread(); void RunOnThread(AsyncCallType func); void RunOnBackend(AsyncBackendCallType func, bool sync, bool spin_or_wake); std::pair BeginASyncBufferCall(AsyncBufferCallType func, u32 buffer_size); +void EndASyncBufferCall(GPUThreadCommand* cmd); void SetVSync(GPUVSyncMode mode, bool allow_present_throttle); // Should only be called on the GPU thread. diff --git a/src/core/imgui_overlays.cpp b/src/core/imgui_overlays.cpp index 1365155d47..e87b729692 100644 --- a/src/core/imgui_overlays.cpp +++ b/src/core/imgui_overlays.cpp @@ -729,7 +729,7 @@ void ImGuiManager::UpdateInputOverlay() } } - GPUThread::PushCommand(cmd); + GPUThread::EndASyncBufferCall(cmd); } void ImGuiManager::UpdateInputOverlay(void* buffer)