diff options
| author | Stenzek <stenzek@gmail.com> | 2018-09-28 14:22:18 +1000 |
|---|---|---|
| committer | Stenzek <stenzek@gmail.com> | 2018-09-28 21:43:22 +1000 |
| commit | 93923e2b290febbcdccad225c81e57454d0f0b75 (patch) | |
| tree | 972474ecd9dd82a00ceb1a0edfd25da37ec38a86 /Source/Core/VideoCommon/VideoBackendBase.cpp | |
| parent | a877d5f6dc29e3559f1b64752906917f2e193d79 (diff) | |
Don't fill backend info when core is running
The current approach results in the UI thread creating a graphics device
whilst the core is running, leading to races on function pointers, and
potentially crashing.
Diffstat (limited to 'Source/Core/VideoCommon/VideoBackendBase.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/VideoBackendBase.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Source/Core/VideoCommon/VideoBackendBase.cpp b/Source/Core/VideoCommon/VideoBackendBase.cpp index 327064a4f2..0e413b2d3c 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 @@ -223,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) { |
