mirror of
https://github.com/stenzek/duckstation.git
synced 2025-06-07 12:05:52 +00:00
System: Use recreation logic for toggling GPU threading
This commit is contained in:
parent
f7d7eecb6c
commit
96058f5d7e
@ -170,6 +170,7 @@ static void ClearRunningGame();
|
|||||||
static void DestroySystem();
|
static void DestroySystem();
|
||||||
|
|
||||||
static void RecreateGPU(GPURenderer new_renderer);
|
static void RecreateGPU(GPURenderer new_renderer);
|
||||||
|
static void SetGPUThreadEnabled(bool enabled);
|
||||||
static std::string GetScreenshotPath(const char* extension);
|
static std::string GetScreenshotPath(const char* extension);
|
||||||
static bool StartMediaCapture(std::string path, bool capture_video, bool capture_audio, u32 video_width,
|
static bool StartMediaCapture(std::string path, bool capture_video, bool capture_audio, u32 video_width,
|
||||||
u32 video_height);
|
u32 video_height);
|
||||||
@ -1203,6 +1204,27 @@ void System::RecreateGPU(GPURenderer renderer)
|
|||||||
GPUThread::PresentCurrentFrame();
|
GPUThread::PresentCurrentFrame();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void System::SetGPUThreadEnabled(bool enabled)
|
||||||
|
{
|
||||||
|
// can be called without valid system
|
||||||
|
if (!IsValid())
|
||||||
|
{
|
||||||
|
GPUThread::Internal::SetThreadEnabled(g_settings.gpu_use_thread);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
FreeMemoryStateStorage(false, true, false);
|
||||||
|
StopMediaCapture();
|
||||||
|
|
||||||
|
GPUThread::Internal::SetThreadEnabled(g_settings.gpu_use_thread);
|
||||||
|
|
||||||
|
ClearMemorySaveStates(true, false);
|
||||||
|
|
||||||
|
g_gpu.UpdateDisplay(false);
|
||||||
|
if (IsPaused())
|
||||||
|
GPUThread::PresentCurrentFrame();
|
||||||
|
}
|
||||||
|
|
||||||
void System::LoadSettings(bool display_osd_messages)
|
void System::LoadSettings(bool display_osd_messages)
|
||||||
{
|
{
|
||||||
std::unique_lock<std::mutex> lock = Host::GetSettingsLock();
|
std::unique_lock<std::mutex> lock = Host::GetSettingsLock();
|
||||||
@ -4676,7 +4698,7 @@ void System::CheckForSettingsChanges(const Settings& old_settings)
|
|||||||
|
|
||||||
if (g_settings.gpu_use_thread != old_settings.gpu_use_thread) [[unlikely]]
|
if (g_settings.gpu_use_thread != old_settings.gpu_use_thread) [[unlikely]]
|
||||||
{
|
{
|
||||||
GPUThread::Internal::SetThreadEnabled(g_settings.gpu_use_thread);
|
SetGPUThreadEnabled(g_settings.gpu_use_thread);
|
||||||
}
|
}
|
||||||
else if (g_settings.gpu_use_thread && g_settings.gpu_max_queued_frames != old_settings.gpu_max_queued_frames)
|
else if (g_settings.gpu_use_thread && g_settings.gpu_max_queued_frames != old_settings.gpu_max_queued_frames)
|
||||||
[[unlikely]]
|
[[unlikely]]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user