diff options
author | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2015-05-29 16:38:34 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2015-06-04 07:03:42 +0000 |
commit | 7c22994176d37b3f5c9505635b63ae502aafdfec (patch) | |
tree | 27d1cfc19ca7c39b58fc1d2c655ba1ecf3d64c10 /tools/qmlscene | |
parent | 1fd0cdc6a2e01775d8a79c6614910cc5a2fbf2b3 (diff) |
qmlscene: Add options to control the GL renderer.
Replace boolean option controlling context sharing by a vector of
QCoreApplication attributes (bearing in mind that for example
High DPI changes might add more attributes) and add the GL switching
attributes.
Task-number: QTBUG-46030
Change-Id: I934dd8910b7b50ec96ae9e00823649c9df6a00ef
Reviewed-by: Alan Alpert <aalpert@blackberry.com>
Diffstat (limited to 'tools/qmlscene')
-rw-r--r-- | tools/qmlscene/main.cpp | 47 |
1 files changed, 29 insertions, 18 deletions
diff --git a/tools/qmlscene/main.cpp b/tools/qmlscene/main.cpp index b8920cd853..ad57454651 100644 --- a/tools/qmlscene/main.cpp +++ b/tools/qmlscene/main.cpp @@ -148,8 +148,10 @@ struct Options , quitImmediately(false) , resizeViewToRootItem(false) , multisample(false) - , contextSharing(true) { + // QtWebEngine needs a shared context in order for the GPU thread to + // upload textures. + applicationAttributes.append(Qt::AA_ShareOpenGLContexts); } QUrl file; @@ -164,7 +166,7 @@ struct Options bool quitImmediately; bool resizeViewToRootItem; bool multisample; - bool contextSharing; + QVector<Qt::ApplicationAttribute> applicationAttributes; QString translationFile; }; @@ -340,18 +342,22 @@ static void usage() puts("Usage: qmlscene [options] <filename>"); puts(" "); puts(" Options:"); - puts(" --maximized ............................... Run maximized"); - puts(" --fullscreen .............................. Run fullscreen"); - puts(" --transparent ............................. Make the window transparent"); - puts(" --multisample ............................. Enable multisampling (OpenGL anti-aliasing)"); - 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"); - puts(" -I <path> ................................. Add <path> to the list of import paths"); - puts(" -P <path> ................................. Add <path> to the list of plugin paths"); - puts(" -translation <translationfile> ............ Set the language to run in"); + puts(" --maximized ...................... Run maximized"); + puts(" --fullscreen ..................... Run fullscreen"); + puts(" --transparent .................... Make the window transparent"); + puts(" --multisample .................... Enable multisampling (OpenGL anti-aliasing)"); + 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(" -I <path> ........................ Add <path> to the list of import paths"); + puts(" -P <path> ........................ Add <path> to the list of plugin paths"); + puts(" -translation <translationfile> ... Set the language to run in"); puts(" "); exit(1); @@ -389,7 +395,13 @@ int main(int argc, char ** argv) else if (lowerArgument == QLatin1String("--multisample")) options.multisample = true; else if (lowerArgument == QLatin1String("--disable-context-sharing")) - options.contextSharing = false; + options.applicationAttributes.removeAll(Qt::AA_ShareOpenGLContexts); + else if (lowerArgument == QLatin1String("--gles")) + options.applicationAttributes.append(Qt::AA_UseOpenGLES); + else if (lowerArgument == QLatin1String("--software")) + options.applicationAttributes.append(Qt::AA_UseSoftwareOpenGL); + else if (lowerArgument == QLatin1String("--desktop")) + options.applicationAttributes.append(Qt::AA_UseDesktopOpenGL); else if (lowerArgument == QLatin1String("-i") && i + 1 < argc) imports.append(QString::fromLatin1(argv[++i])); else if (lowerArgument == QLatin1String("-p") && i + 1 < argc) @@ -402,9 +414,8 @@ int main(int argc, char ** argv) } } - // QtWebEngine needs a shared context in order for the GPU thread to - // upload textures. - QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts, options.contextSharing); + foreach (Qt::ApplicationAttribute a, options.applicationAttributes) + QCoreApplication::setAttribute(a); #ifdef QT_WIDGETS_LIB QApplication app(argc, argv); #else |