From 5984f977ca0efd099ade48617871cac4b0baeece Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Thu, 9 Jul 2020 13:00:31 +1000 Subject: [PATCH] D3D11HostDisplay: Ensure we only get feature level 10-11 --- src/frontend-common/d3d11_host_display.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/frontend-common/d3d11_host_display.cpp b/src/frontend-common/d3d11_host_display.cpp index 5b2d82349..8753995a3 100644 --- a/src/frontend-common/d3d11_host_display.cpp +++ b/src/frontend-common/d3d11_host_display.cpp @@ -205,9 +205,13 @@ bool D3D11HostDisplay::CreateRenderDevice(const WindowInfo& wi, std::string_view if (FAILED(hr)) Log_WarningPrintf("Failed to enumerate adapter %u, using default", adapter_index); - hr = D3D11CreateDevice(dxgi_adapter.Get(), dxgi_adapter ? D3D_DRIVER_TYPE_UNKNOWN : D3D_DRIVER_TYPE_HARDWARE, nullptr, - create_flags, nullptr, 0, D3D11_SDK_VERSION, m_device.GetAddressOf(), nullptr, - m_context.GetAddressOf()); + static constexpr std::array requested_feature_levels = { + {D3D_FEATURE_LEVEL_10_0, D3D_FEATURE_LEVEL_10_1, D3D_FEATURE_LEVEL_11_0}}; + + hr = + D3D11CreateDevice(dxgi_adapter.Get(), dxgi_adapter ? D3D_DRIVER_TYPE_UNKNOWN : D3D_DRIVER_TYPE_HARDWARE, nullptr, + create_flags, requested_feature_levels.data(), static_cast(requested_feature_levels.size()), + D3D11_SDK_VERSION, m_device.GetAddressOf(), nullptr, m_context.GetAddressOf()); // we re-grab these later, see below dxgi_adapter.Reset();