aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph/qsgrhisupport.cpp
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2020-05-07 20:41:14 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2020-05-11 08:42:58 +0200
commit263bb4dd30346c0657f187069e64e04c4b4d56df (patch)
tree10dc8d761e411bba28731d84bed277de44c977f9 /src/quick/scenegraph/qsgrhisupport.cpp
parent5fff54ac1d4b659efff208fdd4329d741883ed58 (diff)
Please the broken Win 7 CI by forcing OpenGL over D3D
Not very interesting because Windows 7 is not supported in Qt 6, but as long as the CI for it is around, let's try to keep it functional. Task-number: QTBUG-84067 Change-Id: Ifae65355466ae6d372169974e6034b370b0e1328 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Diffstat (limited to 'src/quick/scenegraph/qsgrhisupport.cpp')
-rw-r--r--src/quick/scenegraph/qsgrhisupport.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/quick/scenegraph/qsgrhisupport.cpp b/src/quick/scenegraph/qsgrhisupport.cpp
index 2a49a0958d..c523bff702 100644
--- a/src/quick/scenegraph/qsgrhisupport.cpp
+++ b/src/quick/scenegraph/qsgrhisupport.cpp
@@ -51,6 +51,8 @@
#include <QtGui/qvulkaninstance.h>
#endif
+#include <QOperatingSystemVersion>
+
QT_BEGIN_NAMESPACE
#if QT_CONFIG(vulkan)
@@ -181,6 +183,14 @@ void QSGRhiSupport::applySettings()
if (!m_enableRhi)
return;
+ adjustToPlatformQuirks();
+
+ // At this point the RHI backend is fixed, it cannot be changed once we
+ // return from this function. This is because things like the QWindow
+ // (QQuickWindow) may depend on the graphics API as well (surfaceType
+ // f.ex.), and all that is based on what we report from here. So further
+ // adjustments are not possible (or, at minimum, not safe and portable).
+
// validation layers (Vulkan) or debug layer (D3D)
m_debugLayer = uint(qEnvironmentVariableIntValue("QSG_RHI_DEBUG_LAYER"));
@@ -203,6 +213,21 @@ void QSGRhiSupport::applySettings()
qCDebug(QSG_LOG_INFO, "Prioritizing software renderers");
}
+void QSGRhiSupport::adjustToPlatformQuirks()
+{
+#if defined(Q_OS_WIN)
+ // Temporary Windows 7 workaround: no D3D. Just stick with OpenGL like Qt 5
+ // would. Can be removed when Win 7 support is finally dropped from Qt 6.
+ // (but as long as we have a Win 7 CI, this is mandatory)
+ if (QOperatingSystemVersion::current() <= QOperatingSystemVersion::Windows7) {
+ if (m_rhiBackend == QRhi::D3D11) {
+ qCDebug(QSG_LOG_INFO, "D3D on Windows 7 is not supported. Trying OpenGL instead.");
+ m_rhiBackend = QRhi::OpenGLES2;
+ }
+ }
+#endif
+}
+
QSGRhiSupport *QSGRhiSupport::staticInst()
{
static QSGRhiSupport inst;