summaryrefslogtreecommitdiffstats
path: root/src/gui/rhi/qrhid3d11.cpp
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2023-10-09 16:10:07 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2023-11-08 14:15:18 +0000
commit92167f0119b8fda6db06c0191e248b30e1360d68 (patch)
tree865ea7160a59973b4533bbaf742e205e06100888 /src/gui/rhi/qrhid3d11.cpp
parentbbeff2a3350dd3396400865525d509b784c2d93e (diff)
rhi: Add a flag to suppress D3D11 smoke test warnings
Applicable to D3D11 only, although the flag is general enough that other backends could use it if it made sense for them. This allows Qt Quick to state that warnings about QRhi::create() failures that lead to retrying with a different set of flags (PreferSoftwareRenderer to get to use the WARP software rasterizer) should be suppressed and turned to regular categorized debug prints. Other users, e.g. an application directly working with QRhi may not want this. A create() failure must be complemented by an unconditional qWarning since normally that is pretty serious error. Hence the opt-in flag. Task-number: QTBUG-117926 Change-Id: I808bd1670b631e2068b566ab08589e1783f62ca5 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'src/gui/rhi/qrhid3d11.cpp')
-rw-r--r--src/gui/rhi/qrhid3d11.cpp33
1 files changed, 22 insertions, 11 deletions
diff --git a/src/gui/rhi/qrhid3d11.cpp b/src/gui/rhi/qrhid3d11.cpp
index 4dcda25d18..d357a6b2db 100644
--- a/src/gui/rhi/qrhid3d11.cpp
+++ b/src/gui/rhi/qrhid3d11.cpp
@@ -291,21 +291,24 @@ bool QRhiD3D11::create(QRhi::Flags flags)
return false;
}
+ const bool supports11_1 = SUCCEEDED(ctx->QueryInterface(__uuidof(ID3D11DeviceContext1), reinterpret_cast<void **>(&context)));
+ ctx->Release();
+ if (!supports11_1) {
+ qWarning("ID3D11DeviceContext1 not supported");
+ return false;
+ }
+
// Test if creating a Shader Model 5.0 vertex shader works; we want to
// fail already in create() if that's not the case.
ID3D11VertexShader *testShader = nullptr;
if (SUCCEEDED(dev->CreateVertexShader(g_testVertexShader, sizeof(g_testVertexShader), nullptr, &testShader))) {
testShader->Release();
} else {
- qWarning("D3D11 smoke test failed (failed to create vertex shader)");
- ctx->Release();
- return false;
- }
-
- const bool supports11_1 = SUCCEEDED(ctx->QueryInterface(__uuidof(ID3D11DeviceContext1), reinterpret_cast<void **>(&context)));
- ctx->Release();
- if (!supports11_1) {
- qWarning("ID3D11DeviceContext1 not supported");
+ static const char *msg = "D3D11 smoke test: Failed to create vertex shader";
+ if (flags.testFlag(QRhi::SuppressSmokeTestWarnings))
+ qCDebug(QRHI_LOG_INFO, "%s", msg);
+ else
+ qWarning("%s", msg);
return false;
}
@@ -315,11 +318,19 @@ bool QRhiD3D11::create(QRhi::Flags flags)
// 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");
+ static const char *msg = "D3D11 smoke test: Constant buffer offsetting is not supported by the driver";
+ if (flags.testFlag(QRhi::SuppressSmokeTestWarnings))
+ qCDebug(QRHI_LOG_INFO, "%s", msg);
+ else
+ qWarning("%s", msg);
return false;
}
} else {
- qWarning("Failed to query D3D11_FEATURE_D3D11_OPTIONS");
+ static const char *msg = "D3D11 smoke test: Failed to query D3D11_FEATURE_D3D11_OPTIONS";
+ if (flags.testFlag(QRhi::SuppressSmokeTestWarnings))
+ qCDebug(QRHI_LOG_INFO, "%s", msg);
+ else
+ qWarning("%s", msg);
return false;
}
} else {