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>
This commit is contained in:
Thomas Hartmann 2020-01-30 15:54:09 +01:00
parent 5af5015b0c
commit 3c24395934
2 changed files with 14 additions and 1 deletions

View File

@ -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);

View File

@ -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