winrt: Fix crash in debug mode

In debug mode we try to set the D3D11_CREATE_DEVICE_DEBUG flag to gather
additional information for debugging purposes. However, some devices do
not provide those and the D3D11CreateDevice call fails.

Instead, try to create a hardware non-debug device first before going
into the last software-mode fallback.

Task-number: QTBUG-49488
Change-Id: I2d91b5f54f7fd818103bd106314b8503e5759159
Reviewed-by: Samuel Nevala <samuel.nevala@intopalo.com>
Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
This commit is contained in:
Maurice Kalinowski
2016-01-12 15:13:08 +01:00
committed by Yoann Lopes
parent f69a051675
commit 752c1f0077

View File

@@ -86,6 +86,14 @@ struct QWinRTVideoRendererControlGlobal
hr = D3D11CreateDevice(NULL, D3D_DRIVER_TYPE_HARDWARE, NULL, flags,
featureLevels, ARRAYSIZE(featureLevels), D3D11_SDK_VERSION,
&device, &featureLevel, &context);
#ifdef _DEBUG
if (FAILED(hr)) {
qErrnoWarning(hr, "Failed to create D3D device with device debug flag");
hr = D3D11CreateDevice(NULL, D3D_DRIVER_TYPE_HARDWARE, NULL, D3D11_CREATE_DEVICE_VIDEO_SUPPORT,
featureLevels, ARRAYSIZE(featureLevels), D3D11_SDK_VERSION,
&device, &featureLevel, &context);
}
#endif
if (FAILED(hr))
qErrnoWarning(hr, "Failed to create D3D device");