Merge pull request #10669 from Pokechu22/adapter-change-aa-mode-list-reload

Fix antialiasing modes being determined from the wrong graphics adapter
This commit is contained in:
Pokechu22 2022-05-19 13:13:22 -07:00 committed by GitHub
commit 8baeb75bd2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 7 deletions

View File

@ -142,9 +142,10 @@ void GeneralWidget::ConnectWidgets()
// Video Backend // Video Backend
connect(m_backend_combo, qOverload<int>(&QComboBox::currentIndexChanged), this, connect(m_backend_combo, qOverload<int>(&QComboBox::currentIndexChanged), this,
&GeneralWidget::SaveSettings); &GeneralWidget::SaveSettings);
connect(m_adapter_combo, qOverload<int>(&QComboBox::currentIndexChanged), this, [](int index) { connect(m_adapter_combo, qOverload<int>(&QComboBox::currentIndexChanged), this, [&](int index) {
g_Config.iAdapter = index; g_Config.iAdapter = index;
Config::SetBaseOrCurrent(Config::GFX_ADAPTER, index); Config::SetBaseOrCurrent(Config::GFX_ADAPTER, index);
emit BackendChanged(QString::fromStdString(Config::Get(Config::MAIN_GFX_BACKEND)));
}); });
} }

View File

@ -272,11 +272,12 @@ void VideoBackendBase::ActivateBackend(const std::string& name)
void VideoBackendBase::PopulateBackendInfo() void VideoBackendBase::PopulateBackendInfo()
{ {
// We refresh the config after initializing the backend info, as system-specific settings g_Config.Refresh();
// such as anti-aliasing, or the selected adapter may be invalid, and should be checked.
ActivateBackend(Config::Get(Config::MAIN_GFX_BACKEND)); ActivateBackend(Config::Get(Config::MAIN_GFX_BACKEND));
g_video_backend->InitBackendInfo(); 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() void VideoBackendBase::PopulateBackendInfoFromUI()

View File

@ -44,7 +44,12 @@ void VideoConfig::Refresh()
// invalid values. Instead, pause emulation first, which will flush the video thread, // 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 // update the config and correct it, then resume emulation, after which the video
// thread will detect the config has changed and act accordingly. // 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; s_has_registered_callback = true;
} }
@ -140,8 +145,6 @@ void VideoConfig::Refresh()
bFastTextureSampling = Config::Get(Config::GFX_HACK_FAST_TEXTURE_SAMPLING); bFastTextureSampling = Config::Get(Config::GFX_HACK_FAST_TEXTURE_SAMPLING);
bPerfQueriesEnable = Config::Get(Config::GFX_PERF_QUERIES_ENABLE); bPerfQueriesEnable = Config::Get(Config::GFX_PERF_QUERIES_ENABLE);
VerifyValidity();
} }
void VideoConfig::VerifyValidity() void VideoConfig::VerifyValidity()