diff options
author | Ville Voutilainen <ville.voutilainen@qt.io> | 2021-12-01 13:14:20 +0200 |
---|---|---|
committer | Ville Voutilainen <ville.voutilainen@qt.io> | 2022-01-04 11:12:11 +0000 |
commit | c9d84ead801960601870240e36478468c2a28b82 (patch) | |
tree | fbd2c6ae0466ecfce032e5eebca10d02dcae7bf3 /src/benchmarks/manual/gputhroughput/drawcalls.qml | |
parent | 6d298da7cda85b35aa22c68aac55fdb6513e68eb (diff) |
Use a resource file for benchmarks, and add some Android goodies and fixes
Task-number: QTBUG-94148
Change-Id: I7cc0b1ade676c4f7f963915315c00e317582e56f
Reviewed-by: Daniel Smith <Daniel.Smith@qt.io>
Diffstat (limited to 'src/benchmarks/manual/gputhroughput/drawcalls.qml')
-rw-r--r-- | src/benchmarks/manual/gputhroughput/drawcalls.qml | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/benchmarks/manual/gputhroughput/drawcalls.qml b/src/benchmarks/manual/gputhroughput/drawcalls.qml new file mode 100644 index 0000000..babf179 --- /dev/null +++ b/src/benchmarks/manual/gputhroughput/drawcalls.qml @@ -0,0 +1,44 @@ +import QtQuick 2.0 + +// Take this one with a grain of salt. Graphics drivers have a +// lot of overhead in how drawing is set up, and seeing an individual GL call take +// up to a millisecond (yes, a millisecond) is not uncommon. This test is a highly +// constructed case to try to get a rough ballpart of how many discrete draw calls +// the GL stack is capable of. +// +// This is mostly important if you end up with an application that fails to do +// batching in the scene graph renderer, but as this situation will typically +// have many other performance problems, this may not be a useful benchmark for +// the most part. +Item { + id: root; + + property real cellSize: Math.floor(Math.sqrt(width * height / (count / 2))) + property int count: 250 + property int staticCount: 0 + + Grid { + width: root.width + height: root.height + columns: Math.ceil(root.width / root.cellSize); + rows: Math.ceil(root.height / root.cellSize); + Repeater { + model: root.count / 2 + Rectangle { + opacity: 0.9 + width: root.cellSize + height: root.cellSize + color: Qt.hsla(index / count, 0.5, 0.5); + Image { + // partially overlap the next cells to provoke separate draw calls. + x: parent.width / 2 + y: parent.height / 2 + width: x + 2 + height: y + 2 + sourceSize: Qt.size(width, height); + source: "qrc:///shared/butterfly-wide.png" + } + } + } + } +} |