diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> | 2021-04-28 10:32:02 +0200 |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> | 2021-04-28 12:42:45 +0000 |
commit | 4bf0cd983c2620fb7c3168e00317dc17123b0615 (patch) | |
tree | 54840229bd8325ff9f54b65638dfc420b45309ee | |
parent | ac368f6062804305b2257df80fe72923d413e4ad (diff) |
Make sure default surface format supports Qt Quick 3D
We need to pick an appropriate OpenGL version in order to
support all the QQ3D benchmarks. This also means we have
to move the setup for the surface format until after
initializing the GUI application, but having this before
is not actually needed in our case anyway.
Change-Id: I98ad3399b0a00aba7252f4c8b646a073c8ec1584
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
-rw-r--r-- | CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/main.cpp | 12 |
3 files changed, 9 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 015bc14..dcf53a0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,7 +16,7 @@ project(QMLBench set(QT_NO_INTERNAL_COMPATIBILITY_FUNCTIONS TRUE) # special case end -find_package(Qt6 ${PROJECT_VERSION} CONFIG REQUIRED COMPONENTS BuildInternals Core Gui Qml Quick Test) +find_package(Qt6 ${PROJECT_VERSION} CONFIG REQUIRED COMPONENTS BuildInternals Core Gui Qml Quick Test Quick3D) qt_build_repo_begin() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7e07d67..0bbb260 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -15,6 +15,7 @@ qt_internal_add_executable(qmlbench PUBLIC_LIBRARIES Qt::Gui Qt::Quick + Qt::Quick3D ) # Resources: diff --git a/src/main.cpp b/src/main.cpp index a57b3e6..667e25f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -32,6 +32,7 @@ #include <QtCore> #include <QtGui> #include <QtQuick> +#include <QtQuick3D> #include "benchmark.h" #include "benchmarkrunner.h" @@ -239,7 +240,7 @@ QStringList processCommandLineArguments(const QCoreApplication &app) return parser.positionalArguments(); } -void setupDefaultSurfaceFormat(int argc, char **argv) +void setupDefaultSurfaceFormat(int argc, char **argv, bool subprocess) { bool frameCountShell = true; // default for (int i = 0; i < argc; ++i) { @@ -249,6 +250,9 @@ void setupDefaultSurfaceFormat(int argc, char **argv) } } + if (subprocess) + QSurfaceFormat::setDefaultFormat(QQuick3D::idealSurfaceFormat()); + if (frameCountShell) { QSurfaceFormat format = QSurfaceFormat::defaultFormat(); #if QT_VERSION >= 0x050300 @@ -394,10 +398,6 @@ static QObject *qmlbench_singleton_provider(QQmlEngine *, QJSEngine *) int main(int argc, char **argv) { - // We need to do this early on, so there's no interference from the shared - // GL context. - setupDefaultSurfaceFormat(argc, argv); - // If it's not set, set the Qt Quick Controls style to Basic to ensure consistent results. const QByteArray controlsStyle = qgetenv("QT_QUICK_CONTROLS_STYLE"); if (controlsStyle.isEmpty()) @@ -432,6 +432,8 @@ int main(int argc, char **argv) int ret = 0; + setupDefaultSurfaceFormat(argc, argv, needsGui); + // qmlbench works as a split process mode. The parent process // (!isSubProcess) proxies a bunch of child processes that actually do the // work, and report output back to the parent. This keeps the benchmark |