From 77a318789a17fcee924125eef5575907ef3faf10 Mon Sep 17 00:00:00 2001 From: Jules Blok Date: Mon, 10 Jul 2017 01:02:29 +0200 Subject: [PATCH] D3DBase: Implement Windows 7 swapchain fallback. --- Source/Core/VideoBackends/D3D/D3DBase.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/Source/Core/VideoBackends/D3D/D3DBase.cpp b/Source/Core/VideoBackends/D3D/D3DBase.cpp index 6fa2e7f832..36c09b4694 100644 --- a/Source/Core/VideoBackends/D3D/D3DBase.cpp +++ b/Source/Core/VideoBackends/D3D/D3DBase.cpp @@ -317,10 +317,6 @@ HRESULT Create(HWND wnd) supported_feature_levels, NUM_SUPPORTED_FEATURE_LEVELS, D3D11_SDK_VERSION, &device, &featlevel, &context); - if (SUCCEEDED(hr)) - hr = factory->CreateSwapChainForHwnd(device, hWnd, &swap_chain_desc, nullptr, nullptr, - &swapchain); - // Debugbreak on D3D error if (SUCCEEDED(hr) && SUCCEEDED(device->QueryInterface(__uuidof(ID3D11Debug), (void**)&debug))) { @@ -348,10 +344,21 @@ HRESULT Create(HWND wnd) D3D11_CREATE_DEVICE_SINGLETHREADED, supported_feature_levels, NUM_SUPPORTED_FEATURE_LEVELS, D3D11_SDK_VERSION, &device, &featlevel, &context); + } - if (SUCCEEDED(hr)) + if (SUCCEEDED(hr)) + { + hr = factory->CreateSwapChainForHwnd(device, hWnd, &swap_chain_desc, nullptr, nullptr, + &swapchain); + if (FAILED(hr)) + { + // Some swapchain features aren't supported on Windows 7, so here we fall back to legacy + // swapchain features + swap_chain_desc.Stereo = FALSE; + swap_chain_desc.SwapEffect = DXGI_SWAP_EFFECT_SEQUENTIAL; hr = factory->CreateSwapChainForHwnd(device, hWnd, &swap_chain_desc, nullptr, nullptr, &swapchain); + } } if (FAILED(hr))