mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 22:05:54 +01:00
[PR #540] [MERGED] d3d12/vulkan: the mesh statistics pool enables no forbidden counter (D3D-291) #586
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#586
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/540
Author: @Mby159
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/24/2026
Merged by: @QemmHD
Base:
main← Head:d3d-291-mesh-statistics📝 Commits (1)
916dbc6d3d12/vulkan: the mesh statistics pool enables no forbidden counter (D3D-291)📊 Changes
8 files changed (+162 additions, -83 deletions)
View changed files
📝
docs/d3d12_vulkan.md(+17 -16)📝
runtime/src/statistics_sum.comp(+4 -4)📝
runtime/src/statistics_sum_spirv.h(+33 -37)📝
runtime/src/vulkan_backend.h(+5 -8)📝
runtime/src/vulkan_replay.h(+20 -4)📝
runtime/test/d3d12_mesh_test.cpp(+7 -4)📝
runtime/test/replay_query_edges_test.cpp(+61 -10)📝
runtime/test/replay_query_predication_test.cpp(+15 -0)📄 Description
Claimed in the coordination issue as: D3D-291 (#14)
What and why
The pool a mesh draw runs in enabled the two clipping counters, and
VUID-vkCmdDrawMeshTasksEXT-pipelineStatistics-07076names both of them among the counters a pool that is activeduring a
vkCmdDrawMeshTasksEXTmust not have: the validation layer reports the VUID on everyDispatchMeshinside astatistics query. The finding is in
#14 and is the mesh half of #506.
The VUID leaves the fragment and compute invocations allowed, so the mesh pool now counts those two only. The two sets
of counters are named in
runtime/src/vulkan_replay.h(kMeshStatisticsFlagsand the bits the same VUID forbids),so the rule is in one place and a test can check it. The sum copies the two counters into the
PSInvocationsandCSInvocationsfields of the record, and the clipping fields of a mesh segment read 0.That last part is a measured difference from D3D12: D3D12 counts the clipping invocations and primitives of a mesh
pipeline (one synthetic triangle gave one of each in WARP and in native D3D12), but Vulkan has no counter for them
during a mesh draw, so there is nothing to read them from. Ordinary draw segments still supply all eleven counters, so
a query that mixes both kinds keeps the clipping count of its vertex draws.
runtime/src/statistics_sum_spirv.his regenerated fromstatistics_sum.compwith glslang 16.6.0 (the version theCI pins) and the command its header names; the module's ID numbering differs slightly from the build it replaces, the
code is the same apart from that one condition.
Tested
ctest --test-dir runtime/build -C Release: 72 of 72 tests passed (2 skipped:shader_library_corpusneeds thegame's shaders,
vk_sync_validationneeds a device with the feature). Built with clang 23.1.6 (llvm-mingw20261117) against the pinned Vulkan headers (6802bb47, vulkan-sdk-1.4.363.0).
replay_query_predication_test(new case 17) checks that the mesh pool enables none of the nine counters the VUIDforbids, and counts every one it leaves allowed.
replay_query_edges_test(new case) runs the mesh sum through the CPU mocks: the mesh segment is read from themesh pool, and it fills
PSInvocationsandCSInvocationsand no other field.python -I scripts/run_semantic_tests.py -j 6 tests/semantic: 465 files, 6105 tests, 0 files failed onmain(
8f481cf1). The translator is untouched.python -I scripts/check_no_game_data.py <the eight changed files>: passes.spirv-val.CI
windows,no-game-dataandchange-scopepass.macosandlinux-gpu-toolsfail, oncs_imgload_tfeandcs_imgload_d16_tfe(texel(5,3) = 2071against the expected 71). Those twofixtures are the translator bug of #31, and the failure is on
maintoo: the runtime run ofmainat84347bbbfails the same two jobs the same way. This pull request does not touch thetranslator or those fixtures, and the same two jobs fail on other open pull requests (#382, #345,
#411), so the red is inherited rather than introduced here.
The GPU test that covers this path is
d3d12_mesh_test, which needs a GPU withVK_EXT_mesh_shaderand theKhronos validation layer; this machine has neither (the Radeon 780M is RDNA3, which has no mesh shader support, and
there is no validation layer installed). The validation-layer and WARP/D3D12 measurements for this fix are in the
withdrawn duplicate #527, which reached the same change: on
mainc023a365d3d12_meshreports three VUIDerrors, with the mesh pool counting the fragment and compute invocations only it reports none, the rendered image
still matches all 4096 pixels, the mixed and vertex-only clipping counts are both 2/2 and the mesh-only one is 0/0,
and the mesh-only query still records pixel shader invocations.
GPUs tested: n/a on this host. The measurements above are from sodove's Windows 11 host (NVIDIA GeForce RTX 5070 Ti,
driver 610.74, Khronos validation layer 1.4.369, MSVC 19.44.35220).
AI-assisted: yes.
Checklist
mainand merges cleanly.docs/design.md(not applicable: this is the D3D12 to Vulkanruntime layer, whose contract is
docs/d3d12_vulkan.md).🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.