From 29a5ac5d803b48bb530939a11e4e39c47941ad00 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Sun, 24 Jul 2022 17:43:56 +1000 Subject: [PATCH] D3DHostDisplay: Fix starting in exclusive fullscreen --- src/frontend-common/d3d11_host_display.cpp | 10 +++++++--- src/frontend-common/d3d12_host_display.cpp | 10 +++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/frontend-common/d3d11_host_display.cpp b/src/frontend-common/d3d11_host_display.cpp index 36589808f..e1c77757b 100644 --- a/src/frontend-common/d3d11_host_display.cpp +++ b/src/frontend-common/d3d11_host_display.cpp @@ -354,15 +354,19 @@ bool D3D11HostDisplay::CreateRenderDevice(const WindowInfo& wi, std::string_view } m_window_info = wi; + + if (m_window_info.type != WindowInfo::Type::Surfaceless && !CreateSwapChain(nullptr)) + { + m_window_info = {}; + return false; + } + return true; } bool D3D11HostDisplay::InitializeRenderDevice(std::string_view shader_cache_directory, bool debug_device, bool threaded_presentation) { - if (m_window_info.type != WindowInfo::Type::Surfaceless && !CreateSwapChain(nullptr)) - return false; - if (!CreateResources()) return false; diff --git a/src/frontend-common/d3d12_host_display.cpp b/src/frontend-common/d3d12_host_display.cpp index f8c4f1ddf..e16a0a904 100644 --- a/src/frontend-common/d3d12_host_display.cpp +++ b/src/frontend-common/d3d12_host_display.cpp @@ -255,15 +255,19 @@ bool D3D12HostDisplay::CreateRenderDevice(const WindowInfo& wi, std::string_view } m_window_info = wi; + + if (m_window_info.type != WindowInfo::Type::Surfaceless && !CreateSwapChain(nullptr)) + { + m_window_info = {}; + return false; + } + return true; } bool D3D12HostDisplay::InitializeRenderDevice(std::string_view shader_cache_directory, bool debug_device, bool threaded_presentation) { - if (m_window_info.type != WindowInfo::Type::Surfaceless && !CreateSwapChain(nullptr)) - return false; - if (!CreateResources()) return false;