blob: c4a02a459b2b5508d56a5b7eb9b68a9c05076e01 (
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
|
#version 450
// Adds the D3D12_QUERY_DATA_PIPELINE_STATISTICS segments of one split pipeline-statistics query (D3D-162): one
// invocation per counter, in the order of VkQueryPipelineStatisticFlagBits, which is the D3D12 field order.
// `mesh` segments come from the pool a mesh draw can run in (D3D-291), which counts only the fragment and compute
// invocations: they are copied to counters 7 and 8 of their record, so PSInvocations takes the fragment one and
// CSInvocations the compute one, and every other counter adds nothing.
// The clipping invocations of a mesh segment come from the mesh-primitives count of that segment, copied to
// counter 5 (D3D-MESH-CLIPPING-COUNTER); without that count the field stays 0.
layout(local_size_x = 11) in;
layout(set = 0, binding = 0, std430) buffer QueryResults {
uvec2 total[11];
uvec2 segments[]; // `count` results of 11 counters each
};
layout(push_constant) uniform ResolveRange { uint count; uint mesh; };
void main() {
const uint counter = gl_LocalInvocationID.x;
uvec2 sum = total[counter];
const bool counted = mesh == 0u || counter == 5u || counter == 7u || counter == 10u;
const uint source = mesh != 0u && counter == 10u ? 8u : counter;
for (uint i = 0; counted && i < count; ++i) {
uvec2 segment = segments[i * 11 + source];
uint low = sum.x + segment.x;
sum.y += segment.y + uint(low < sum.x);
sum.x = low;
}
total[counter] = sum;
}
|