diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2016-07-18 11:17:37 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2016-07-19 06:51:14 +0000 |
commit | a0dd7400904166c67279e9d08076221e51fc0454 (patch) | |
tree | ff0c92a195cc5298468bae572bdcf30d281dcbaa /src/plugins | |
parent | b845b6560df7c70a811d1ff361cbf52f0ec5cd59 (diff) |
D3D12: Show a warning when the requested adapter is not usable
Change-Id: I3cbc4bf45b22f8bf772163be24ca4c9ccb63fcad
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/scenegraph/d3d12/qsgd3d12engine.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12engine.cpp b/src/plugins/scenegraph/d3d12/qsgd3d12engine.cpp index d19dfe2db8..fbb294f1e9 100644 --- a/src/plugins/scenegraph/d3d12/qsgd3d12engine.cpp +++ b/src/plugins/scenegraph/d3d12/qsgd3d12engine.cpp @@ -197,13 +197,17 @@ static void getHardwareAdapter(IDXGIFactory1 *factory, IDXGIAdapter1 **outAdapte if (qEnvironmentVariableIsSet("QT_D3D_ADAPTER_INDEX")) { const int adapterIndex = qEnvironmentVariableIntValue("QT_D3D_ADAPTER_INDEX"); - if (SUCCEEDED(factory->EnumAdapters1(adapterIndex, &adapter)) - && SUCCEEDED(D3D12CreateDevice(adapter.Get(), fl, _uuidof(ID3D12Device), nullptr))) { + if (SUCCEEDED(factory->EnumAdapters1(adapterIndex, &adapter))) { adapter->GetDesc1(&desc); const QString name = QString::fromUtf16((char16_t *) desc.Description); - qCDebug(QSG_LOG_INFO, "Using requested adapter '%s'", qPrintable(name)); - *outAdapter = adapter.Detach(); - return; + HRESULT hr = D3D12CreateDevice(adapter.Get(), fl, _uuidof(ID3D12Device), nullptr); + if (SUCCEEDED(hr)) { + qCDebug(QSG_LOG_INFO, "Using requested adapter '%s'", qPrintable(name)); + *outAdapter = adapter.Detach(); + return; + } else { + qWarning("Failed to create device for requested adapter '%s': 0x%x", qPrintable(name), hr); + } } } |