rhi: d3d11: Add activeAdapter null check
...to match 6.8 that has this added as part of a backport. The D3D12 backend has this already. Still, move the resetting of the variable to the outer scope in that one too, to cover both code paths. Pick-to: 6.9 Change-Id: Ie4ba22ff9f2a2f6882dd2d5e3063c4e6701fa95c Reviewed-by: Andy Nichols <andy.nichols@qt.io>
This commit is contained in:
parent
f2437c9d8c
commit
35dd681f2b
@ -240,6 +240,8 @@ bool QRhiD3D11::create(QRhi::Flags flags)
|
||||
if (maxFrameLatency == 0)
|
||||
qCDebug(QRHI_LOG_INFO, "Disabling FRAME_LATENCY_WAITABLE_OBJECT usage");
|
||||
|
||||
activeAdapter = nullptr;
|
||||
|
||||
if (!importedDeviceAndContext) {
|
||||
IDXGIAdapter1 *adapter;
|
||||
int requestedAdapterIndex = -1;
|
||||
@ -276,7 +278,6 @@ bool QRhiD3D11::create(QRhi::Flags flags)
|
||||
}
|
||||
}
|
||||
|
||||
activeAdapter = nullptr;
|
||||
for (int adapterIndex = 0; dxgiFactory->EnumAdapters1(UINT(adapterIndex), &adapter) != DXGI_ERROR_NOT_FOUND; ++adapterIndex) {
|
||||
DXGI_ADAPTER_DESC1 desc;
|
||||
adapter->GetDesc1(&desc);
|
||||
@ -394,6 +395,10 @@ bool QRhiD3D11::create(QRhi::Flags flags)
|
||||
}
|
||||
dxgiDev->Release();
|
||||
}
|
||||
if (!activeAdapter) {
|
||||
qWarning("Failed to query adapter from imported device");
|
||||
return false;
|
||||
}
|
||||
qCDebug(QRHI_LOG_INFO, "Using imported device %p", dev);
|
||||
}
|
||||
|
||||
|
@ -249,6 +249,8 @@ bool QRhiD3D12::create(QRhi::Flags flags)
|
||||
}
|
||||
}
|
||||
|
||||
activeAdapter = nullptr;
|
||||
|
||||
if (!importedDevice) {
|
||||
IDXGIAdapter1 *adapter;
|
||||
int requestedAdapterIndex = -1;
|
||||
@ -285,7 +287,6 @@ bool QRhiD3D12::create(QRhi::Flags flags)
|
||||
}
|
||||
}
|
||||
|
||||
activeAdapter = nullptr;
|
||||
for (int adapterIndex = 0; dxgiFactory->EnumAdapters1(UINT(adapterIndex), &adapter) != DXGI_ERROR_NOT_FOUND; ++adapterIndex) {
|
||||
DXGI_ADAPTER_DESC1 desc;
|
||||
adapter->GetDesc1(&desc);
|
||||
|
Loading…
x
Reference in New Issue
Block a user