diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2020-05-07 20:28:27 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2020-05-12 14:49:55 +0200 |
commit | 4edcf3ddb8a79095cc527d671bcbee0d318c7293 (patch) | |
tree | f4374b1481e79234607d46b94e457d8d3085c11b /src/gui/rhi/qrhid3d11.cpp | |
parent | 286d79d2ed6ed6627fad806954576a639ed0b95b (diff) |
rhi: d3d11: Handle DXGI_ERROR_SDK_COMPONENT_MISSING gracefully
Requesting the debug layer is not something that succeeds at run time if
the corresponding SDK component is not present. Handle it gracefully:
simply retry D3D11CreateDevice without the debug device flag.
Relevant also for the Qt CI's Windows 10 VMs.
Task-number: QTBUG-84067
Change-Id: Ia7b2562917ec11ce04a75c052527bf526d1fe81b
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
Diffstat (limited to 'src/gui/rhi/qrhid3d11.cpp')
-rw-r--r-- | src/gui/rhi/qrhid3d11.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/gui/rhi/qrhid3d11.cpp b/src/gui/rhi/qrhid3d11.cpp index 05ee415502..2f7974944c 100644 --- a/src/gui/rhi/qrhid3d11.cpp +++ b/src/gui/rhi/qrhid3d11.cpp @@ -264,6 +264,15 @@ bool QRhiD3D11::create(QRhi::Flags flags) HRESULT hr = D3D11CreateDevice(adapterToUse, D3D_DRIVER_TYPE_UNKNOWN, nullptr, devFlags, nullptr, 0, D3D11_SDK_VERSION, &dev, &featureLevel, &ctx); + // We cannot assume that D3D11_CREATE_DEVICE_DEBUG is always available. Retry without it, if needed. + if (hr == DXGI_ERROR_SDK_COMPONENT_MISSING && debugLayer) { + qCDebug(QRHI_LOG_INFO, "Debug layer was requested but is not available. " + "Attempting to create D3D11 device without it."); + devFlags &= ~D3D11_CREATE_DEVICE_DEBUG; + hr = D3D11CreateDevice(adapterToUse, D3D_DRIVER_TYPE_UNKNOWN, nullptr, devFlags, + nullptr, 0, D3D11_SDK_VERSION, + &dev, &featureLevel, &ctx); + } adapterToUse->Release(); if (FAILED(hr)) { qWarning("Failed to create D3D11 device and context: %s", qPrintable(comErrorMessage(hr))); |