mirror of
https://github.com/PCSX2/pcsx2.git
synced 2025-12-16 04:08:48 +00:00
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)
|
if (!VMManager::HasValidVM() || VMManager::GetState() == VMState::Running)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
GetMTGS().RunOnGSThread([]() { GetMTGS().PresentCurrentFrame(); });
|
GetMTGS().PresentCurrentFrame();
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmuThread::runOnCPUThread(const std::function<void()>& func)
|
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);
|
g_host_display->ResizeWindow(new_window_width, new_window_height, new_window_scale);
|
||||||
ImGuiManager::WindowResized();
|
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)
|
void Host::RequestResizeHostDisplay(s32 width, s32 height)
|
||||||
@ -994,10 +990,6 @@ void Host::UpdateHostDisplay()
|
|||||||
{
|
{
|
||||||
g_emu_thread->updateDisplay();
|
g_emu_thread->updateDisplay();
|
||||||
ImGuiManager::WindowResized();
|
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()
|
void Host::OnVMStarting()
|
||||||
|
|||||||
@ -385,7 +385,7 @@ public:
|
|||||||
void ShutdownThread();
|
void ShutdownThread();
|
||||||
|
|
||||||
/// Re-presents the current frame. Call when things like window resizes happen to re-display
|
/// 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();
|
void PresentCurrentFrame();
|
||||||
|
|
||||||
// Waits for the GS to empty out the entire ring buffer contents.
|
// 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();
|
GSResetAPIState();
|
||||||
Host::ResizeHostDisplay(width, height, scale);
|
Host::ResizeHostDisplay(width, height, scale);
|
||||||
GSRestoreAPIState();
|
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();
|
GSResetAPIState();
|
||||||
Host::UpdateHostDisplay();
|
Host::UpdateHostDisplay();
|
||||||
GSRestoreAPIState();
|
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()
|
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)
|
void SysMtgsThread::SetRunIdle(bool enabled)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user