D3D11Device: Ensure we don't drop to feature level 10 on query failure
This commit is contained in:
parent
886ef4cc59
commit
c461ad7b44
|
@ -96,6 +96,9 @@ bool D3D11Device::CreateDeviceAndMainSwapChain(std::string_view adapter, Feature
|
|||
return false;
|
||||
}
|
||||
|
||||
// just in case the max query failed, apparently happens for some people...
|
||||
m_max_feature_level = std::max(m_max_feature_level, m_device->GetFeatureLevel());
|
||||
|
||||
// we re-grab these later, see below
|
||||
dxgi_adapter.Reset();
|
||||
temp_context.Reset();
|
||||
|
|
|
@ -99,12 +99,15 @@ D3D_FEATURE_LEVEL D3DCommon::GetDeviceMaxFeatureLevel(IDXGIAdapter1* adapter)
|
|||
D3D_FEATURE_LEVEL_12_2, D3D_FEATURE_LEVEL_12_1, D3D_FEATURE_LEVEL_12_0, D3D_FEATURE_LEVEL_11_1,
|
||||
D3D_FEATURE_LEVEL_11_0, D3D_FEATURE_LEVEL_10_1, D3D_FEATURE_LEVEL_10_0};
|
||||
|
||||
D3D_FEATURE_LEVEL max_supported_level = requested_feature_levels.back();
|
||||
D3D_FEATURE_LEVEL max_supported_level;
|
||||
HRESULT hr = D3D11CreateDevice(adapter, adapter ? D3D_DRIVER_TYPE_UNKNOWN : D3D_DRIVER_TYPE_HARDWARE, nullptr, 0,
|
||||
requested_feature_levels.data(), static_cast<UINT>(requested_feature_levels.size()),
|
||||
D3D11_SDK_VERSION, nullptr, &max_supported_level, nullptr);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
WARNING_LOG("D3D11CreateDevice() for getting max feature level failed: 0x{:08X}", static_cast<unsigned>(hr));
|
||||
max_supported_level = requested_feature_levels.back();
|
||||
}
|
||||
|
||||
return max_supported_level;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue