| 1 |
// Copyright (C) 2019 Klaralvdalens Datakonsult AB (KDAB). |
| 2 |
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
| 3 |
|
| 4 |
import Qt3D.Core 2.14 |
| 5 |
import Qt3D.Render 2.14 |
| 6 |
|
| 7 |
Viewport { |
| 8 |
property alias camera: selector.camera |
| 9 |
|
| 10 |
RenderSurfaceSelector { |
| 11 |
id: surfaceSelector |
| 12 |
|
| 13 |
// Clear Buffer |
| 14 |
ClearBuffers { |
| 15 |
buffers: ClearBuffers.ColorDepthBuffer |
| 16 |
NoDraw {} |
| 17 |
} |
| 18 |
|
| 19 |
// Compute Pass |
| 20 |
DispatchCompute { |
| 21 |
// 1024 x 1024 particles |
| 22 |
// We will launch 1024 local workgroup that will work |
| 23 |
// on 1024 particles each |
| 24 |
workGroupX: 1024; workGroupY: 1; workGroupZ: 1 |
| 25 |
TechniqueFilter { |
| 26 |
matchAll: [ |
| 27 |
FilterKey { name: "type"; value: "compute"} |
| 28 |
] |
| 29 |
} |
| 30 |
} |
| 31 |
|
| 32 |
// Draw particles from buffer computed in the Compute Pass |
| 33 |
CameraSelector { |
| 34 |
id: selector |
| 35 |
TechniqueFilter { |
| 36 |
MemoryBarrier { waitFor: MemoryBarrier.VertexAttributeArray } |
| 37 |
matchAll: [ |
| 38 |
FilterKey { name: "type"; value: "draw"} |
| 39 |
] |
| 40 |
} |
| 41 |
} |
| 42 |
} |
| 43 |
} |
| 44 |
|