diff options
author | Thomas Hartmann <thomas.hartmann@qt.io> | 2020-01-30 15:54:09 +0100 |
---|---|---|
committer | Thomas Hartmann <thomas.hartmann@qt.io> | 2020-02-06 11:33:01 +0100 |
commit | 3c2439593460d665dcf64622afae4eb91993eb10 (patch) | |
tree | 2d2a9ba1272dc603f0318e6eb0dc748c7c241ccf /tools | |
parent | 5af5015b0c600bd49eecd0782193974ad9405107 (diff) |
Add QML_CORE_PROFILE support to QML tool
If QML_CORE_PROFILE is defined we use the CoreProfile surface format.
This is required for QtQuick3D.
For consistency we also introduce QSG_CORE_PROFILE.
Adding QSG_CORE_PROFILE also to qmlscene.
Change-Id: I4feee91740162cf36fa2668695b74f5a1279bb89
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/qml/main.cpp | 12 | ||||
-rw-r--r-- | tools/qmlscene/main.cpp | 3 |
2 files changed, 14 insertions, 1 deletions
diff --git a/tools/qml/main.cpp b/tools/qml/main.cpp index 9f5aacb1dd..dc828b1f75 100644 --- a/tools/qml/main.cpp +++ b/tools/qml/main.cpp @@ -37,6 +37,7 @@ #include <QFileOpenEvent> #include <QOpenGLContext> #include <QOpenGLFunctions> +#include <QSurfaceFormat> #ifdef QT_WIDGETS_LIB #include <QApplication> #endif // QT_WIDGETS_LIB @@ -563,6 +564,17 @@ int main(int argc, char *argv[]) selector->setExtraSelectors(customSelectors); } +#if defined(QT_GUI_LIB) && QT_CONFIG(opengl) + if (qEnvironmentVariableIsSet("QSG_CORE_PROFILE") || qEnvironmentVariableIsSet("QML_CORE_PROFILE")) { + QSurfaceFormat surfaceFormat; + surfaceFormat.setStencilBufferSize(8); + surfaceFormat.setDepthBufferSize(24); + surfaceFormat.setVersion(4, 1); + surfaceFormat.setProfile(QSurfaceFormat::CoreProfile); + QSurfaceFormat::setDefaultFormat(surfaceFormat); + } +#endif + files << parser.values(qmlFileOption); if (parser.isSet(configOption)) confFile = parser.value(configOption); diff --git a/tools/qmlscene/main.cpp b/tools/qmlscene/main.cpp index 260c5bb7d1..b14166ad8d 100644 --- a/tools/qmlscene/main.cpp +++ b/tools/qmlscene/main.cpp @@ -500,7 +500,8 @@ int main(int argc, char ** argv) } } - if (qEnvironmentVariableIsSet("QMLSCENE_CORE_PROFILE")) + if (qEnvironmentVariableIsSet("QMLSCENE_CORE_PROFILE") + || qEnvironmentVariableIsSet("QSG_CORE_PROFILE")) options.coreProfile = true; // Set default surface format before creating the window |