From 0fbb073c032782b0e7da5c9d645c22d1a1407849 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Wed, 17 Jun 2020 14:09:48 +0200 Subject: Simplify the software backend selection logic Avoid relying on the (somewhat obsolete) capability flag. Instead, have a clean and straightforward check based on QT_CONFIG. In the CI, in particular for the QEMU configs that are both OpenGL and Vulkan capable (build-wise, yuck), the software backend will be requested explicitly in the future so this won't need to cater for that anymore. Change-Id: Ifa100efdae208b789f6ed2a7b57330262c13284f Reviewed-by: Eirik Aavitsland --- src/quick/scenegraph/qsgcontextplugin.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/quick/scenegraph') diff --git a/src/quick/scenegraph/qsgcontextplugin.cpp b/src/quick/scenegraph/qsgcontextplugin.cpp index 45ecb2009b..025716c2a7 100644 --- a/src/quick/scenegraph/qsgcontextplugin.cpp +++ b/src/quick/scenegraph/qsgcontextplugin.cpp @@ -133,14 +133,15 @@ QSGAdaptationBackendData *contextFactory() if (requestedBackend.isEmpty()) requestedBackend = qEnvironmentVariable("QT_QUICK_BACKEND"); - // If this platform does not support OpenGL, Vulkan, D3D11, or Metal, and no backend has been set - // default to the software renderer -#if !QT_CONFIG(vulkan) && !defined(Q_OS_WIN) && !defined(Q_OS_MACOS) && !defined(Q_OS_IOS) - if (requestedBackend.isEmpty() - && !QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::OpenGL)) - { + // If this platform does not support OpenGL, Vulkan, D3D11, or Metal, and no + // backend has been set, default to the software renderer. We rely on the + // static, build time flags only. This is to prevent the inevitable confusion + // caused by run time hocus pocus. If one wants to use the software backend + // in a GL or Vulkan capable Qt build (or on Windows or Apple platforms), it + // has to be requested explicitly. +#if !QT_CONFIG(opengl) && !QT_CONFIG(vulkan) && !defined(Q_OS_WIN) && !defined(Q_OS_MACOS) && !defined(Q_OS_IOS) + if (requestedBackend.isEmpty()) requestedBackend = QLatin1String("software"); - } #endif // This is handy if some of the logic above goes wrong and we select -- cgit v1.2.3