Skip to content

Runtime: pipeline-statistics queries around mesh draws (D3D-291) - #2359

Merged
shayderrr merged 3 commits into
ProjectLeonida:mainfrom
LloydNicholson:runtime/mesh-statistics
Nov 23, 2026
Merged

shayderrr merged 3 commits into
ProjectLeonida:mainfrom
LloydNicholson:runtime/mesh-statistics

Conversation

@LloydNicholson

@LloydNicholson LloydNicholson commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as D3D-291: #2078 (comment)

Depends on: #1712 (D3D-29, mesh-shader PSOs and DispatchMesh). This branch is stacked on it, so until #1712 merges the diff also shows its two commits. The change here is the last commit, 940ab5d, on main f847748.

What and why

The problem. D3D12 allows DispatchMesh inside a PIPELINE_STATISTICS query and reads its IA/VS/GS/HS/DS fields as 0. Vulkan forbids vkCmdDrawMeshTasksEXT while a query with those counters is active (VUID-vkCmdDrawMeshTasksEXT-pipelineStatistics-07076). The heap's pool is always created with all eleven counters (0x7ff). Gen800 found this in review of #1712.

The fix reuses the D3D-162 split of a statistics query into physical segments:

  • Planning (plan_statistics_segments): a statistics query that holds a mesh draw is split, like one that holds a resolve or one of the other helpers. Mesh draws share the segment numbering of the helper splits.
    • A segment's first draw picks its pool: the submission's full pool, or a second pool with only CLIPPING_INVOCATIONS, CLIPPING_PRIMITIVES, FRAGMENT_SHADER_INVOCATIONS and COMPUTE_SHADER_INVOCATIONS.
    • A later draw of the other kind ends the segment and begins one of its own kind. A query that keeps switching kinds gets one segment per run.
    • Dispatches and segments without draws use the full pool, and ExecuteIndirect draws count as vertex draws.
  • Emit: the split points before draws use the per-command fields the helpers already have (Prepared::statistics_end/begin), so the draw itself still runs. Each draw has its own rendering scope, so the split stays outside rendering. The per-command split helpers, and emit_query's, now pick the pool by the segment's kind, since a helper or resolve can end a mesh segment.
  • Resolve: the sum copies a mesh segment's four counters into fields 5–8 of its record. statistics_sum.comp gains a mesh push constant and adds them as CInvocations, CPrimitives, PSInvocations and CSInvocations, so the other fields get nothing from that segment.
    • A query with only mesh draws is one mesh segment, and goes through the same sum.
    • statistics_sum_spirv.h is regenerated as its header says: glslangValidator -V --target-env vulkan1.0 -Os -g0, then spirv-val.
  • Refusal: without the compute helper there is no segment pool. A list that needs the split is then refused with unsupported rather than run unsplit around a mesh draw.
  • Docs: docs/d3d12_vulkan.md §4.6 has the rule.

Queries without mesh draws are planned exactly as before.

Mixed queries: a query over vertex and mesh draws counts both. The vertex draws' IA/VS counts are kept, and the mesh draws add their clipping, pixel and compute counts.

Rebased onto main f847748: main added D3D-252's overlapping statistics queries, with a second planner, plan_overlapping_statistics_segments. That planner now records each segment's kind and splits at a mesh/vertex switch the same way, so overlapping queries around mesh draws stay out of the forbidden state too. replay_query_edges_test (new on main) now calls sum_statistics with the mesh pool and kinds, and expects the 8-byte push constant.

Tested

AI-assisted (Claude Code). RX 9060 XT (RDNA4, GFX1200), RADV Mesa 27.0.0-devel, Nobara Linux. Windows binaries cross-built with clang-cl 22 and the 10.0.26100 SDK, run under Wine 11.22. Native tests built with GCC.

  • replay_query_predication_test cases 14 and 15 (CPU, new): case 14 is a single query; case 15 is the same split inside overlapping queries (D3D-252's planner, see below).
    • The query holds vertex, mesh, mesh and vertex draws. It splits before the first mesh draw and before the vertex draw after it, giving three segments with kinds full, mesh, full; the second mesh draw doesn't split. Its resolve sums all three.
    • A mesh-only query is one mesh segment, and its resolve goes through the sum with the mesh pool.
    • A vertex-only query is not split.
    • Planning is refused without the mesh pool, and without a segment pool. Cases 1–13 still pass.
  • d3d12_mesh_test (GPU, extended): three queries in one list, on a mixed, a mesh-only and a vertex-only range.
    • The vertex fields of the mixed and vertex-only queries are exactly 6 vertices and 2 primitives.
    • The mesh-only query reads 0 in IA/VS/GS/HS/DS/CS.
    • The mixed query has more clipping and pixel-shader invocations than the vertex-only one.
    • On RADV the clipping counts add up exactly: mixed 12 = vertex-only 2 + mesh 8 + 2. RADV's PSInvocations isn't the pixel count, so the test compares against the vertex-only query rather than an absolute number.
    • The D3D-29 pixel checks are unchanged: 4096/4096.
  • Validation: VK_LAYER_KHRONOS_validation 1.4.341 (Fedora) reports nothing beyond the two VUIDs that come from this host's environment.
    • ⚠️ I could not reproduce the error itself here. With the layer change undone, the same test also ran without a 07076 report on this layer version, though the layer contains the VUID. Gen800 saw it with SDK 1.4.363 on NVIDIA.
    • A run on Windows with a current SDK layer (@Gen800, or @undeadhuman37 on the RTX 4070 SUPER) would confirm the fix against the report.
  • D3D-162 paths: vk_overlapping_occlusion, vk_binary_occlusion, vk_predicated_copy, depth24_convert and replay_query_predication pass natively under validation, with no messages.
  • Native ctest: 41/41 passed (2 skipped). The query and helper tests (vk_overlapping_occlusion, vk_binary_occlusion, vk_predicated_copy, depth24_convert, replay_query_predication, replay_query_edges) pass under validation.
  • d3d12_* under Wine (53 tests): 6 fail, and all 6 fail the same way on main f847748 on this machine (d3d12_clear, d3d12_compute, d3d12_fence_timing, d3d12_private_data, d3d12_subresource_copy, d3d12_xdxr_rt).
  • Doc checks: tests/test_docs_links.py and tests/test_text_write_line_endings.py pass.

Not tested: Windows/MSVC with Microsoft's loader and a current validation layer; NVIDIA or Intel; ExecuteIndirect mesh draws, which the layer doesn't have yet.

Checklist

  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • No translator rule changed.

🤖 Generated with Claude Code

@TricksterG

Copy link
Copy Markdown
Contributor

Tested on an NVIDIA GeForce RTX 5090 (Windows 11, driver 621.24, Vulkan SDK 1.4.363.0), built at ec3e628 (current head, same result as at 07f7530 before the rebase), LEONIDA_VK_VALIDATION=1.

replay_query_predication passes. d3d12_mesh fails with 3 validation errors, which are the VUID this PR targets:

validation: vkCmdDrawMeshTasksEXT(): query 1 in VkQueryPool 0x2f000000002f with type VK_QUERY_TYPE_PIPELINE_STATISTICS is active, which is invalid because it was created with pipelineStatistics (VK_QUERY_PIPELINE_STATISTIC_CLIPPING_INVOCATIONS_BIT|VK_QUERY_PIPELINE_STATISTIC_CLIPPING_PRIMITIVES_BIT)
(same for query 1 again and query 3)
3 validation errors
statistics, mixed: IA 6/2 VS 6 C 12/12 PS 3328 CS 0; mesh only: C 8/8 PS 1024; vertex only: C 2 PS 2048

VUID-vkCmdDrawMeshTasksEXT-pipelineStatistics-07076 forbids CLIPPING_INVOCATIONS and CLIPPING_PRIMITIVES as well, not only IA/VS/GS/HS/DS. The mesh pool in vulkan_backend.h still includes both, and the code comment says the reverse. It should probably only keep FRAGMENT_SHADER_INVOCATIONS and COMPUTE_SHADER_INVOCATIONS, plus the mesh/task counters if wanted. That means reporting C 0/0 for mesh ranges, and the test expectations change with it. llvmpipe likely doesn't expose mesh shaders, so this path needs a real GPU to show up.

@Dom-in

Dom-in commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Windows + GPU check: AMD Radeon RX 9070 (RDNA4), Windows 11, MSVC Release, Vulkan SDK 1.4.363. Tested head ec3e628 merged onto main 4947579 (clean merge), full build, full ctest -C Release -j 4: 100% tests passed out of 117 | new failures vs main: none. The main baseline on the same machine passes 107/107, so nothing regresses here.

AI-assisted (Claude Code); runs on my machine.

@Gen800

Gen800 commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Independent verification on RTX 5060 Ti, NVIDIA 621.14, Windows 11 Pro, MSVC 19.44 + Ninja, Vulkan SDK/validation layer 1.4.363.0.

Tested PR head ec3e628d against #1712 47e8b421 and main 49475796.

Confirmed TricksterG's finding:

  • d3d12_mesh with LEONIDA_VK_VALIDATION=1: 3 × VUID-vkCmdDrawMeshTasksEXT-pipelineStatistics-07076, reproducible 5/5 runs.
  • Validation-layer loading confirmed through VK_LOADER_DEBUG=layer.
  • api_dump confirms the mesh query pool uses 0x4E0, including forbidden CLIPPING_INVOCATIONS and CLIPPING_PRIMITIVES bits.
  • Two errors originate from the mixed query's mesh draws; one from the mesh-only query.
  • Without validation, the full CTest suite completes successfully. With validation, only d3d12_mesh fails.

Additional findings:

The current test expects nonzero clipping statistics from mesh draws. Those values depend on counters Vulkan prohibits for this operation. The documentation in §4.6 and the comment in vulkan_backend.h also need correction.

Locally tested minimal fix (not pushed):

  • Keep only FRAGMENT_SHADER_INVOCATIONS and COMPUTE_SHADER_INVOCATIONS in the mesh-compatible pool.
  • Map mesh PSInvocations to slot 7.
  • Update the statistics sum shader, regenerate its SPIR-V header, and adjust the test expectations.

Results after this change:

  • 0 Vulkan validation errors, 5/5 runs
  • Mixed: IA 6/2, clipping 2/2, PS 3328
  • Mesh-only: clipping 0/0, PS 1024
  • Vertex-only: clipping 2, PS 2048

The full unmodified GPU suite had identical verdicts across the three tested revisions (139 passed, 46 skipped out of 185), and 2,567 semantic tests passed.

One design question: should mesh clipping counters explicitly return zero for now, with that limitation documented, or should mapping mesh-specific statistics be tracked separately?

The segment-splitting approach otherwise looks promising. I recommend correcting the query mask and expectations before merging.

Synthetic fixtures only; no game data. AI-assisted verification (Claude Code).

@umnitus

umnitus commented Nov 22, 2026

Copy link
Copy Markdown

Confirmed the RTX 5090 report on an RTX 3060 12 GB at ec3e628, Windows 11, driver 621.14, Vulkan 1.4.357, Khronos validation 1.4.363.

With LEONIDA_VK_VALIDATION=1, d3d12_mesh_test exited 1 in two consecutive runs. Each run reported exactly three VUID-vkCmdDrawMeshTasksEXT-pipelineStatistics-07076 errors (query 1 twice and query 3 once), with both CLIPPING_INVOCATIONS and CLIPPING_PRIMITIVES set. The same binary exited 0 with validation off. replay_query_predication_test passed.

AI-assisted testing and write-up.

@Gabzinnn12

Copy link
Copy Markdown

Same on AMD: tested ec3e628 on AMD Radeon RX 7600 (RDNA3), AMD 26.11.2 (LLPC), Windows 11, MSVC 19.44, Vulkan SDK 1.4.363.0. d3d12_mesh_test passes without validation; with LEONIDA_VK_VALIDATION=1 it reports the same 3 errors @TricksterG saw: VUID-vkCmdDrawMeshTasksEXT-pipelineStatistics-07076 for queries 1 (twice) and 3, pool created with CLIPPING_INVOCATIONS|CLIPPING_PRIMITIVES. So it is not NVIDIA-specific.
The VUID lists both CLIPPING bits as forbidden while a mesh draw runs, so the mesh segments' second pool still trips it. Dropping those two bits from that pool would satisfy the VUID, but the statistics mapping and the test's expected mesh clipping counts would need to change with it.
#1712 at 47e8b42 passes d3d12_mesh_test with validation here. ctest (no validation): 0 failed out of 125.

AI-assisted (Claude Code, reviewed with Codex). No game files.

@LloydNicholson
LloydNicholson force-pushed the runtime/mesh-statistics branch from ec3e628 to 46f7314 Compare November 22, 2026 18:30
@FaKL-Code

Copy link
Copy Markdown
Contributor

Tested ec3e628 (merged onto main 4947579) on NVIDIA GeForce RTX 4060 Ti, driver 610.88 (32.0.16.1088), Windows 11 26200, MSVC 14.51.36231 (VS 2026), Vulkan SDK 1.4.363.0: fails under validation

  • Clean configure + build of runtime/ (Visual Studio generator, RelWithDebInfo): the only new warnings are two C4324s (structure padded for alignment) at runtime/test/d3d12_mesh_test.cpp:44, in the test's Subobject template; nothing new in the runtime itself.

  • ctest -C RelWithDebInfo -j 4: 117/117 passed without validation (loader run on its own; 7 skipped for missing inputs or optional components, gameinput disabled, as on main). d3d12_mesh prints statistics, mixed: IA 6/2 VS 6 C 12/12 PS 3328 CS 0; mesh only: C 8/8 PS 1024; vertex only: C 2 PS 2048.

  • With LEONIDA_VK_VALIDATION=1, d3d12_mesh fails: the layer from SDK 1.4.363.0 reports VUID-vkCmdDrawMeshTasksEXT-pipelineStatistics-07076 three times and the test ends with "3 validation errors". The first one:

    vkCmdDrawMeshTasksEXT(): query 1 in VkQueryPool … with type VK_QUERY_TYPE_PIPELINE_STATISTICS is active, which is invalid because it was created with pipelineStatistics (VK_QUERY_PIPELINE_STATISTIC_CLIPPING_INVOCATIONS_BIT|VK_QUERY_PIPELINE_STATISTIC_CLIPPING_PRIMITIVES_BIT) which is incompatible with mesh shaders.

    The spec text it quotes lists CLIPPING_INVOCATIONS_BIT and CLIPPING_PRIMITIVES_BIT among the bits an active query must not contain during a mesh draw, together with IA, VS, GS and tessellation. The new mesh pool at runtime/src/vulkan_backend.h:1630 keeps both clipping bits, and the comment above it says 07076 allows them. On this SDK it doesn't. This is the same SDK as the original NVIDIA report, which may be why it didn't show up on your side.

    Dropping the two clipping bits from the mesh pool (FRAGMENT_SHADER_INVOCATIONS and COMPUTE_SHADER_INVOCATIONS only) and reading C as 0 for mesh-only segments, the way IA/VS already are, should clear it. The mesh-only C 8/8 above would then become 0.

  • The other 7 tests in the validation pass (command_list, d3d12_com, d3d12_vulkan_device, d3d12_fence_timing, d3d12_descriptor, d3d12_compute, d3d12_state_map) pass with validation.

AI-assisted (Claude).

@LloydNicholson
LloydNicholson force-pushed the runtime/mesh-statistics branch from 46f7314 to 940ab5d Compare November 22, 2026 20:18
itsRevela added a commit to itsRevela/Leonida that referenced this pull request Nov 22, 2026
ID3D12Device::CreateQueryHeap refused D3D12_QUERY_HEAP_TYPE_PIPELINE_STATISTICS1. It now creates one on a device
with VK_EXT_mesh_shader's meshShaderQueries (enabled with meshShader where the GPU has it, and reported through
OPTIONS9.MeshShaderPipelineStatsSupported); without it the heap is still refused with E_NOTIMPL. Built on D3D-291
(ProjectLeonida#2359), which splits a statistics query around mesh draws into full and mesh-pool segments.

- The heap's pool counts the 11 classic statistics plus TASK_SHADER_INVOCATIONS (0x800) and
  MESH_SHADER_INVOCATIONS (0x1000); Vulkan writes them in bit order after CSInvocations, the order of
  ASInvocations and MSInvocations. Neither bit is forbidden around vertex draws (only around
  vkCmdDrawClusterHUAWEI, VUID-07819).
- A query that holds a mesh draw is always split (VUID-vkCmdDrawMeshTasksEXT-pipelineStatistics-07076, D3D-291), so
  an unsplit query ran no mesh draw: the resolve copies its 13 statistics 112 bytes apart and writes MSPrimitives
  as 0.
- With a split PIPELINE_STATISTICS1 query in the submission, the mesh pool also counts task and mesh invocations
  (6 counters), and each mesh segment runs a VK_QUERY_TYPE_MESH_PRIMITIVES_GENERATED_EXT query of its index beside
  it; full segments run none. No VUID ties those queries to the draw kind (07068, 07070, 07071), but NVIDIA's
  Vulkan driver counts a VS draw's triangles in them and D3D12 does not, so MSPrimitives is counted only around
  mesh draws.
- A split PIPELINE_STATISTICS1 query always resolves through the sum. statistics_sum.comp takes the result width
  (11 or 14) as a push constant and maps a mesh segment's task and mesh invocations and primitives to fields 11-13.
  statistics_sum_spirv.h is regenerated with glslang 16.6.0 (-V --target-env vulkan1.0 -Os -g0; spirv-val clean).

Tested on Windows 11, NVIDIA GeForce RTX 3070 Ti, driver 610.88, without Vulkan validation layers (not installed):
ctest 125/125 passed, 8 skipped (game data, the validation layer, an RGB9E5 RTV); ProjectLeonida#2359's head alone: 124/124
passed, the same 8 skipped. New: d3d12_mesh_statistics runs one list on the layer and on host D3D12 (DXIL from
HLSL equivalents compiled at run time by the Windows SDK's dxcompiler.dll): a VS draw in PIPELINE_STATISTICS1 and
PIPELINE_STATISTICS queries, DispatchMesh(2,2,1) and (1,1,2), a query never ended, and a query split by a resolve
inside it, resolved at an offset. Every one of the 14 fields matches the host. replay_query_predication cases
10-12 cover the unsplit resolve, the primitives queries beside mesh segments only, the refusals and the 14-counter
sum; d3d12_query_rules compares PIPELINE_STATISTICS1 heap creation by count and node mask with WARP and the GPU.
The host's refusal HRESULT is unmeasured: every host adapter here (WARP, RTX 3070 Ti) supports these heaps.

Depends on: ProjectLeonida#1712, ProjectLeonida#2359
AI-assisted (Claude Code).
@JRamos1993

Copy link
Copy Markdown
Contributor

Tested 940ab5d as-is (stacked on #1712) on an RTX 5090 (driver 616.92), Windows 11, MSVC 19.44, Vulkan SDK 1.4.363, RelWithDebInfo:

  • Full ctest: 142/142 without validation.
  • d3d12_mesh, replay_query_edges and replay_query_predication: pass 20 of 20 runs each.
  • Under LEONIDA_VK_VALIDATION=1: d3d12_mesh still fails with the three VUID-vkCmdDrawMeshTasksEXT-pipelineStatistics-07076 errors reported above. The push after those reports didn't change this. The two replay tests pass.
  • For comparison, d3d12_mesh at Runtime: mesh-shader PSOs from pipeline state streams and DispatchMesh (D3D-29) #1712's head d8102a2 passes under validation with 0 messages, so the errors come from this PR's statistics queries.

AI-assisted (Claude Code).

@sh1shu1

sh1shu1 commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Tested 9d13a65 on NVIDIA RTX 4070 SUPER (driver 616.92), Windows 11 26200, MSVC 14.44, Vulkan SDK 1.4.363, RelWithDebInfo: fail.

  • ctest: 243/248 passed; fails here, passes on main 561b65a: d3d12_mesh; d3d12_indirect_dispatch_count, d3d12_indirect_rt, dxgi_device, dxgi_swapchain fails on main 561b65a too (not from this PR), same 11 skips as main 561b65a
  • d3d12_mesh, replay_query_edges, replay_query_predication: 2/3
  • run_gpu_tests (LEONIDA_VK_VALIDATION=1): 183/232 native, 214/232 with LEONIDA_W64_EMULATE=1, 2 failed; ms_wave_info_s3 fails on main 561b65a too
    AI-assisted (Claude Code, Claude Fable 5.1).

@shayderrr shayderrr left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

Implements D3D-29 mesh support: VK_EXT_mesh_shader is enabled when available and reflected in D3D12_OPTIONS7; CreatePipelineState parses stream subobjects in d3dx12 layout with the runtime defaults; mesh PSOs use the MS/PS pair and validate against device mesh limits; ID3D12GraphicsCommandList6::DispatchMesh records a mesh draw with grid limits, replayed via vkCmdDrawMeshTasksEXT. Statistics queries split mesh draws into their own segment pool with summed counters. Adds ms_draw.mesh, d3d12_mesh_test (pixel-checked on an RX 9060 XT), and full docs.

Why merge

Mesh shaders and state-stream PSOs are core D3D12 entry points that previously failed outright. This delivers both with measured hardware validation and explicit handling of the query interaction, guarded by capability checks so unsupported devices skip cleanly.

Verdict: Approve

@shayderrr

Copy link
Copy Markdown
Collaborator

Summary

Implements D3D-29 mesh support: VK_EXT_mesh_shader is enabled when available and reflected in D3D12_OPTIONS7; CreatePipelineState parses stream subobjects in d3dx12 layout with the runtime defaults; mesh PSOs use the MS/PS pair and validate against device mesh limits; ID3D12GraphicsCommandList6::DispatchMesh records a mesh draw with grid limits, replayed via vkCmdDrawMeshTasksEXT. Statistics queries split mesh draws into their own segment pool with summed counters. Adds ms_draw.mesh, d3d12_mesh_test (pixel-checked on an RX 9060 XT), and full docs.

Why merge

Mesh shaders and state-stream PSOs are core D3D12 entry points that previously failed outright. This delivers both with measured hardware validation and explicit handling of the query interaction, guarded by capability checks so unsupported devices skip cleanly.

Verdict: Approve

@shayderrr
shayderrr merged commit 56e607a into ProjectLeonida:main Nov 23, 2026
0 of 5 checks passed
jeremygold02 added a commit to jeremygold02/Leonida that referenced this pull request Nov 23, 2026
Verify the sparse mesh input and shared vertex-stage pixel shader while retaining main's query checks around the same draws.

Refs: ItsNotRexed#2359, ItsNotRexed#4954
itsRevela added a commit to itsRevela/Leonida that referenced this pull request Nov 23, 2026
ID3D12Device::CreateQueryHeap refused D3D12_QUERY_HEAP_TYPE_PIPELINE_STATISTICS1. It now creates one on a device
with VK_EXT_mesh_shader's meshShaderQueries (enabled with meshShader where the GPU has it, and reported through
OPTIONS9.MeshShaderPipelineStatsSupported); without it the heap is still refused with E_NOTIMPL. Built on D3D-291
(ItsNotRexed#2359), which splits a statistics query around mesh draws into full and mesh-pool segments.

- The heap's pool counts the 11 classic statistics plus TASK_SHADER_INVOCATIONS (0x800) and
  MESH_SHADER_INVOCATIONS (0x1000); Vulkan writes them in bit order after CSInvocations, the order of
  ASInvocations and MSInvocations. Neither bit is forbidden around vertex draws (only around
  vkCmdDrawClusterHUAWEI, VUID-07819).
- A query that holds a mesh draw is always split (VUID-vkCmdDrawMeshTasksEXT-pipelineStatistics-07076, D3D-291), so
  an unsplit query ran no mesh draw: the resolve copies its 13 statistics 112 bytes apart and writes MSPrimitives
  as 0.
- With a split PIPELINE_STATISTICS1 query in the submission, the mesh pool also counts task and mesh invocations
  (6 counters), and each mesh segment runs a VK_QUERY_TYPE_MESH_PRIMITIVES_GENERATED_EXT query of its index beside
  it; full segments run none. No VUID ties those queries to the draw kind (07068, 07070, 07071), but NVIDIA's
  Vulkan driver counts a VS draw's triangles in them and D3D12 does not, so MSPrimitives is counted only around
  mesh draws.
- A split PIPELINE_STATISTICS1 query always resolves through the sum. statistics_sum.comp takes the result width
  (11 or 14) as a push constant and maps a mesh segment's task and mesh invocations and primitives to fields 11-13.
  statistics_sum_spirv.h is regenerated with glslang 16.6.0 (-V --target-env vulkan1.0 -Os -g0; spirv-val clean).

Tested on Windows 11, NVIDIA GeForce RTX 3070 Ti, driver 610.88, without Vulkan validation layers (not installed):
ctest 125/125 passed, 8 skipped (game data, the validation layer, an RGB9E5 RTV); ItsNotRexed#2359's head alone: 124/124
passed, the same 8 skipped. New: d3d12_mesh_statistics runs one list on the layer and on host D3D12 (DXIL from
HLSL equivalents compiled at run time by the Windows SDK's dxcompiler.dll): a VS draw in PIPELINE_STATISTICS1 and
PIPELINE_STATISTICS queries, DispatchMesh(2,2,1) and (1,1,2), a query never ended, and a query split by a resolve
inside it, resolved at an offset. Every one of the 14 fields matches the host. replay_query_predication cases
10-12 cover the unsplit resolve, the primitives queries beside mesh segments only, the refusals and the 14-counter
sum; d3d12_query_rules compares PIPELINE_STATISTICS1 heap creation by count and node mask with WARP and the GPU.
The host's refusal HRESULT is unmeasured: every host adapter here (WARP, RTX 3070 Ti) supports these heaps.

Depends on: ItsNotRexed#1712, ItsNotRexed#2359
AI-assisted (Claude Code).
itsRevela added a commit to itsRevela/Leonida that referenced this pull request Nov 23, 2026
…onstant (D3D-132)

main's chunk-boundary test (added after ProjectLeonida#2359) checks a two-word push
constant; D3D-132 adds a third, the result's counters (11 here, 14 for
PIPELINE_STATISTICS1). Its sum_statistics calls take the new primitives
pool and counters arguments.
AimLogin added a commit to AimLogin/Leonida that referenced this pull request Nov 23, 2026
One conflict, in the device-extension list of
runtime/shims/d3d12_vulkan_device.cpp: main's VK_EXT_mesh_shader
(ItsNotRexed#2359, D3D-291) and DRED's optional VK_AMD_buffer_marker /
VK_EXT_device_fault both stay, main's first.

ItsNotRexed#2359's pipeline-statistics segments in execute_now() run before the
DRED marker loop and leave it unchanged. The loop is still over
lists.size(), begin and end markers are still paired, and
submitted() is still reached on every path after mark().

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AimLogin added a commit to AimLogin/Leonida that referenced this pull request Nov 23, 2026
main records DispatchMesh as a Draw with `mesh` set (ItsNotRexed#2359). The
breadcrumb op table named it DrawInstanced. It is now
D3D12_AUTO_BREADCRUMB_OP_DISPATCHMESH (42, from d3d12.h), and the
report prints "DispatchMesh". There is still one op per draw, so op
counts, and BUILD-1655's per-operation positions, are unchanged.

vk_breadcrumbs checks that a mesh Draw maps to 42, an indexed one to
DrawIndexedInstanced and a plain one to DrawInstanced.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AimLogin added a commit to AimLogin/Leonida that referenced this pull request Nov 23, 2026
Conflicts, each resolved keeping both sides:
- runtime/shims/d3d12_vulkan_device.cpp, create_graphics(): main's
  mesh-shader PSOs (ItsNotRexed#2359: `create_graphics(desc, ms, as)` and the
  mesh-limit check) plus the per-stage code-base slots. An MS stage
  sits in stages[0] and reads dwords 34-35 like a VS, a PS reads
  38-39, and push_bytes is the max over all stages, MS included.
- tools/rdna2spirv.py, the index entry: main's FMA features (ItsNotRexed#6635)
  plus `push_constant_bytes = 4 * USER_SGPRS + 4 * tail_dwords(g)`,
  so a code-base PS still declares 160 bytes.
- docs/design.md and docs/d3d12_vulkan.md: merged word by word. The
  one main edit not kept is ItsNotRexed#5288's `**ASSUMPTION.**` marker. It sat
  inside the old "two code bases in one block" paragraph, which this
  PR replaces with the implemented text, so the assumption is gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.