upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/runtime/src/statistics_sum.comp
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/src/statistics_sum.comp')
-rw-r--r--runtime/src/statistics_sum.comp11
1 files changed, 8 insertions, 3 deletions
diff --git a/runtime/src/statistics_sum.comp b/runtime/src/statistics_sum.comp
index e4e2ce13c..c4960347c 100644
--- a/runtime/src/statistics_sum.comp
+++ b/runtime/src/statistics_sum.comp
@@ -2,18 +2,23 @@
2 2
3// Adds the D3D12_QUERY_DATA_PIPELINE_STATISTICS segments of one split pipeline-statistics query (D3D-162): one 3// Adds the D3D12_QUERY_DATA_PIPELINE_STATISTICS segments of one split pipeline-statistics query (D3D-162): one
4// invocation per counter, in the order of VkQueryPipelineStatisticFlagBits, which is the D3D12 field order. 4// invocation per counter, in the order of VkQueryPipelineStatisticFlagBits, which is the D3D12 field order.
5// `mesh` segments come from the pool a mesh draw can run in (D3D-291), which counts only clipping, fragment and
6// compute: they are copied to counters 5..8 of their record, so CSInvocations sits at 8 and the input-assembly,
7// vertex, geometry and tessellation counters (0..4, 8 and 9 of the D3D12 order) add nothing.
5layout(local_size_x = 11) in; 8layout(local_size_x = 11) in;
6layout(set = 0, binding = 0, std430) buffer QueryResults { 9layout(set = 0, binding = 0, std430) buffer QueryResults {
7 uvec2 total[11]; 10 uvec2 total[11];
8 uvec2 segments[]; // `count` results of 11 counters each 11 uvec2 segments[]; // `count` results of 11 counters each
9}; 12};
10layout(push_constant) uniform ResolveRange { uint count; }; 13layout(push_constant) uniform ResolveRange { uint count; uint mesh; };
11 14
12void main() { 15void main() {
13 const uint counter = gl_LocalInvocationID.x; 16 const uint counter = gl_LocalInvocationID.x;
14 uvec2 sum = total[counter]; 17 uvec2 sum = total[counter];
15 for (uint i = 0; i < count; ++i) { 18 const bool counted = mesh == 0u || (counter >= 5u && counter <= 7u) || counter == 10u;
16 uvec2 segment = segments[i * 11 + counter]; 19 const uint source = mesh != 0u && counter == 10u ? 8u : counter;
20 for (uint i = 0; counted && i < count; ++i) {
21 uvec2 segment = segments[i * 11 + source];
17 uint low = sum.x + segment.x; 22 uint low = sum.x + segment.x;
18 sum.y += segment.y + uint(low < sum.x); 23 sum.y += segment.y + uint(low < sum.x);
19 sum.x = low; 24 sum.x = low;