diff options
author | Paul Olav Tvete <paul.tvete@qt.io> | 2020-06-16 17:03:47 +0200 |
---|---|---|
committer | Paul Olav Tvete <paul.tvete@qt.io> | 2020-06-17 17:42:01 +0200 |
commit | 83fb4f6743860bfb746e6243aad00513d498db4f (patch) | |
tree | 816bf1a1d509124c6bfb4fc34cce2a4ed885f40e /tools | |
parent | 48e919e9647fd07351be37e1ad7efdda9c550be9 (diff) |
Clean up QT_CONFIG(opengl)
Accelerated graphics is now possible without OpenGL support. With
this change, a Qt build with -no-opengl can still run Qt Quick with
a Vulkan, Metal, or Direct3D backend.
Fixes: QTBUG-84027
Change-Id: Ib63c733d28cfdf7de16b138df136fa7628e1747b
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/qml/main.cpp | 9 | ||||
-rw-r--r-- | tools/qmlscene/main.cpp | 9 |
2 files changed, 5 insertions, 13 deletions
diff --git a/tools/qml/main.cpp b/tools/qml/main.cpp index 71bd104596..bf1f96b54f 100644 --- a/tools/qml/main.cpp +++ b/tools/qml/main.cpp @@ -282,12 +282,12 @@ void LoadWatcher::contain(QObject *o, const QUrl &containPath) void LoadWatcher::checkForWindow(QObject *o) { -#if defined(QT_GUI_LIB) && QT_CONFIG(opengl) +#if defined(QT_GUI_LIB) if (o->isWindowType() && o->inherits("QQuickWindow")) haveWindow = true; #else Q_UNUSED(o) -#endif // QT_GUI_LIB && !QT_NO_OPENGL +#endif // QT_GUI_LIB } void quietMessageHandler(QtMsgType type, const QMessageLogContext &ctxt, const QString &msg) @@ -480,7 +480,7 @@ int main(int argc, char *argv[]) QCoreApplication::translate("main", "Run animations off animation tick rather than wall time.")); parser.addOption(fixedAnimationsOption); QCommandLineOption rhiOption(QStringList() << QStringLiteral("r") << QStringLiteral("rhi"), - QCoreApplication::translate("main", "Use the Qt graphics abstraction (RHI) instead of OpenGL directly. " + QCoreApplication::translate("main", "Set the backend for the Qt graphics abstraction (RHI). " "Backend is one of: default, vulkan, metal, d3d11, gl"), QStringLiteral("backend")); parser.addOption(rhiOption); @@ -534,7 +534,7 @@ int main(int argc, char *argv[]) if (!customSelectors.isEmpty()) e.setExtraFileSelectors(customSelectors); -#if defined(QT_GUI_LIB) && QT_CONFIG(opengl) +#if defined(QT_GUI_LIB) if (qEnvironmentVariableIsSet("QSG_CORE_PROFILE") || qEnvironmentVariableIsSet("QML_CORE_PROFILE")) { QSurfaceFormat surfaceFormat; surfaceFormat.setStencilBufferSize(8); @@ -553,7 +553,6 @@ int main(int argc, char *argv[]) if (parser.isSet(dummyDataOption)) dummyDir = parser.value(dummyDataOption); if (parser.isSet(rhiOption)) { - qputenv("QSG_RHI", "1"); const QString rhiBackend = parser.value(rhiOption); if (rhiBackend == QLatin1String("default")) qunsetenv("QSG_RHI_BACKEND"); diff --git a/tools/qmlscene/main.cpp b/tools/qmlscene/main.cpp index 2824ba35fa..449e682b4e 100644 --- a/tools/qmlscene/main.cpp +++ b/tools/qmlscene/main.cpp @@ -47,7 +47,6 @@ #include <QtQuick/qquickview.h> #include <private/qabstractanimation_p.h> -#include <private/qopenglcontext_p.h> #ifdef QT_WIDGETS_LIB #include <QtWidgets/QApplication> @@ -351,8 +350,7 @@ static void usage() puts(" --transparent .................... Make the window transparent"); puts(" --multisample .................... Enable multisampling (OpenGL anti-aliasing)"); puts(" --core-profile ................... Request a core profile OpenGL context"); - puts(" --rhi [vulkan|metal|d3d11|gl] .... Use the Qt graphics abstraction (RHI) instead of OpenGL directly.\n" - " .... Backend has platform specific defaults. Specify to override."); + puts(" --rhi [vulkan|metal|d3d11|gl] .... Specify backend for the Qt graphics abstraction (RHI).\n"); puts(" --no-version-detection ........... Do not try to detect the version of the .qml file"); puts(" --slow-animations ................ Run all animations in slow motion"); puts(" --resize-to-root ................. Resize the window to the size of the root item"); @@ -390,10 +388,6 @@ static void setWindowTitle(bool verbose, const QObject *topLevel, QWindow *windo if (verbose) { newTitle += QLatin1String(" [Qt ") + QLatin1String(QT_VERSION_STR) + QLatin1Char(' ') + QGuiApplication::platformName() + QLatin1Char(' '); -#if QT_CONFIG(opengl) - newTitle += QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGL - ? QLatin1String("GL") : QLatin1String("GLES"); -#endif newTitle += QLatin1Char(']'); } if (oldTitle != newTitle) @@ -573,7 +567,6 @@ int main(int argc, char ** argv) QUnifiedTimer::instance()->setSlowModeEnabled(options.slowAnimations); if (options.rhi) { - qputenv("QSG_RHI", "1"); if (options.rhiBackendSet) qputenv("QSG_RHI_BACKEND", options.rhiBackend.toLatin1()); else |