aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp12
1 files changed, 7 insertions, 5 deletions
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