aboutsummaryrefslogtreecommitdiffstats
path: root/tools/qmlscene
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2019-04-23 09:40:59 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2019-07-04 10:44:26 +0200
commit341ab7708049b1a3f559b76f16393e688951a938 (patch)
tree0203da53d1adf5025fa85ecc38e0e37bce35c46f /tools/qmlscene
parent1f01b44d20471a7f4a5029a4c0049e8296749fef (diff)
Add the graphics api independent scenegraph port
Opt in via environment variables: QSG_RHI=1 -> enable using QRhi instead of GL QSG_RHI_BACKEND -> set to vulkan, metal, d3d11, gl to override the default (the default is d3d11 on Windows, metal on Mac, gl elsewhere) Or force a given rhi backend via the existing QQuickWindow::setSceneGraphBackend(). Otherwise the default behavior is the same as before, the rhi code path is never active by default. -no-opengl builds are supported in the sense that they work and default to the software backend. However, the rhi code path cannot currently be used in such builds, even though QRhi from qtbase is fully functional with Vulkan, D3D, or Metal even when qtbase was configured with -no-opengl. This cannot be utilized by Quick atm due to OpenGL usage being all over the place in the sources corresponding to the default backend, and those host the rhi code path as well. This will be cleaned up hopefully in Qt 6, with the removal all direct OpenGL usage. Other env.vars.: QSG_RHI_DEBUG_LAYER=1 -> enable D3D debug or Vulkan validation layer (assuming the system is set up for this) QSG_RHI_SHADEREFFECT_DEBUG=1 -> print stuff from ShaderEffect QSG_SAMPLES=1,2,4,... -> MSAA sample count (but QSurfaceFormat works too) QT_D3D_ADAPTER_INDEX=0,1,... -> D3D adapter index QT_VK_PHYSICAL_DEVICE_INDEX=0,1,... -> Vulkan physical device index QSG_RHI_UINT32_INDEX=1 -> always use uint index data (both merged/unmerged, convert when needed - with some rhi backends this is implicit) QSG_RENDER_LOOP -> to override the render loop as usual. The default with RHI is threaded for Metal, threaded for Vulkan on Windows, basic for Vulkan on Linux and Android (to be checked later), while the existing rules apply for OpenGL. Not supported when running with QRhi: - particles - compressed atlases (though this is transparent to the apps) - QSGRenderNode - QQuickRenderControl - QQuickFramebufferObject - certain QQuickWindow functionality that depends directly on OpenGL - anisotropic filtering for textures - native text may lack some gamma correction - QSGEngine applicability unclear - some QML profiler logs may be incorrect or irrelevant Change-Id: I7822e99ad79e342e4166275da6e9e66498d76521 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'tools/qmlscene')
-rw-r--r--tools/qmlscene/main.cpp41
1 files changed, 30 insertions, 11 deletions
diff --git a/tools/qmlscene/main.cpp b/tools/qmlscene/main.cpp
index d3b8b9ba99..260c5bb7d1 100644
--- a/tools/qmlscene/main.cpp
+++ b/tools/qmlscene/main.cpp
@@ -169,10 +169,13 @@ struct Options
bool multisample = false;
bool coreProfile = false;
bool verbose = false;
+ bool rhi = false;
+ bool rhiBackendSet = false;
QVector<Qt::ApplicationAttribute> applicationAttributes;
QString translationFile;
QmlApplicationType applicationType = DefaultQmlApplicationType;
QQuickWindow::TextRenderType textRenderType;
+ QString rhiBackend;
};
#if defined(QMLSCENE_BUNDLE)
@@ -349,24 +352,26 @@ 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(" --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");
puts(" --quit ........................... Quit immediately after starting");
puts(" --disable-context-sharing ........ Disable the use of a shared GL context for QtQuick Windows\n"
- " .........(remove AA_ShareOpenGLContexts)");
- puts(" --desktop..........................Force use of desktop GL (AA_UseDesktopOpenGL)");
- puts(" --gles.............................Force use of GLES (AA_UseOpenGLES)");
- puts(" --software.........................Force use of software rendering (AA_UseOpenGLES)");
- puts(" --scaling..........................Enable High DPI scaling (AA_EnableHighDpiScaling)");
- puts(" --no-scaling.......................Disable High DPI scaling (AA_DisableHighDpiScaling)");
- puts(" --verbose..........................Print version and graphical diagnostics for the run-time");
+ " ........ (remove AA_ShareOpenGLContexts)");
+ puts(" --desktop......................... Force use of desktop GL (AA_UseDesktopOpenGL)");
+ puts(" --gles............................ Force use of GLES (AA_UseOpenGLES)");
+ puts(" --software........................ Force use of software rendering (AA_UseOpenGLES)");
+ puts(" --scaling......................... Enable High DPI scaling (AA_EnableHighDpiScaling)");
+ puts(" --no-scaling...................... Disable High DPI scaling (AA_DisableHighDpiScaling)");
+ puts(" --verbose......................... Print version and graphical diagnostics for the run-time");
#ifdef QT_WIDGETS_LIB
- puts(" --apptype [gui|widgets] ...........Select which application class to use. Default is widgets.");
+ puts(" --apptype [gui|widgets] .......... Select which application class to use. Default is widgets.");
#endif
- puts(" --textrendertype [qt|native].......Select the default render type for text-like elements.");
+ puts(" --textrendertype [qt|native]...... Select the default render type for text-like elements.");
puts(" -I <path> ........................ Add <path> to the list of import paths");
- puts(" -S <selector> .....................Add <selector> to the list of QQmlFileSelector selectors");
+ puts(" -S <selector> .................... Add <selector> to the list of QQmlFileSelector selectors");
puts(" -P <path> ........................ Add <path> to the list of plugin paths");
puts(" -translation <translationfile> ... Set the language to run in");
@@ -550,7 +555,13 @@ int main(int argc, char ** argv)
options.resizeViewToRootItem = true;
else if (lowerArgument == QLatin1String("--verbose"))
options.verbose = true;
- else if (lowerArgument == QLatin1String("-i") && i + 1 < size)
+ else if (lowerArgument == QLatin1String("--rhi")) {
+ options.rhi = true;
+ if (i + 1 < size && !arguments.at(i + 1).startsWith(QLatin1Char('-'))) {
+ options.rhiBackendSet = true;
+ options.rhiBackend = arguments.at(++i);
+ }
+ } else if (lowerArgument == QLatin1String("-i") && i + 1 < size)
imports.append(arguments.at(++i));
else if (lowerArgument == QLatin1String("-s") && i + 1 < size)
customSelectors.append(arguments.at(++i));
@@ -592,6 +603,14 @@ 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
+ qunsetenv("QSG_RHI_BACKEND");
+ }
+
if (options.url.isEmpty())
#if defined(QMLSCENE_BUNDLE)
displayOptionsDialog(&options);