mirror of https://github.com/PCSX2/pcsx2.git
MTGS: Make PresentCurrentFrame() callable from CPU thread
GS thread can use GSPresentCurrentFrame().
This commit is contained in:
parent
ebeba2ba17
commit
038e22e5db
|
@ -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<void()>& 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()
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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<u32>*
|
|||
|
||||
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)
|
||||
|
|
Loading…
Reference in New Issue