aboutsummaryrefslogtreecommitdiffstats
path: root/benchmarks/manual/gputhroughput/drawcalls.qml
blob: 7d9a14b3723bae34d29423f608169ce0d8df4c05 (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
import QtQuick 2.0

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: "../../../shared/butterfly-wide.png"
                }
            }
        }
    }
}