From eb33d7af6420ceb78b36c84cb82ac5a34faf58c1 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Fri, 28 Sep 2018 17:53:55 +1000 Subject: [PATCH] Core: Call InitBackendInfo before loading config --- Source/Core/Core/Core.cpp | 7 +++++++ Source/Core/VideoBackends/D3D/main.cpp | 1 - Source/Core/VideoBackends/Null/NullBackend.cpp | 1 - Source/Core/VideoBackends/OGL/main.cpp | 1 - Source/Core/VideoBackends/Software/SWmain.cpp | 1 - Source/Core/VideoCommon/VideoBackendBase.cpp | 1 - 6 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Source/Core/Core/Core.cpp b/Source/Core/Core/Core.cpp index 7ec7f6c634..7ebb070d2b 100644 --- a/Source/Core/Core/Core.cpp +++ b/Source/Core/Core/Core.cpp @@ -74,6 +74,7 @@ #include "VideoCommon/OnScreenDisplay.h" #include "VideoCommon/RenderBase.h" #include "VideoCommon/VideoBackendBase.h" +#include "VideoCommon/VideoConfig.h" namespace Core { @@ -434,6 +435,12 @@ static void EmuThread(std::unique_ptr boot) HLE::Clear(); }}; + // Backend info has to be initialized before we can initialize the backend. + // This is because when we load the config, we validate it against the current backend info. + // We also should have the correct adapter selected for creating the device in Initialize(). + g_video_backend->InitBackendInfo(); + g_Config.Refresh(); + if (!g_video_backend->Initialize(s_window_handle)) { PanicAlert("Failed to initialize video backend!"); diff --git a/Source/Core/VideoBackends/D3D/main.cpp b/Source/Core/VideoBackends/D3D/main.cpp index f2299945cc..69b6f47804 100644 --- a/Source/Core/VideoBackends/D3D/main.cpp +++ b/Source/Core/VideoBackends/D3D/main.cpp @@ -132,7 +132,6 @@ bool VideoBackend::Initialize(void* window_handle) if (window_handle == nullptr) return false; - InitBackendInfo(); InitializeShared(); if (FAILED(D3D::Create(reinterpret_cast(window_handle)))) diff --git a/Source/Core/VideoBackends/Null/NullBackend.cpp b/Source/Core/VideoBackends/Null/NullBackend.cpp index fa32ce0cf5..f3743773c5 100644 --- a/Source/Core/VideoBackends/Null/NullBackend.cpp +++ b/Source/Core/VideoBackends/Null/NullBackend.cpp @@ -57,7 +57,6 @@ void VideoBackend::InitBackendInfo() bool VideoBackend::Initialize(void* window_handle) { InitializeShared(); - InitBackendInfo(); g_renderer = std::make_unique(); g_vertex_manager = std::make_unique(); diff --git a/Source/Core/VideoBackends/OGL/main.cpp b/Source/Core/VideoBackends/OGL/main.cpp index 52d643543f..d2e37f07a9 100644 --- a/Source/Core/VideoBackends/OGL/main.cpp +++ b/Source/Core/VideoBackends/OGL/main.cpp @@ -159,7 +159,6 @@ bool VideoBackend::FillBackendInfo() bool VideoBackend::Initialize(void* window_handle) { - InitBackendInfo(); InitializeShared(); GLUtil::InitInterface(); diff --git a/Source/Core/VideoBackends/Software/SWmain.cpp b/Source/Core/VideoBackends/Software/SWmain.cpp index 546cf0a45c..6ca183b57c 100644 --- a/Source/Core/VideoBackends/Software/SWmain.cpp +++ b/Source/Core/VideoBackends/Software/SWmain.cpp @@ -80,7 +80,6 @@ void VideoSoftware::InitBackendInfo() bool VideoSoftware::Initialize(void* window_handle) { - InitBackendInfo(); InitializeShared(); SWOGLWindow::Init(window_handle); diff --git a/Source/Core/VideoCommon/VideoBackendBase.cpp b/Source/Core/VideoCommon/VideoBackendBase.cpp index 0e413b2d3c..725857a85d 100644 --- a/Source/Core/VideoCommon/VideoBackendBase.cpp +++ b/Source/Core/VideoCommon/VideoBackendBase.cpp @@ -302,7 +302,6 @@ void VideoBackendBase::InitializeShared() GeometryShaderManager::Init(); PixelShaderManager::Init(); - g_Config.Refresh(); UpdateActiveConfig(); }