diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2022-05-11 13:32:49 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2022-05-14 00:59:53 +0200 |
commit | 6fa8836d430d59f2350012b54f57bc246b2aa18a (patch) | |
tree | 26f523ba948a59c64ff943a0967d7d5586858aa1 /src/core | |
parent | 196ec015caf7634fd1924a9f9e532e230a9b342a (diff) |
Fix software backend detection
QSG hasn't parsed and set the backend yet, so we do need to duplicate
the logic it will use later to make a proper detection.
Pick-to: 6.3
Fixes: QTBUG-103372
Change-Id: I542ef9f52dd2725d3ff6e17f9142786e43425ebd
Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Reviewed-by: Michal Klocek <michal.klocek@qt.io>
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/web_engine_context.cpp | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index 390002519..e59415423 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -160,7 +160,27 @@ namespace QtWebEngineCore { static bool usingSupportedSGBackend() { - return QQuickWindow::graphicsApi() == QSGRendererInterface::OpenGL; + if (QQuickWindow::graphicsApi() != QSGRendererInterface::OpenGL) + return false; + + const QStringList args = QGuiApplication::arguments(); + + // follow the logic from contextFactory in src/quick/scenegraph/qsgcontextplugin.cpp + QString device = QQuickWindow::sceneGraphBackend(); + + for (int index = 0; index < args.count(); ++index) { + if (args.at(index).startsWith(QLatin1String("--device="))) { + device = args.at(index).mid(9); + break; + } + } + + if (device.isEmpty()) + device = qEnvironmentVariable("QT_QUICK_BACKEND"); + if (device.isEmpty()) + device = qEnvironmentVariable("QMLSCENE_DEVICE"); + + return device.isEmpty() || device == QLatin1String("rhi"); } bool usingSoftwareDynamicGL() |