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. Change-Id: Ie4ba22ff9f2a2f6882dd2d5e3063c4e6701fa95c Reviewed-by: Andy Nichols <andy.nichols@qt.io> (cherry picked from commit 35dd681f2ba00e7196e59309d76f920ad8807205) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
e6a294a69b
commit
8121b39921
@ -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;
|
||||
@ -273,7 +275,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);
|
||||
@ -391,6 +392,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;
|
||||
@ -282,7 +284,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