diff options
Diffstat (limited to 'src/gui/rhi/qrhid3d12.cpp')
-rw-r--r-- | src/gui/rhi/qrhid3d12.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/gui/rhi/qrhid3d12.cpp b/src/gui/rhi/qrhid3d12.cpp index 5846ea189d..a508a3c1fa 100644 --- a/src/gui/rhi/qrhid3d12.cpp +++ b/src/gui/rhi/qrhid3d12.cpp @@ -181,9 +181,20 @@ bool QRhiD3D12::create(QRhi::Flags flags) factoryFlags |= DXGI_CREATE_FACTORY_DEBUG; HRESULT hr = CreateDXGIFactory2(factoryFlags, __uuidof(IDXGIFactory2), reinterpret_cast<void **>(&dxgiFactory)); if (FAILED(hr)) { - qWarning("CreateDXGIFactory2() failed to create DXGI factory: %s", - qPrintable(QSystemError::windowsComString(hr))); - return false; + // retry without debug, if it was requested (to match D3D11 backend behavior) + if (debugLayer) { + qCDebug(QRHI_LOG_INFO, "Debug layer was requested but is not available. " + "Attempting to create DXGIFactory2 without it."); + factoryFlags &= ~DXGI_CREATE_FACTORY_DEBUG; + hr = CreateDXGIFactory2(factoryFlags, __uuidof(IDXGIFactory2), reinterpret_cast<void **>(&dxgiFactory)); + } + if (SUCCEEDED(hr)) { + debugLayer = false; + } else { + qWarning("CreateDXGIFactory2() failed to create DXGI factory: %s", + qPrintable(QSystemError::windowsComString(hr))); + return false; + } } supportsAllowTearing = false; |