From 3950bc4620b659b4ba902a8d8d979dae801b5bd4 Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Mon, 16 May 2022 16:28:18 -0700 Subject: [PATCH 1/2] Treat changing the graphics adapter the same as changing the backend This results in the list of available antialiasing modes being updated; before, it would only show the modes available for the adapter that was selected when the graphics window was opened (or the backend was last changed). The list of available modes is updated by `GraphicsWindow::OnBackendChanged`'s call to `VideoBackendBase::PopulateBackendInfoFromUI`, and then `EnhancementsWidget::LoadSettings` updates the UI. Both of these are connected to the `GraphicsWindow::BackendChanged` signal. --- Source/Core/DolphinQt/Config/Graphics/GeneralWidget.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/Core/DolphinQt/Config/Graphics/GeneralWidget.cpp b/Source/Core/DolphinQt/Config/Graphics/GeneralWidget.cpp index 8baa89db01..0353a69eea 100644 --- a/Source/Core/DolphinQt/Config/Graphics/GeneralWidget.cpp +++ b/Source/Core/DolphinQt/Config/Graphics/GeneralWidget.cpp @@ -142,9 +142,10 @@ void GeneralWidget::ConnectWidgets() // Video Backend connect(m_backend_combo, qOverload(&QComboBox::currentIndexChanged), this, &GeneralWidget::SaveSettings); - connect(m_adapter_combo, qOverload(&QComboBox::currentIndexChanged), this, [](int index) { + connect(m_adapter_combo, qOverload(&QComboBox::currentIndexChanged), this, [&](int index) { g_Config.iAdapter = index; Config::SetBaseOrCurrent(Config::GFX_ADAPTER, index); + emit BackendChanged(QString::fromStdString(Config::Get(Config::MAIN_GFX_BACKEND))); }); } From 3949698acf4637412c4b52fac07bc1c9b32665c5 Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Mon, 16 May 2022 16:59:23 -0700 Subject: [PATCH 2/2] Verify graphics config validity after populating the backend info ... and refresh the config before populating the backend info, as the config (specifically iAdapter) needs to be set to correctly populate the backend info. Before, the list of valid antialiasing modes was always determined from the first adapter on the list on startup, regardless of the adapter the user selected. --- Source/Core/VideoCommon/VideoBackendBase.cpp | 7 ++++--- Source/Core/VideoCommon/VideoConfig.cpp | 9 ++++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Source/Core/VideoCommon/VideoBackendBase.cpp b/Source/Core/VideoCommon/VideoBackendBase.cpp index 78e4c7c15d..7136545c25 100644 --- a/Source/Core/VideoCommon/VideoBackendBase.cpp +++ b/Source/Core/VideoCommon/VideoBackendBase.cpp @@ -272,11 +272,12 @@ void VideoBackendBase::ActivateBackend(const std::string& name) void VideoBackendBase::PopulateBackendInfo() { - // We refresh the config after initializing the backend info, as system-specific settings - // such as anti-aliasing, or the selected adapter may be invalid, and should be checked. + g_Config.Refresh(); ActivateBackend(Config::Get(Config::MAIN_GFX_BACKEND)); g_video_backend->InitBackendInfo(); - g_Config.Refresh(); + // We validate the config after initializing the backend info, as system-specific settings + // such as anti-aliasing, or the selected adapter may be invalid, and should be checked. + g_Config.VerifyValidity(); } void VideoBackendBase::PopulateBackendInfoFromUI() diff --git a/Source/Core/VideoCommon/VideoConfig.cpp b/Source/Core/VideoCommon/VideoConfig.cpp index 6d8cd7ff29..58893c9267 100644 --- a/Source/Core/VideoCommon/VideoConfig.cpp +++ b/Source/Core/VideoCommon/VideoConfig.cpp @@ -44,7 +44,12 @@ void VideoConfig::Refresh() // invalid values. Instead, pause emulation first, which will flush the video thread, // update the config and correct it, then resume emulation, after which the video // thread will detect the config has changed and act accordingly. - Config::AddConfigChangedCallback([]() { Core::RunAsCPUThread([]() { g_Config.Refresh(); }); }); + Config::AddConfigChangedCallback([]() { + Core::RunAsCPUThread([]() { + g_Config.Refresh(); + g_Config.VerifyValidity(); + }); + }); s_has_registered_callback = true; } @@ -140,8 +145,6 @@ void VideoConfig::Refresh() bFastTextureSampling = Config::Get(Config::GFX_HACK_FAST_TEXTURE_SAMPLING); bPerfQueriesEnable = Config::Get(Config::GFX_PERF_QUERIES_ENABLE); - - VerifyValidity(); } void VideoConfig::VerifyValidity()