rhi: d3d11: Fix not setting activeAdapter when importing

This was added as part of other work in 6.9. Create a dedicated
backport for 6.8.

Fixes: QTBUG-135112
Change-Id: I5eeb9b2ce2210116fa2a445fdaab7c5cab2d5328
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
This commit is contained in:
Laszlo Agocs 2025-03-25 10:22:48 +01:00
parent e937243e4f
commit 8105f7b9e9

View File

@ -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);
@ -385,12 +386,16 @@ bool QRhiD3D11::create(QRhi::Flags flags)
adapter1->GetDesc1(&desc);
adapterLuid = desc.AdapterLuid;
QRhiD3D::fillDriverInfo(&driverInfoStruct, desc);
adapter1->Release();
activeAdapter = adapter1;
}
adapter->Release();
}
dxgiDev->Release();
}
if (!activeAdapter) {
qWarning("Failed to query adapter from imported device");
return false;
}
qCDebug(QRHI_LOG_INFO, "Using imported device %p", dev);
}