diff options
| author | Shang Li <144836394+Mby159@users.noreply.github.com> | 2026-11-24 16:55:25 +0800 |
|---|---|---|
| committer | Shang Li <144836394+Mby159@users.noreply.github.com> | 2026-11-24 12:35:29 +0000 |
| commit | 1bb23a28036ffc7ec1c7207afe5fa6e9470153b3 (patch) | |
| tree | 3b30f53bb2295eb52ddcf8e59c154e75cfcb84ac /runtime/src/statistics_sum.comp | |
| parent | 916dbc619df63fb169cf5e587f4d53d8884eaccd (diff) | |
d3d12/vulkan: a mesh segment's clipping invocations come from a mesh-primitives query (D3D-MESH-CLIPPING-COUNTER)
Where the device has the meshShaderQueries feature of VK_EXT_mesh_shader, the number of
primitives the mesh shader emitted comes from a VK_QUERY_TYPE_MESH_PRIMITIVES_GENERATED_EXT
query run around each mesh segment, and it is added as the clipping invocations of that
segment. CPrimitives stays 0: Vulkan has no clipped-primitive counter, and D3D12's
CPrimitives is the clipper's output.
Claim: D3D-MESH-CLIPPING-COUNTER
Depends on: #540
Diffstat (limited to 'runtime/src/statistics_sum.comp')
| -rw-r--r-- | runtime/src/statistics_sum.comp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/runtime/src/statistics_sum.comp b/runtime/src/statistics_sum.comp index 2478030d4..c4a02a459 100644 --- a/runtime/src/statistics_sum.comp +++ b/runtime/src/statistics_sum.comp | |||
| @@ -5,6 +5,8 @@ | |||
| 5 | // `mesh` segments come from the pool a mesh draw can run in (D3D-291), which counts only the fragment and compute | 5 | // `mesh` segments come from the pool a mesh draw can run in (D3D-291), which counts only the fragment and compute |
| 6 | // invocations: they are copied to counters 7 and 8 of their record, so PSInvocations takes the fragment one and | 6 | // invocations: they are copied to counters 7 and 8 of their record, so PSInvocations takes the fragment one and |
| 7 | // CSInvocations the compute one, and every other counter adds nothing. | 7 | // CSInvocations the compute one, and every other counter adds nothing. |
| 8 | // The clipping invocations of a mesh segment come from the mesh-primitives count of that segment, copied to | ||
| 9 | // counter 5 (D3D-MESH-CLIPPING-COUNTER); without that count the field stays 0. | ||
| 8 | layout(local_size_x = 11) in; | 10 | layout(local_size_x = 11) in; |
| 9 | layout(set = 0, binding = 0, std430) buffer QueryResults { | 11 | layout(set = 0, binding = 0, std430) buffer QueryResults { |
| 10 | uvec2 total[11]; | 12 | uvec2 total[11]; |
| @@ -15,7 +17,7 @@ layout(push_constant) uniform ResolveRange { uint count; uint mesh; }; | |||
| 15 | void main() { | 17 | void main() { |
| 16 | const uint counter = gl_LocalInvocationID.x; | 18 | const uint counter = gl_LocalInvocationID.x; |
| 17 | uvec2 sum = total[counter]; | 19 | uvec2 sum = total[counter]; |
| 18 | const bool counted = mesh == 0u || counter == 7u || counter == 10u; | 20 | const bool counted = mesh == 0u || counter == 5u || counter == 7u || counter == 10u; |
| 19 | const uint source = mesh != 0u && counter == 10u ? 8u : counter; | 21 | const uint source = mesh != 0u && counter == 10u ? 8u : counter; |
| 20 | for (uint i = 0; counted && i < count; ++i) { | 22 | for (uint i = 0; counted && i < count; ++i) { |
| 21 | uvec2 segment = segments[i * 11 + source]; | 23 | uvec2 segment = segments[i * 11 + source]; |