diff options
| author | Mat M <mathew1800@gmail.com> | 2018-10-12 10:29:28 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-10-12 10:29:28 -0400 |
| commit | ecd4897d43e115dbc00534fe74a5cc9d2c3a0fed (patch) | |
| tree | a2a879c0df72ce242ec69b51405426d2b52f3bc5 /Source/Core/VideoCommon/VideoBackendBase.cpp | |
| parent | 7ac90b55d6263b1369defcdcc85af290add87d9a (diff) | |
| parent | 349765ba77df11a9d5eeac424ac87e0047c7f0b3 (diff) | |
Merge pull request #7437 from stenzek/graphics-options-race
Fix race condition caused by opening graphics options while running
Diffstat (limited to 'Source/Core/VideoCommon/VideoBackendBase.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/VideoBackendBase.cpp | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/Source/Core/VideoCommon/VideoBackendBase.cpp b/Source/Core/VideoCommon/VideoBackendBase.cpp index 77ffb294ff..725857a85d 100644 --- a/Source/Core/VideoCommon/VideoBackendBase.cpp +++ b/Source/Core/VideoCommon/VideoBackendBase.cpp @@ -14,6 +14,8 @@ #include "Common/CommonTypes.h" #include "Common/Event.h" #include "Common/Logging/Log.h" +#include "Core/ConfigManager.h" +#include "Core/Core.h" #include "Core/Host.h" // TODO: ugly @@ -60,14 +62,6 @@ __declspec(dllexport) DWORD NvOptimusEnablement = 1; } #endif -void VideoBackendBase::ShowConfig(void* parent_handle) -{ - if (!m_initialized) - InitBackendInfo(); - - Host_ShowVideoConfig(parent_handle, GetDisplayName()); -} - void VideoBackendBase::Video_ExitLoop() { Fifo::ExitGpuLoop(); @@ -231,6 +225,20 @@ void VideoBackendBase::ActivateBackend(const std::string& name) g_video_backend = iter->get(); } +void VideoBackendBase::PopulateBackendInfo() +{ + // If the core is running, the backend info will have been populated already. + // If we did it here, the UI thread can race with the with the GPU thread. + if (Core::IsRunning()) + return; + + // 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. + ActivateBackend(SConfig::GetInstance().m_strVideoBackend); + g_video_backend->InitBackendInfo(); + g_Config.Refresh(); +} + // Run from the CPU thread void VideoBackendBase::DoState(PointerWrap& p) { @@ -294,7 +302,6 @@ void VideoBackendBase::InitializeShared() GeometryShaderManager::Init(); PixelShaderManager::Init(); - g_Config.Refresh(); UpdateActiveConfig(); } |
