Qt: Update GPU settings when enhancements are changed

This commit is contained in:
Connor McLaughlin 2020-01-24 14:51:33 +10:00
parent f05f5aeb2b
commit abf48b6cc2
3 changed files with 22 additions and 3 deletions

View file

@ -78,6 +78,11 @@ bool System::RecreateGPU()
return true; return true;
} }
void System::UpdateGPUSettings()
{
m_gpu->UpdateSettings();
}
bool System::Boot(const char* filename) bool System::Boot(const char* filename)
{ {
// Load CD image up and detect region. // Load CD image up and detect region.

View file

@ -70,6 +70,9 @@ public:
/// Recreates the GPU component, saving/loading the state so it is preserved. Call when the GPU renderer changes. /// Recreates the GPU component, saving/loading the state so it is preserved. Call when the GPU renderer changes.
bool RecreateGPU(); bool RecreateGPU();
/// Updates GPU settings, without recreating the renderer.
void UpdateGPUSettings();
void RunFrame(); void RunFrame();
bool LoadEXE(const char* filename, std::vector<u8>& bios_image); bool LoadEXE(const char* filename, std::vector<u8>& bios_image);

View file

@ -110,6 +110,10 @@ void QtHostInterface::applySettings()
// TODO: Should we move this to the base class? // TODO: Should we move this to the base class?
const GPURenderer old_gpu_renderer = m_settings.gpu_renderer; const GPURenderer old_gpu_renderer = m_settings.gpu_renderer;
const u32 old_gpu_resolution_scale = m_settings.gpu_resolution_scale;
const bool old_gpu_true_color = m_settings.gpu_true_color;
const bool old_gpu_texture_filtering = m_settings.gpu_texture_filtering;
const bool old_gpu_force_progressive_scan = m_settings.gpu_force_progressive_scan;
const bool old_vsync_enabled = m_settings.video_sync_enabled; const bool old_vsync_enabled = m_settings.video_sync_enabled;
const bool old_audio_sync_enabled = m_settings.audio_sync_enabled; const bool old_audio_sync_enabled = m_settings.audio_sync_enabled;
const bool old_speed_limiter_enabled = m_settings.speed_limiter_enabled; const bool old_speed_limiter_enabled = m_settings.speed_limiter_enabled;
@ -120,15 +124,22 @@ void QtHostInterface::applySettings()
m_settings.Load(si); m_settings.Load(si);
} }
// TODO: Fast path for hardware->software switches
if (m_settings.gpu_renderer != old_gpu_renderer)
switchGPURenderer();
if (m_settings.video_sync_enabled != old_vsync_enabled || m_settings.audio_sync_enabled != old_audio_sync_enabled || if (m_settings.video_sync_enabled != old_vsync_enabled || m_settings.audio_sync_enabled != old_audio_sync_enabled ||
m_settings.speed_limiter_enabled != old_speed_limiter_enabled) m_settings.speed_limiter_enabled != old_speed_limiter_enabled)
{ {
UpdateSpeedLimiterState(); UpdateSpeedLimiterState();
} }
// TODO: Fast path for hardware->software switches if (m_settings.gpu_resolution_scale != old_gpu_resolution_scale || m_settings.gpu_true_color != old_gpu_true_color ||
if (m_settings.gpu_renderer != old_gpu_renderer) m_settings.gpu_texture_filtering != old_gpu_texture_filtering ||
switchGPURenderer(); m_settings.gpu_force_progressive_scan != old_gpu_force_progressive_scan)
{
m_system->UpdateGPUSettings();
}
} }
void QtHostInterface::checkSettings() void QtHostInterface::checkSettings()