summaryrefslogtreecommitdiffstats
path: root/src/gui/rhi
diff options
context:
space:
mode:
authorOliver Dawes <olliedawes@gmail.com>2024-02-06 17:43:43 +0000
committerOliver Dawes <olliedawes@gmail.com>2024-02-08 14:40:04 +0000
commit95c20ffac3473f9188df363aebcb911589645806 (patch)
treecd4e2e6a231f6178d1609ccf13d16d9f0ce31b60 /src/gui/rhi
parent803d65dc125d91675e074fa798e88039ddf63cb4 (diff)
Initialize QRhiD3D12::activeAdapter for imported device path
This commit makes it so the QRhiD3D12::activeAdapter is set when using an imported device. QD3D12MemoryAllocator::create would crash before as it would attempt to call IDXGIAdapter1::GetDesc1 on the passed uninitalized pointer. With this change using an imported device with the d3d12 rhi backend will no longer crash the application. Fixes: QTBUG-122007 Pick-to: 6.7 6.6 Change-Id: Iadc67fee0c7ee70ac904f66a523acd3b1a63e42b Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'src/gui/rhi')
-rw-r--r--src/gui/rhi/qrhid3d12.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/gui/rhi/qrhid3d12.cpp b/src/gui/rhi/qrhid3d12.cpp
index f06d64a2ff..881f769710 100644
--- a/src/gui/rhi/qrhid3d12.cpp
+++ b/src/gui/rhi/qrhid3d12.cpp
@@ -292,14 +292,20 @@ bool QRhiD3D12::create(QRhi::Flags flags)
for (int adapterIndex = 0; dxgiFactory->EnumAdapters1(UINT(adapterIndex), &adapter) != DXGI_ERROR_NOT_FOUND; ++adapterIndex) {
DXGI_ADAPTER_DESC1 desc;
adapter->GetDesc1(&desc);
- adapter->Release();
if (desc.AdapterLuid.LowPart == adapterLuid.LowPart
&& desc.AdapterLuid.HighPart == adapterLuid.HighPart)
{
+ activeAdapter = adapter;
QRhiD3D::fillDriverInfo(&driverInfoStruct, desc);
break;
+ } else {
+ adapter->Release();
}
}
+ if (!activeAdapter) {
+ qWarning("No adapter");
+ return false;
+ }
qCDebug(QRHI_LOG_INFO, "Using imported device %p", dev);
}