upleb.uk

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

summaryrefslogtreecommitdiff
path: root/runtime/src
diff options
context:
space:
mode:
authorQemmHD <stephenlethco2@gmail.com>2026-11-24 08:37:58 -0500
committerGitHub <noreply@github.com>2026-11-24 08:37:58 -0500
commit3bb46d658b0c1c81a79091f6de933fba08d1af8a (patch)
treefdf7ae6f94fd8fd38809042a110834db30b54580 /runtime/src
parent5435a765b14512ae462be6193efac006149b1d20 (diff)
parent916dbc619df63fb169cf5e587f4d53d8884eaccd (diff)
Merge pull request #540 from Mby159/d3d-291-mesh-statistics
Merging. **Why merged:** Fixes the mesh half of #506: the statistics pool active during vkCmdDrawMeshTasksEXT no longer enables the two clipping counters that VUID-vkCmdDrawMeshTasksEXT-pipelineStatistics-07076 forbids. Verified on an RTX 5070 Ti (sodove), RTX 4080 (quartz-heron-58) and RX 7900 XTX (bvtterbroot), all with validation on; the rebase to 916dbc619 is byte-identical (range-diff checked). Merged on its own first because #577 is stacked on it. **Why it's good:** On the 4070 SUPER with LEONIDA_VK_VALIDATION=1: plain main fails d3d12_mesh with 3x VUID-...-07076; main + #540 + #577 passes d3d12_mesh, replay_query_edges and replay_query_predication with 0 validation errors, and the counters match sodove's numbers (mesh-only C 8/0, PS 1024). Tested on Windows 11, RTX 4070 SUPER (NVIDIA 621.24), VS 2022 + Ninja RelWithDebInfo, Vulkan SDK 1.4.363.0, alone on main (21625bca8 or 51f316092) and in a cumulative merge of #497, #278, #310, #334, #346, #340, #355, #361, #363, #620 and #577 (which carries #540) on main 2d73c242f (git merge-tree: 0 conflicts against current main). Repo-consistency set (cmake/translator-deps, shader_stage_resume, runtime_paths, docs, make_game, no-game-data, run_semantic_tests): 566 passed / 5 skipped / 0 failed on main and on main + batch. compileall OK. Full ctest: 302/304 on main and on main + batch (the same two pre-existing failures, d3d12_execute_indirect_validation and d3d12_depth_resolve, no new ones). AI-assisted (Claude Code, Claude Opus 5.5).
Diffstat (limited to 'runtime/src')
-rw-r--r--runtime/src/statistics_sum.comp8
-rw-r--r--runtime/src/statistics_sum_spirv.h70
-rw-r--r--runtime/src/vulkan_backend.h13
-rw-r--r--runtime/src/vulkan_replay.h24
4 files changed, 62 insertions, 53 deletions
diff --git a/runtime/src/statistics_sum.comp b/runtime/src/statistics_sum.comp
index c4960347c..2478030d4 100644
--- a/runtime/src/statistics_sum.comp
+++ b/runtime/src/statistics_sum.comp
@@ -2,9 +2,9 @@
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 5// `mesh` segments come from the pool a mesh draw can run in (D3D-291), which counts only the fragment and compute
6// compute: they are copied to counters 5..8 of their record, so CSInvocations sits at 8 and the input-assembly, 6// invocations: they are copied to counters 7 and 8 of their record, so PSInvocations takes the fragment one and
7// vertex, geometry and tessellation counters (0..4, 8 and 9 of the D3D12 order) add nothing. 7// CSInvocations the compute one, and every other counter adds nothing.
8layout(local_size_x = 11) in; 8layout(local_size_x = 11) in;
9layout(set = 0, binding = 0, std430) buffer QueryResults { 9layout(set = 0, binding = 0, std430) buffer QueryResults {
10 uvec2 total[11]; 10 uvec2 total[11];
@@ -15,7 +15,7 @@ layout(push_constant) uniform ResolveRange { uint count; uint mesh; };
15void main() { 15void main() {
16 const uint counter = gl_LocalInvocationID.x; 16 const uint counter = gl_LocalInvocationID.x;
17 uvec2 sum = total[counter]; 17 uvec2 sum = total[counter];
18 const bool counted = mesh == 0u || (counter >= 5u && counter <= 7u) || counter == 10u; 18 const bool counted = mesh == 0u || counter == 7u || counter == 10u;
19 const uint source = mesh != 0u && counter == 10u ? 8u : counter; 19 const uint source = mesh != 0u && counter == 10u ? 8u : counter;
20 for (uint i = 0; counted && i < count; ++i) { 20 for (uint i = 0; counted && i < count; ++i) {
21 uvec2 segment = segments[i * 11 + source]; 21 uvec2 segment = segments[i * 11 + source];
diff --git a/runtime/src/statistics_sum_spirv.h b/runtime/src/statistics_sum_spirv.h
index 9c67f0429..b482a5748 100644
--- a/runtime/src/statistics_sum_spirv.h
+++ b/runtime/src/statistics_sum_spirv.h
@@ -16,7 +16,7 @@ inline constexpr std::uint32_t statistics_sum_spirv[] = {
16 0x00050048, 0x00000016, 0x00000001, 0x00000023, 0x00000058, 0x00040047, 0x00000018, 0x00000021, 16 0x00050048, 0x00000016, 0x00000001, 0x00000023, 0x00000058, 0x00040047, 0x00000018, 0x00000021,
17 0x00000000, 0x00040047, 0x00000018, 0x00000022, 0x00000000, 0x00030047, 0x00000022, 0x00000002, 17 0x00000000, 0x00040047, 0x00000018, 0x00000022, 0x00000000, 0x00030047, 0x00000022, 0x00000002,
18 0x00050048, 0x00000022, 0x00000000, 0x00000023, 0x00000000, 0x00050048, 0x00000022, 0x00000001, 18 0x00050048, 0x00000022, 0x00000000, 0x00000023, 0x00000000, 0x00050048, 0x00000022, 0x00000001,
19 0x00000023, 0x00000004, 0x00040047, 0x00000072, 0x0000000b, 0x00000019, 0x00020013, 0x00000002, 19 0x00000023, 0x00000004, 0x00040047, 0x0000006b, 0x0000000b, 0x00000019, 0x00020013, 0x00000002,
20 0x00030021, 0x00000003, 0x00000002, 0x00040015, 0x00000006, 0x00000020, 0x00000000, 0x00040017, 20 0x00030021, 0x00000003, 0x00000002, 0x00040015, 0x00000006, 0x00000020, 0x00000000, 0x00040017,
21 0x00000009, 0x00000006, 0x00000003, 0x00040020, 0x0000000a, 0x00000001, 0x00000009, 0x0004003b, 21 0x00000009, 0x00000006, 0x00000003, 0x00040020, 0x0000000a, 0x00000001, 0x00000009, 0x0004003b,
22 0x0000000a, 0x0000000b, 0x00000001, 0x0004002b, 0x00000006, 0x0000000c, 0x00000000, 0x00040020, 22 0x0000000a, 0x0000000b, 0x00000001, 0x0004002b, 0x00000006, 0x0000000c, 0x00000000, 0x00040020,
@@ -28,42 +28,38 @@ inline constexpr std::uint32_t statistics_sum_spirv[] = {
28 0x00000002, 0x00000010, 0x00020014, 0x0000001f, 0x0004001e, 0x00000022, 0x00000006, 0x00000006, 28 0x00000002, 0x00000010, 0x00020014, 0x0000001f, 0x0004001e, 0x00000022, 0x00000006, 0x00000006,
29 0x00040020, 0x00000023, 0x00000009, 0x00000022, 0x0004003b, 0x00000023, 0x00000024, 0x00000009, 29 0x00040020, 0x00000023, 0x00000009, 0x00000022, 0x0004003b, 0x00000023, 0x00000024, 0x00000009,
30 0x0004002b, 0x00000019, 0x00000025, 0x00000001, 0x00040020, 0x00000026, 0x00000009, 0x00000006, 30 0x0004002b, 0x00000019, 0x00000025, 0x00000001, 0x00040020, 0x00000026, 0x00000009, 0x00000006,
31 0x0004002b, 0x00000006, 0x0000002e, 0x00000005, 0x0004002b, 0x00000006, 0x00000031, 0x00000007, 31 0x0004002b, 0x00000006, 0x0000002b, 0x00000007, 0x0004002b, 0x00000006, 0x0000002f, 0x0000000a,
32 0x0004002b, 0x00000006, 0x00000036, 0x0000000a, 0x0004002b, 0x00000006, 0x00000040, 0x00000008, 32 0x0004002b, 0x00000006, 0x00000039, 0x00000008, 0x0004002b, 0x00000006, 0x00000057, 0x00000001,
33 0x0004002b, 0x00000006, 0x0000005e, 0x00000001, 0x0006002c, 0x00000009, 0x00000072, 0x00000013, 33 0x0006002c, 0x00000009, 0x0000006b, 0x00000013, 0x00000057, 0x00000057, 0x00050036, 0x00000002,
34 0x0000005e, 0x0000005e, 0x00050036, 0x00000002, 0x00000004, 0x00000000, 0x00000003, 0x000200f8, 34 0x00000004, 0x00000000, 0x00000003, 0x000200f8, 0x00000005, 0x00050041, 0x0000000d, 0x0000000e,
35 0x00000005, 0x00050041, 0x0000000d, 0x0000000e, 0x0000000b, 0x0000000c, 0x0004003d, 0x00000006, 35 0x0000000b, 0x0000000c, 0x0004003d, 0x00000006, 0x0000000f, 0x0000000e, 0x00060041, 0x0000001c,
36 0x0000000f, 0x0000000e, 0x00060041, 0x0000001c, 0x0000001d, 0x00000018, 0x0000001a, 0x0000000f, 36 0x0000001d, 0x00000018, 0x0000001a, 0x0000000f, 0x0004003d, 0x00000010, 0x0000001e, 0x0000001d,
37 0x0004003d, 0x00000010, 0x0000001e, 0x0000001d, 0x00050041, 0x00000026, 0x00000027, 0x00000024, 37 0x00050041, 0x00000026, 0x00000027, 0x00000024, 0x00000025, 0x0004003d, 0x00000006, 0x00000028,
38 0x00000025, 0x0004003d, 0x00000006, 0x00000028, 0x00000027, 0x000500aa, 0x0000001f, 0x00000029, 38 0x00000027, 0x000500aa, 0x0000001f, 0x00000029, 0x00000028, 0x0000000c, 0x000500aa, 0x0000001f,
39 0x00000028, 0x0000000c, 0x000400a8, 0x0000001f, 0x0000002a, 0x00000029, 0x000300f7, 0x0000002c, 39 0x0000002c, 0x0000000f, 0x0000002b, 0x000500a6, 0x0000001f, 0x0000002d, 0x00000029, 0x0000002c,
40 0x00000000, 0x000400fa, 0x0000002a, 0x0000002b, 0x0000002c, 0x000200f8, 0x0000002b, 0x000500ae, 40 0x000500aa, 0x0000001f, 0x00000030, 0x0000000f, 0x0000002f, 0x000500a6, 0x0000001f, 0x00000031,
41 0x0000001f, 0x0000002f, 0x0000000f, 0x0000002e, 0x000500b2, 0x0000001f, 0x00000032, 0x0000000f, 41 0x0000002d, 0x00000030, 0x000500ab, 0x0000001f, 0x00000035, 0x00000028, 0x0000000c, 0x000500a7,
42 0x00000031, 0x000500a7, 0x0000001f, 0x00000033, 0x0000002f, 0x00000032, 0x000200f9, 0x0000002c, 42 0x0000001f, 0x00000038, 0x00000035, 0x00000030, 0x000600a9, 0x00000006, 0x0000003b, 0x00000038,
43 0x000200f8, 0x0000002c, 0x000700f5, 0x0000001f, 0x00000034, 0x00000029, 0x00000005, 0x00000033, 43 0x00000039, 0x0000000f, 0x000200f9, 0x0000003d, 0x000200f8, 0x0000003d, 0x000700f5, 0x00000010,
44 0x0000002b, 0x000500aa, 0x0000001f, 0x00000037, 0x0000000f, 0x00000036, 0x000500a6, 0x0000001f, 44 0x0000007e, 0x0000001e, 0x00000005, 0x0000007f, 0x0000003e, 0x000700f5, 0x00000006, 0x0000006d,
45 0x00000038, 0x00000034, 0x00000037, 0x000500ab, 0x0000001f, 0x0000003c, 0x00000028, 0x0000000c, 45 0x0000000c, 0x00000005, 0x00000067, 0x0000003e, 0x000400f6, 0x0000003f, 0x0000003e, 0x00000000,
46 0x000500a7, 0x0000001f, 0x0000003f, 0x0000003c, 0x00000037, 0x000600a9, 0x00000006, 0x00000042, 46 0x000200f9, 0x00000041, 0x000200f8, 0x00000041, 0x000300f7, 0x00000044, 0x00000000, 0x000400fa,
47 0x0000003f, 0x00000040, 0x0000000f, 0x000200f9, 0x00000044, 0x000200f8, 0x00000044, 0x000700f5, 47 0x00000031, 0x00000043, 0x00000044, 0x000200f8, 0x00000043, 0x00050041, 0x00000026, 0x00000046,
48 0x00000010, 0x0000007f, 0x0000001e, 0x0000002c, 0x0000007c, 0x00000045, 0x000700f5, 0x00000006, 48 0x00000024, 0x0000001a, 0x0004003d, 0x00000006, 0x00000047, 0x00000046, 0x000500b0, 0x0000001f,
49 0x0000007d, 0x0000000c, 0x0000002c, 0x0000006e, 0x00000045, 0x000400f6, 0x00000046, 0x00000045, 49 0x00000048, 0x0000006d, 0x00000047, 0x000200f9, 0x00000044, 0x000200f8, 0x00000044, 0x000700f5,
50 0x00000000, 0x000200f9, 0x00000048, 0x000200f8, 0x00000048, 0x000300f7, 0x0000004b, 0x00000000, 50 0x0000001f, 0x00000049, 0x00000031, 0x00000041, 0x00000048, 0x00000043, 0x000400fa, 0x00000049,
51 0x000400fa, 0x00000038, 0x0000004a, 0x0000004b, 0x000200f8, 0x0000004a, 0x00050041, 0x00000026, 51 0x0000003e, 0x0000003f, 0x000200f8, 0x0000003e, 0x00050084, 0x00000006, 0x0000004c, 0x0000006d,
52 0x0000004d, 0x00000024, 0x0000001a, 0x0004003d, 0x00000006, 0x0000004e, 0x0000004d, 0x000500b0, 52 0x00000013, 0x00050080, 0x00000006, 0x0000004e, 0x0000004c, 0x0000003b, 0x00060041, 0x0000001c,
53 0x0000001f, 0x0000004f, 0x0000007d, 0x0000004e, 0x000200f9, 0x0000004b, 0x000200f8, 0x0000004b, 53 0x0000004f, 0x00000018, 0x00000025, 0x0000004e, 0x0004003d, 0x00000010, 0x00000050, 0x0000004f,
54 0x000700f5, 0x0000001f, 0x00000050, 0x00000038, 0x00000048, 0x0000004f, 0x0000004a, 0x000400fa, 54 0x00050051, 0x00000006, 0x00000053, 0x0000007e, 0x00000000, 0x00050051, 0x00000006, 0x00000055,
55 0x00000050, 0x00000045, 0x00000046, 0x000200f8, 0x00000045, 0x00050084, 0x00000006, 0x00000053, 55 0x00000050, 0x00000000, 0x00050080, 0x00000006, 0x00000056, 0x00000053, 0x00000055, 0x00050051,
56 0x0000007d, 0x00000013, 0x00050080, 0x00000006, 0x00000055, 0x00000053, 0x00000042, 0x00060041, 56 0x00000006, 0x00000059, 0x00000050, 0x00000001, 0x000500b0, 0x0000001f, 0x0000005d, 0x00000056,
57 0x0000001c, 0x00000056, 0x00000018, 0x00000025, 0x00000055, 0x0004003d, 0x00000010, 0x00000057, 57 0x00000053, 0x000600a9, 0x00000006, 0x0000005e, 0x0000005d, 0x00000057, 0x0000000c, 0x00050080,
58 0x00000056, 0x00050051, 0x00000006, 0x0000005a, 0x0000007f, 0x00000000, 0x00050051, 0x00000006, 58 0x00000006, 0x0000005f, 0x00000059, 0x0000005e, 0x00050051, 0x00000006, 0x00000061, 0x0000007e,
59 0x0000005c, 0x00000057, 0x00000000, 0x00050080, 0x00000006, 0x0000005d, 0x0000005a, 0x0000005c, 59 0x00000001, 0x00050080, 0x00000006, 0x00000062, 0x00000061, 0x0000005f, 0x00050050, 0x00000010,
60 0x00050051, 0x00000006, 0x00000060, 0x00000057, 0x00000001, 0x000500b0, 0x0000001f, 0x00000064, 60 0x0000007f, 0x00000056, 0x00000062, 0x00050080, 0x00000006, 0x00000067, 0x0000006d, 0x00000025,
61 0x0000005d, 0x0000005a, 0x000600a9, 0x00000006, 0x00000065, 0x00000064, 0x0000005e, 0x0000000c, 61 0x000200f9, 0x0000003d, 0x000200f8, 0x0000003f, 0x0003003e, 0x0000001d, 0x0000007e, 0x000100fd,
62 0x00050080, 0x00000006, 0x00000066, 0x00000060, 0x00000065, 0x00050051, 0x00000006, 0x00000068, 62 0x00010038,
63 0x0000007f, 0x00000001, 0x00050080, 0x00000006, 0x00000069, 0x00000068, 0x00000066, 0x00050050,
64 0x00000010, 0x0000007c, 0x0000005d, 0x00000069, 0x00050080, 0x00000006, 0x0000006e, 0x0000007d,
65 0x00000025, 0x000200f9, 0x00000044, 0x000200f8, 0x00000046, 0x0003003e, 0x0000001d, 0x0000007f,
66 0x000100fd, 0x00010038,
67}; 63};
68 64
69} // namespace leonida 65} // namespace leonida
diff --git a/runtime/src/vulkan_backend.h b/runtime/src/vulkan_backend.h
index e3e4defe8..89d0f00dd 100644
--- a/runtime/src/vulkan_backend.h
+++ b/runtime/src/vulkan_backend.h
@@ -244,12 +244,12 @@ public:
244 244
245 // Adds `count` pipeline-statistics results into one D3D12_QUERY_DATA_PIPELINE_STATISTICS at dst + offset: the 245 // Adds `count` pipeline-statistics results into one D3D12_QUERY_DATA_PIPELINE_STATISTICS at dst + offset: the
246 // segments of a statistics query that was split around helper dispatches (D3D-162) or mesh draws (D3D-291). 246 // segments of a statistics query that was split around helper dispatches (D3D-162) or mesh draws (D3D-291).
247 // Segment i is in `mesh_queries` when mesh[i] is set (four counters: clipping, fragment and compute; see 247 // Segment i is in `mesh_queries` when mesh[i] is set (two counters: fragment and compute; see
248 // statistics_sum.comp), otherwise in `queries` (all eleven). 248 // statistics_sum.comp), otherwise in `queries` (all eleven).
249 void sum_statistics(VkCommandBuffer cb, VkQueryPool queries, VkQueryPool mesh_queries, const std::uint8_t* mesh, 249 void sum_statistics(VkCommandBuffer cb, VkQueryPool queries, VkQueryPool mesh_queries, const std::uint8_t* mesh,
250 std::uint32_t first, std::uint32_t count, VkBuffer dst, VkDeviceSize offset) const { 250 std::uint32_t first, std::uint32_t count, VkBuffer dst, VkDeviceSize offset) const {
251 constexpr VkDeviceSize result = statistics_counters * word_size; 251 constexpr VkDeviceSize result = statistics_counters * word_size;
252 constexpr VkDeviceSize mesh_slot = 5 * word_size; // CInvocations, where the mesh pool's first counter goes 252 constexpr VkDeviceSize mesh_slot = 7 * word_size; // PSInvocations, where the mesh pool's first counter goes
253 begin_scratch_write(cb); 253 begin_scratch_write(cb);
254 vk_.vkCmdFillBuffer(cb, scratch_, 0, result, 0); 254 vk_.vkCmdFillBuffer(cb, scratch_, 0, result, 0);
255 bind(cb, statistics_pipeline_); 255 bind(cb, statistics_pipeline_);
@@ -2443,15 +2443,12 @@ private:
2443 if (std::find(statistics->mesh.begin(), statistics->mesh.end(), 1) == statistics->mesh.end()) { 2443 if (std::find(statistics->mesh.begin(), statistics->mesh.end(), 1) == statistics->mesh.end()) {
2444 statistics->mesh.clear(); 2444 statistics->mesh.clear();
2445 } else { 2445 } else {
2446 // The counters a mesh draw allows (VUID-vkCmdDrawMeshTasksEXT-pipelineStatistics-07076): clipping 2446 // The counters a mesh draw allows (VUID-vkCmdDrawMeshTasksEXT-pipelineStatistics-07076): the
2447 // invocations and primitives, fragment and compute invocations (D3D-291). 2447 // fragment and compute invocations, and no other (D3D-291).
2448 VkQueryPoolCreateInfo info{VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO}; 2448 VkQueryPoolCreateInfo info{VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO};
2449 info.queryType = VK_QUERY_TYPE_PIPELINE_STATISTICS; 2449 info.queryType = VK_QUERY_TYPE_PIPELINE_STATISTICS;
2450 info.queryCount = statistics_segments; 2450 info.queryCount = statistics_segments;
2451 info.pipelineStatistics = VK_QUERY_PIPELINE_STATISTIC_CLIPPING_INVOCATIONS_BIT | 2451 info.pipelineStatistics = kMeshStatisticsFlags;
2452 VK_QUERY_PIPELINE_STATISTIC_CLIPPING_PRIMITIVES_BIT |
2453 VK_QUERY_PIPELINE_STATISTIC_FRAGMENT_SHADER_INVOCATIONS_BIT |
2454 VK_QUERY_PIPELINE_STATISTIC_COMPUTE_SHADER_INVOCATIONS_BIT;
2455 if (context_.vk.vkCreateQueryPool(statistics->device, &info, nullptr, &statistics->mesh_pool) != 2452 if (context_.vk.vkCreateQueryPool(statistics->device, &info, nullptr, &statistics->mesh_pool) !=
2456 VK_SUCCESS) 2453 VK_SUCCESS)
2457 return ReplayResult::unsupported; 2454 return ReplayResult::unsupported;
diff --git a/runtime/src/vulkan_replay.h b/runtime/src/vulkan_replay.h
index 889bb71f7..b1f6fab38 100644
--- a/runtime/src/vulkan_replay.h
+++ b/runtime/src/vulkan_replay.h
@@ -2344,10 +2344,26 @@ inline ReplayResult plan_occlusion_segments(PreparedList& out) {
2344// Helper dispatches must not contribute to the application's CSInvocations (D3D-162). Query resolves and 2344// Helper dispatches must not contribute to the application's CSInvocations (D3D-162). Query resolves and
2345// ordinary helper commands share one sequence of physical statistics segments. Resolve dispatch requirements 2345// ordinary helper commands share one sequence of physical statistics segments. Resolve dispatch requirements
2346// depend on heap state at planning time, so every non-timestamp resolve splits conservatively. 2346// depend on heap state at planning time, so every non-timestamp resolve splits conservatively.
2347// A mesh draw cannot run while a query with the input-assembly, vertex, geometry or tessellation counters is active 2347// The counters a mesh draw may count: VUID-vkCmdDrawMeshTasksEXT-pipelineStatistics-07076 leaves the input
2348// (VUID-vkCmdDrawMeshTasksEXT-pipelineStatistics-07076), though D3D12 allows it and reads those fields as 0. A query 2348// assembly, vertex, geometry, tessellation and clipping bits out of the pipelineStatistics flags of every pool that
2349// that holds a mesh draw is split as well (D3D-291): a segment's first draw decides whether it runs in the full pool 2349// is active during a mesh draw, so a mesh segment runs in a pool with the fragment and compute counters only
2350// or in the mesh one (statistics_mesh), and a later draw of the other kind ends it and begins one of its own kind. 2350// (D3D-291). D3D12 counts the clipping invocations and primitives of a mesh pipeline, but Vulkan has no counter for
2351// them during a mesh draw, so those two fields read 0.
2352inline constexpr VkQueryPipelineStatisticFlags kMeshStatisticsFlags =
2353 VK_QUERY_PIPELINE_STATISTIC_FRAGMENT_SHADER_INVOCATIONS_BIT | VK_QUERY_PIPELINE_STATISTIC_COMPUTE_SHADER_INVOCATIONS_BIT;
2354// The bits the same VUID forbids in a pool that is active during a mesh draw.
2355inline constexpr VkQueryPipelineStatisticFlags kForbiddenMeshStatisticsFlags =
2356 VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_VERTICES_BIT | VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_PRIMITIVES_BIT |
2357 VK_QUERY_PIPELINE_STATISTIC_VERTEX_SHADER_INVOCATIONS_BIT | VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_INVOCATIONS_BIT |
2358 VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_PRIMITIVES_BIT | VK_QUERY_PIPELINE_STATISTIC_CLIPPING_INVOCATIONS_BIT |
2359 VK_QUERY_PIPELINE_STATISTIC_CLIPPING_PRIMITIVES_BIT |
2360 VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_CONTROL_SHADER_PATCHES_BIT |
2361 VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_EVALUATION_SHADER_INVOCATIONS_BIT;
2362// A mesh draw cannot run while a query with the input-assembly, vertex, geometry, tessellation or clipping counters
2363// is active (VUID-vkCmdDrawMeshTasksEXT-pipelineStatistics-07076), though D3D12 allows it and reads those fields as
2364// 0. A query that holds a mesh draw is split as well (D3D-291): a segment's first draw decides whether it runs in
2365// the full pool or in the mesh one (statistics_mesh), and a later draw of the other kind ends it and begins one of
2366// its own kind.
2351// Dispatches and segments without draws use the full pool; ExecuteIndirect draws count as vertex draws. Each draw 2367// Dispatches and segments without draws use the full pool; ExecuteIndirect draws count as vertex draws. Each draw
2352// has its own rendering scope, so a split before one stays outside rendering, as a helper's does. 2368// has its own rendering scope, so a split before one stays outside rendering, as a helper's does.
2353inline void plan_statistics_segments(PreparedList& out) { 2369inline void plan_statistics_segments(PreparedList& out) {