summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMika Salmela <mika.salmela@theqtcompany.com>2015-08-03 15:41:50 +0300
committerMika Salmela <mika.salmela@theqtcompany.com>2015-08-04 07:50:54 +0000
commitc18f56700f70afb80a4d8b9f767a2edd7ac0841e (patch)
treece8919ad89f59845b8af286e89cc138b5362fbce /tests
parent069695f2e54d3c6cd60f234a87c95c219c69a291 (diff)
Benchmarking app for massive data sets
Initial version of app for testing massive data sets. Sets up a scene with lots of spheres. Change-Id: Ibed8979ef9931c0c2be5e6e26b429d11010a701c Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/benchmarks/Qt3DBench/Qt3DBenchFrameGraph.qml68
-rw-r--r--tests/benchmarks/Qt3DBench/Qt3DBenchMain.qml74
-rw-r--r--tests/benchmarks/Qt3DBench/SphereElement.qml66
-rw-r--r--tests/benchmarks/Qt3DBench/SphereView.qml72
-rw-r--r--tests/benchmarks/Qt3DBench/main.cpp60
-rw-r--r--tests/benchmarks/Qt3DBench/qt3dbench-qml.pro12
-rw-r--r--tests/benchmarks/Qt3DBench/qt3dbench-qml.qrc8
7 files changed, 360 insertions, 0 deletions
diff --git a/tests/benchmarks/Qt3DBench/Qt3DBenchFrameGraph.qml b/tests/benchmarks/Qt3DBench/Qt3DBenchFrameGraph.qml
new file mode 100644
index 000000000..f96604a69
--- /dev/null
+++ b/tests/benchmarks/Qt3DBench/Qt3DBenchFrameGraph.qml
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt3D 2.0
+import Qt3D.Renderer 2.0
+
+FrameGraph {
+ id: root
+
+ property alias viewCamera: cameraSelector.camera
+
+ activeFrameGraph: Viewport {
+ rect: Qt.rect(0.0, 0.0, 1.0, 1.0)
+ clearColor: Qt.rgba(0.0, 0.0, 0.0, 1.0)
+
+ CameraSelector {
+ id: cameraSelector
+ camera: Camera {
+ id: camera
+ projectionType: CameraLens.PerspectiveProjection
+ fieldOfView: 45
+ aspectRatio: mainview.width / mainview.height
+ nearPlane: 0.01
+ farPlane: 1000.0
+ position: Qt.vector3d(0.0, 0.0, -100.0)
+ upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
+ viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )
+ }
+
+ ClearBuffer {
+ buffers : ClearBuffer.ColorDepthBuffer
+ }
+ }
+ }
+}
diff --git a/tests/benchmarks/Qt3DBench/Qt3DBenchMain.qml b/tests/benchmarks/Qt3DBench/Qt3DBenchMain.qml
new file mode 100644
index 000000000..21abe2976
--- /dev/null
+++ b/tests/benchmarks/Qt3DBench/Qt3DBenchMain.qml
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Scene3D 2.0
+
+Item {
+ id: mainview
+ width: 1280
+ height: 768
+ visible: true
+
+ Rectangle {
+ anchors.fill: parent
+ color: "white"
+
+ Scene3D {
+ anchors.fill: parent
+ focus: true
+ aspects: "input"
+
+ SphereView {
+ id: sphereView
+ }
+ }
+ }
+
+ // FPS thing
+ property int frames: 0
+
+ Timer {
+ interval: 1000
+ repeat: true
+ running: true//!fpsDisplay.hidden
+ onTriggered: {
+ console.log("Frames done :" + frames)
+ frames = 0
+ }
+ onRunningChanged: frames = 0
+ }
+}
diff --git a/tests/benchmarks/Qt3DBench/SphereElement.qml b/tests/benchmarks/Qt3DBench/SphereElement.qml
new file mode 100644
index 000000000..01e13bb6f
--- /dev/null
+++ b/tests/benchmarks/Qt3DBench/SphereElement.qml
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt3D 2.0
+import Qt3D.Renderer 2.0
+
+Entity {
+ id: root
+ property real xPos: 0
+ property real yPos: 0
+ property real zPos: 0
+
+ SphereMesh {
+ id: sphereMesh
+ rings: 15
+ slices: 16
+ radius: 0.5
+ }
+
+ Transform {
+ id: sphereTransform
+ Translate {
+ dx: xPos
+ dy: yPos
+ dz: zPos
+ }
+ }
+
+ components: [
+ sphereMesh,
+ sphereTransform
+ ]
+}
diff --git a/tests/benchmarks/Qt3DBench/SphereView.qml b/tests/benchmarks/Qt3DBench/SphereView.qml
new file mode 100644
index 000000000..5d3f0617c
--- /dev/null
+++ b/tests/benchmarks/Qt3DBench/SphereView.qml
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt3D 2.0
+import Qt3D.Renderer 2.0
+import QtQuick 2.0 as QQ2
+
+Entity {
+ id: sceneRoot
+
+ components: [
+ Qt3DBenchFrameGraph {
+ id: frameGraph
+ }
+ ]
+
+ Configuration {
+ controlledCamera: frameGraph.viewCamera
+ }
+
+ NodeInstantiator {
+ id: spheres
+ property int count: 900
+ property real spacing: 2
+ property int cols: 10
+ property int rows: 9
+ property int levelCount: cols * rows
+ property int levels: 10
+
+ model: count
+ delegate: SphereElement {
+ id: sphereEntity
+
+ xPos: spheres.spacing * (index % spheres.cols - 0.5 * (spheres.cols - 1))
+ yPos: spheres.spacing * (Math.floor(index / spheres.levelCount) - 0.5 * spheres.levels)
+ zPos: spheres.spacing * (Math.floor((index % spheres.levelCount) / spheres.cols) - 0.5 * spheres.rows)
+ }
+ }
+}
diff --git a/tests/benchmarks/Qt3DBench/main.cpp b/tests/benchmarks/Qt3DBench/main.cpp
new file mode 100644
index 000000000..3bd3acb7d
--- /dev/null
+++ b/tests/benchmarks/Qt3DBench/main.cpp
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QGuiApplication>
+#include <QQuickView>
+#include <QOpenGLContext>
+
+int main(int argc, char **argv)
+{
+ QGuiApplication app(argc, argv);
+
+ QSurfaceFormat format;
+ if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGL) {
+ //format.setVersion(3, 2);
+ format.setProfile(QSurfaceFormat::CoreProfile);
+ }
+ format.setDepthBufferSize(24);
+ format.setSamples(4);
+
+ QQuickView view;
+ view.setFormat(format);
+ view.setResizeMode(QQuickView::SizeRootObjectToView);
+ view.setSource(QUrl("qrc:/Qt3DBenchMain.qml"));
+ view.show();
+
+ return app.exec();
+}
diff --git a/tests/benchmarks/Qt3DBench/qt3dbench-qml.pro b/tests/benchmarks/Qt3DBench/qt3dbench-qml.pro
new file mode 100644
index 000000000..c0cd81f4d
--- /dev/null
+++ b/tests/benchmarks/Qt3DBench/qt3dbench-qml.pro
@@ -0,0 +1,12 @@
+QT += qml quick
+
+SOURCES += \
+ main.cpp
+
+OTHER_FILES += \
+ *.qml
+
+RESOURCES += \
+ qt3dbench-qml.qrc
+
+DISTFILES +=
diff --git a/tests/benchmarks/Qt3DBench/qt3dbench-qml.qrc b/tests/benchmarks/Qt3DBench/qt3dbench-qml.qrc
new file mode 100644
index 000000000..8855e91b9
--- /dev/null
+++ b/tests/benchmarks/Qt3DBench/qt3dbench-qml.qrc
@@ -0,0 +1,8 @@
+<RCC>
+ <qresource prefix="/">
+ <file>Qt3DBenchMain.qml</file>
+ <file>Qt3DBenchFrameGraph.qml</file>
+ <file>SphereView.qml</file>
+ <file>SphereElement.qml</file>
+ </qresource>
+</RCC>