blob: dc53364124fb33081c210115e7fd9e3105bf00bd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
|
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick
import QtQuick.Layouts
import QtQuick.Controls
import QtDataVisualization
import "."
Item {
id: tests
property alias currentFps: fpsText.fps
property alias dataPoints: dataPointText.dataPoints
property alias buttonVisible: testButton.visible
property real averageFps: 0
signal onTestFinished
property list<real> fpsCounts: []
Component.onCompleted: {
dataGenerator.onMessage.connect(addLine)
}
function addLine(line) {
logModel.append({'logText':line});
}
function startTest() {
// logModel.clear()
fpsCounts = []
dataGenerator.writeLine(" ")
switch (tabBar.currentIndex) {
case 0:
dataGenerator.writeLine("Started surface test with configuration:")
break
case 1:
dataGenerator.writeLine("Started scatter test with configuration:")
break
case 2:
dataGenerator.writeLine("Started bars test with configuration:")
break
default:
break
}
if (tabBar.currentIndex === 0) {
dataGenerator.writeLine("Shadow Quality: " + surfaceGraph.shadowQuality)
dataGenerator.writeLine("MSAA samples: "
+ surfaceGraph.msaaSamples)
} else if (tabBar.currentIndex === 1) {
dataGenerator.writeLine("Shadow Quality: " + scatterGraph.shadowQuality)
var optimizationString = scatterGraph.optimizationHint? "Static" : "Default"
dataGenerator.writeLine("Optimization: " + optimizationString)
dataGenerator.writeLine("MSAA samples: "
+ scatterGraph.msaaSamples)
} else {
dataGenerator.writeLine("Shadow Quality: " + scatterGraph.shadowQuality)
optimizationString = barGraph.optimizationHint? "Static" : "Default"
dataGenerator.writeLine("Optimization: " + optimizationString)
dataGenerator.writeLine("MSAA samples: "
+ barGraph.msaaSamples)
}
testTimer.start()
}
Button {
id: testButton
text: "Test current"
onClicked: startTest()
height: 50
width: parent.width - 20
anchors.horizontalCenter: parent.horizontalCenter
}
ColumnLayout {
id: statsPanel
anchors.top: testButton.bottom
anchors.topMargin: 20
width: parent.width
Text {
id: statsBanner
text: "Statistics"
font.bold: true
font.pixelSize: 16
Layout.fillWidth: true
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
}
Text {
id: fpsText
property real fps: 0
text: qsTr("FPS: %1").arg(fps)
Layout.fillWidth: true
horizontalAlignment: Text.AlignHCenter
}
Text {
id: dataPointText
property int dataPoints: 0
text : qsTr("Data Points: %1").arg(dataPoints)
Layout.fillWidth: true
horizontalAlignment: Text.AlignHCenter
}
Text {
id: logBanner
text: "Log"
font.bold: true
font.pixelSize: 16
Layout.fillWidth: true
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
}
Rectangle {
id: logBackground
Layout.fillWidth: true
Layout.preferredHeight: 170
Layout.margins: 10
color: "forestgreen"
ListView {
id: logView
anchors.fill: parent
highlightFollowsCurrentItem: true
clip: true
delegate: Text {
text: logText
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
width: logView.width
wrapMode: Text.Wrap
}
model: ListModel {
id: logModel
}
onCountChanged: {
logView.currentIndex = count - 1
}
}
}
}
Timer {
id: testTimer
interval: 1000
repeat: true
onTriggered: {
var fps = 0
if (tabBar.currentIndex === 0)
fps = surfaceGraph.currentFps
else if (tabBar.currentIndex === 1)
fps = scatterGraph.currentFps
else
fps = barGraph.currentFps
if (fps != -1) {
fpsCounts.push(fps)
dataGenerator.writeLine("FPS: " + fps)
}
else {
dataGenerator.writeLine("Invalid fps reading")
}
if (fpsCounts.length >= 5) {
var sum = 0
fpsCounts.forEach((element) => sum+=element);
averageFps = sum / fpsCounts.length
dataGenerator.writeLine("Average FPS: " + averageFps)
testTimer.stop()
onTestFinished()
}
}
}
}
|