diff --git a/pcsx2-qt/QtHost.cpp b/pcsx2-qt/QtHost.cpp index 5de21a4879..0483bbbe57 100644 --- a/pcsx2-qt/QtHost.cpp +++ b/pcsx2-qt/QtHost.cpp @@ -826,7 +826,7 @@ void EmuThread::redrawDisplayWindow() if (!VMManager::HasValidVM() || VMManager::GetState() == VMState::Running) return; - GetMTGS().RunOnGSThread([]() { GetMTGS().PresentCurrentFrame(); }); + GetMTGS().PresentCurrentFrame(); } void EmuThread::runOnCPUThread(const std::function& func) @@ -979,10 +979,6 @@ void Host::ResizeHostDisplay(u32 new_window_width, u32 new_window_height, float { g_host_display->ResizeWindow(new_window_width, new_window_height, new_window_scale); ImGuiManager::WindowResized(); - - // if we're paused, re-present the current frame at the new window size. - if (VMManager::GetState() == VMState::Paused) - GetMTGS().PresentCurrentFrame(); } void Host::RequestResizeHostDisplay(s32 width, s32 height) @@ -994,10 +990,6 @@ void Host::UpdateHostDisplay() { g_emu_thread->updateDisplay(); ImGuiManager::WindowResized(); - - // if we're paused, re-present the current frame at the new window size. - if (VMManager::GetState() == VMState::Paused) - GetMTGS().PresentCurrentFrame(); } void Host::OnVMStarting() diff --git a/pcsx2/GS.h b/pcsx2/GS.h index 6b8ede1d51..8b3d2da28d 100644 --- a/pcsx2/GS.h +++ b/pcsx2/GS.h @@ -385,7 +385,7 @@ public: void ShutdownThread(); /// Re-presents the current frame. Call when things like window resizes happen to re-display - /// the current frame with the correct proportions. Should only be called on the GS thread. + /// the current frame with the correct proportions. Should only be called from the CPU thread. void PresentCurrentFrame(); // Waits for the GS to empty out the entire ring buffer contents. diff --git a/pcsx2/MTGS.cpp b/pcsx2/MTGS.cpp index 399cbc36ad..8061b6fc65 100644 --- a/pcsx2/MTGS.cpp +++ b/pcsx2/MTGS.cpp @@ -953,6 +953,12 @@ void SysMtgsThread::ResizeDisplayWindow(int width, int height, float scale) GSResetAPIState(); Host::ResizeHostDisplay(width, height, scale); GSRestoreAPIState(); + +#ifdef PCSX2_CORE + // If we're paused, re-present the current frame at the new window size. + if (VMManager::GetState() == VMState::Paused) + GSPresentCurrentFrame(); +#endif }); } @@ -963,6 +969,12 @@ void SysMtgsThread::UpdateDisplayWindow() GSResetAPIState(); Host::UpdateHostDisplay(); GSRestoreAPIState(); + +#ifdef PCSX2_CORE + // If we're paused, re-present the current frame at the new window size. + if (VMManager::GetState() == VMState::Paused) + GSPresentCurrentFrame(); +#endif }); } @@ -1030,7 +1042,15 @@ bool SysMtgsThread::SaveMemorySnapshot(u32 width, u32 height, std::vector* void SysMtgsThread::PresentCurrentFrame() { - GSPresentCurrentFrame(); + if (m_run_idle_flag.load(std::memory_order_relaxed)) + { + // If we're running idle, we're going to re-present anyway. + return; + } + + RunOnGSThread([]() { + GSPresentCurrentFrame(); + }); } void SysMtgsThread::SetRunIdle(bool enabled)