summaryrefslogtreecommitdiffstats
path: root/tests/manual/compute-manual/ComputeFrameGraph.qml
blob: e3b8624d3bcc6d267da091f64b1a8d1df2a8f649 (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
// Copyright (C) 2019 Klaralvdalens Datakonsult AB (KDAB).
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only

import Qt3D.Core 2.14
import Qt3D.Render 2.14

Viewport {
    property alias camera: selector.camera

    RenderSurfaceSelector {
        id: surfaceSelector

        // Clear Buffer
        ClearBuffers {
            buffers: ClearBuffers.ColorDepthBuffer
            NoDraw {}
        }

        // Compute Pass
        DispatchCompute {
            // 1024 x 1024 particles
            // We will launch 1024 local workgroup that will work
            // on 1024 particles each
            workGroupX: 1024; workGroupY: 1; workGroupZ: 1
            TechniqueFilter {
                matchAll: [
                    FilterKey { name: "type"; value: "compute"}
                ]
            }
        }

        // Draw particles from buffer computed in the Compute Pass
        CameraSelector {
            id: selector
            TechniqueFilter {
                MemoryBarrier { waitFor: MemoryBarrier.VertexAttributeArray }
                matchAll: [
                    FilterKey { name: "type"; value: "draw"}
                ]
            }
        }
    }
}