rhi: d3d11: Check ConstantBufferOffsetting in feature data

This is an additional attempt to have more "smoke testing" in
place for systems where there is no real 11_1 level driver
present. (we already test for Shader Model 5.0 above, now
also check this 11.1 feature indicating that
VSSetConstantBuffers1 is actually implemented)

This probing is important in particular for Qt Quick, where
there is an automatic retry with the software (WARP) adapter
when the initial QRhi::create() returns false.

This may or may not help the virtual machine case in the
associated issue, but is a valid check regardless since
we absolutely require constant buffer offsetting.

Task-number: QTBUG-78648
Pick-to: 6.5 6.4 6.2
Change-Id: I4d3c7b5c6c1f2b04b16c84b42c92651a3e671617
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
This commit is contained in:
Laszlo Agocs 2023-04-03 11:57:36 +02:00
parent 2f95cd8f8b
commit 95198e7ad5

View File

@ -278,6 +278,20 @@ bool QRhiD3D11::create(QRhi::Flags flags)
qWarning("ID3D11DeviceContext1 not supported"); qWarning("ID3D11DeviceContext1 not supported");
return false; return false;
} }
D3D11_FEATURE_DATA_D3D11_OPTIONS features = {};
if (SUCCEEDED(dev->CheckFeatureSupport(D3D11_FEATURE_D3D11_OPTIONS, &features, sizeof(features)))) {
// The D3D _runtime_ may be 11.1, but the underlying _driver_ may
// still not support this D3D_FEATURE_LEVEL_11_1 feature. (e.g.
// because it only does 11_0)
if (!features.ConstantBufferOffsetting) {
qWarning("Constant buffer offsetting is not supported by the driver");
return false;
}
} else {
qWarning("Failed to query D3D11_FEATURE_D3D11_OPTIONS");
return false;
}
} else { } else {
Q_ASSERT(dev && context); Q_ASSERT(dev && context);
featureLevel = dev->GetFeatureLevel(); featureLevel = dev->GetFeatureLevel();