d3d12/vulkan: a mesh segment's clipping invocations come from a mesh-primitives query (D3D-MESH-CLIPPING-COUNTER) #577

Manually merged
github merged 3 commits from gh-pr/577/head into gh-pr/577/base 2026-11-26 09:09:38 +00:00
Owner

@⁠Mby159 on GitHub · 2026-11-24 08:55 UTC · original
Mby159:feature/d3d-mesh-clipping-counter → main · +289 −98 · 11 files · 3 commits · merged 2026-11-24 13:38 UTC

Claimed in the coordination issue as: D3D-MESH-CLIPPING-COUNTER (#14)

Depends on: #540 (this is the follow-up that pull request asks for).

What and why

#540 leaves the clipping fields of a mesh segment at 0: VUID-vkCmdDrawMeshTasksEXT-pipelineStatistics-07076 forbids the
clipping counters in a pipeline-statistics pool that is active during a mesh draw, and Vulkan has no other counter for
them during one. D3D12 does count the clipping invocations and primitives of a mesh pipeline, so the two numbers differ.

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 instead: a third pool of the
submission, begun and ended with each mesh segment, next to the two the statistics split needs. Its count is copied to
field 5 of the segment's record and statistics_sum.comp adds it as CInvocations. CPrimitives stays 0, because
Vulkan has no clipped-primitive counter and D3D12's CPrimitives is the clipper's output: 0 when a triangle is
dropped, 2 when it is split.

This is the addition milk4sale describes in
#14, measured on an RTX 4070 Ti and
cross-checked by sodove against native D3D12 on the RTX 5070 Ti
(#14). The three questions asked on
#540 are answered:

  • The count goes into CInvocations only. CPrimitives stays 0: the clipper's output is not a number Vulkan keeps
    for a mesh draw.
  • Where the device has no meshShaderQueries, the fields stay 0, as in #540. The feature is asked for when the
    device is created, and the pool is only made where the device has it.
  • A third per-submission pool of that query type, begun and ended with each mesh segment, with the count added as
    field 5 in statistics_sum.comp.

One divergence to document: Vulkan counts a primitive the mesh shader culled with gl_CullPrimitiveEXT, which D3D12
does not count, so the CInvocations of a mesh segment can be higher than D3D12's. Both measurements above show it.

What changed

  • runtime/src/vulkan_replay.h: the segment pool keeps the mesh-primitives pool, the prepared list and the resolve
    run carry it, and a mesh segment begins and ends that query with its statistics segment.
  • runtime/src/vulkan_backend.h: the third pool is made where the device has the feature, and the sum copies its
    count into the clipping-invocations field. A mesh chunk is cleared first, so the field reads 0 where the device has
    no mesh-primitives count.
  • runtime/src/statistics_sum.comp and the regenerated runtime/src/statistics_sum_spirv.h: a mesh segment adds
    field 5 as well. The module is regenerated with glslang 16.6.0, the version the CI pins, with the command its
    header names; the ID numbering differs slightly from the build it replaces, the code is the same apart from that one
    condition.
  • runtime/shims/d3d12_com.h, runtime/shims/d3d12_vulkan_device.cpp: the device enables the
    meshShaderQueries feature where the GPU has it, and the layer is told.
  • runtime/test/vk_test_device.h: the test device enables the same feature.
  • runtime/test/replay_query_predication_test.cpp, runtime/test/replay_query_edges_test.cpp: the resolve plan
    carries the pool, and the mesh sum through the CPU mocks fills CInvocations, PSInvocations and
    CSInvocations.
  • runtime/test/d3d12_mesh_test.cpp: the mesh statistics expectations follow the feature; the counts are compared
    with each other, not written down, because how many primitives reach the fragment shader is the driver's.
  • docs/d3d12_vulkan.md: the new paragraph.

Tested

  • ctest --test-dir runtime/build -C Release: 72 of 72 tests passed (2 skipped: shader_library_corpus needs the
    game's shaders, vk_sync_validation needs a device with the feature). Built with clang 23.1.6 (llvm-mingw
    20261117) against the pinned Vulkan headers (6802bb47, vulkan-sdk-1.4.363.0).
  • replay_query_edges_test runs the mesh sum through the CPU mocks: the mesh segment is read from the mesh pool and
    the mesh-primitives pool, and it fills CInvocations, PSInvocations and CSInvocations and no other field.
  • replay_query_predication_test checks that the resolve plan hands the mesh-primitives pool to the sum.
  • python -I scripts/check_no_game_data.py <the eleven changed files>: passes.
  • The regenerated SPIR-V passes spirv-val.

The GPU half is not run here: this machine's Radeon 780M is RDNA3, which has no mesh shader support, so the
mesh-primitives query cannot be created on it and d3d12_mesh_test cannot run. sodove offered the RTX 5070 Ti under
the Khronos validation layer, and milk4sale the RTX 4070 Ti; the test compares the counts with each other rather
than writing driver-dependent numbers down, so the run confirms the wiring and the field, not an exact count. A run
with the feature disabled is the other half of the check: the fields must read 0 there.

GPUs tested: n/a on this host.

AI-assisted: yes.

Checklist

  • Based on the #540 head and merges cleanly after it.
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption.
  • A new translator rule is in the contract table of docs/design.md (not applicable: this is the D3D12 to Vulkan
    runtime layer, whose contract is docs/d3d12_vulkan.md).
**@⁠Mby159** on GitHub · 2026-11-24 08:55 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/577) `Mby159:feature/d3d-mesh-clipping-counter` → `main` · +289 −98 · 11 files · 3 commits · merged 2026-11-24 13:38 UTC Claimed in the coordination issue as: D3D-MESH-CLIPPING-COUNTER ([#14](https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14)) Depends on: #540 (this is the follow-up that pull request asks for). ### What and why #540 leaves the clipping fields of a mesh segment at 0: VUID-vkCmdDrawMeshTasksEXT-pipelineStatistics-07076 forbids the clipping counters in a pipeline-statistics pool that is active during a mesh draw, and Vulkan has no other counter for them during one. D3D12 does count the clipping invocations and primitives of a mesh pipeline, so the two numbers differ. 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 instead: a third pool of the submission, begun and ended with each mesh segment, next to the two the statistics split needs. Its count is copied to field 5 of the segment's record and `statistics_sum.comp` adds it as `CInvocations`. `CPrimitives` stays 0, because Vulkan has no clipped-primitive counter and D3D12's `CPrimitives` is the clipper's output: 0 when a triangle is dropped, 2 when it is split. This is the addition milk4sale describes in [#14](https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14), measured on an RTX 4070 Ti and cross-checked by sodove against native D3D12 on the RTX 5070 Ti ([#14](https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14)). The three questions asked on #540 are answered: - The count goes into `CInvocations` only. `CPrimitives` stays 0: the clipper's output is not a number Vulkan keeps for a mesh draw. - Where the device has no `meshShaderQueries`, the fields stay 0, as in #540. The feature is asked for when the device is created, and the pool is only made where the device has it. - A third per-submission pool of that query type, begun and ended with each mesh segment, with the count added as field 5 in `statistics_sum.comp`. One divergence to document: Vulkan counts a primitive the mesh shader culled with `gl_CullPrimitiveEXT`, which D3D12 does not count, so the `CInvocations` of a mesh segment can be higher than D3D12's. Both measurements above show it. ### What changed - `runtime/src/vulkan_replay.h`: the segment pool keeps the mesh-primitives pool, the prepared list and the resolve run carry it, and a mesh segment begins and ends that query with its statistics segment. - `runtime/src/vulkan_backend.h`: the third pool is made where the device has the feature, and the sum copies its count into the clipping-invocations field. A mesh chunk is cleared first, so the field reads 0 where the device has no mesh-primitives count. - `runtime/src/statistics_sum.comp` and the regenerated `runtime/src/statistics_sum_spirv.h`: a mesh segment adds field 5 as well. The module is regenerated with glslang 16.6.0, the version the CI pins, with the command its header names; the ID numbering differs slightly from the build it replaces, the code is the same apart from that one condition. - `runtime/shims/d3d12_com.h`, `runtime/shims/d3d12_vulkan_device.cpp`: the device enables the `meshShaderQueries` feature where the GPU has it, and the layer is told. - `runtime/test/vk_test_device.h`: the test device enables the same feature. - `runtime/test/replay_query_predication_test.cpp`, `runtime/test/replay_query_edges_test.cpp`: the resolve plan carries the pool, and the mesh sum through the CPU mocks fills `CInvocations`, `PSInvocations` and `CSInvocations`. - `runtime/test/d3d12_mesh_test.cpp`: the mesh statistics expectations follow the feature; the counts are compared with each other, not written down, because how many primitives reach the fragment shader is the driver's. - `docs/d3d12_vulkan.md`: the new paragraph. ### Tested - `ctest --test-dir runtime/build -C Release`: 72 of 72 tests passed (2 skipped: `shader_library_corpus` needs the game's shaders, `vk_sync_validation` needs a device with the feature). Built with clang 23.1.6 (llvm-mingw 20261117) against the pinned Vulkan headers (6802bb47, vulkan-sdk-1.4.363.0). - `replay_query_edges_test` runs the mesh sum through the CPU mocks: the mesh segment is read from the mesh pool and the mesh-primitives pool, and it fills `CInvocations`, `PSInvocations` and `CSInvocations` and no other field. - `replay_query_predication_test` checks that the resolve plan hands the mesh-primitives pool to the sum. - `python -I scripts/check_no_game_data.py <the eleven changed files>`: passes. - The regenerated SPIR-V passes `spirv-val`. The GPU half is not run here: this machine's Radeon 780M is RDNA3, which has no mesh shader support, so the mesh-primitives query cannot be created on it and `d3d12_mesh_test` cannot run. sodove offered the RTX 5070 Ti under the Khronos validation layer, and milk4sale the RTX 4070 Ti; the test compares the counts with each other rather than writing driver-dependent numbers down, so the run confirms the wiring and the field, not an exact count. A run with the feature disabled is the other half of the check: the fields must read 0 there. GPUs tested: n/a on this host. AI-assisted: yes. ### Checklist - [x] Based on the #540 head and merges cleanly after it. - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption. - [ ] A new translator rule is in the contract table of `docs/design.md` (not applicable: this is the D3D12 to Vulkan runtime layer, whose contract is `docs/d3d12_vulkan.md`).
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
sodove's negative control on this head showed the gap: with the layer reporting the feature but the
mesh-primitives pool never created, both counts stay at 0 and the enabled-feature assertion still held,
because it compared 0 >= 0. The count has to be positive to show the wiring is there. How many primitives
the mesh shader emits is the driver's, so the test asks for a positive count and not for a number.

The disabled case stays pinned at zero. AI-assisted.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:09:36 +00:00
github manually merged commit 92977eee6c into gh-pr/577/base 2026-11-26 09:09:38 +00:00
Author
Owner

@⁠Mby159 on GitHub · 2026-11-24 08:55 UTC · original

This is the follow-up to #540, stacked on its head: until #540 merges, the diff here shows both changes (the branch is c9f4a569 plus this commit). The branch itself is one commit on top of #540.

Three things to make the design explicit, answering the questions asked on #540:

  • The count goes into CInvocations only. CPrimitives stays 0: Vulkan keeps no clipped-primitive counter, and D3D12's CPrimitives is the clipper's output (0 when a triangle is dropped, 2 when it is split). The generated count is 1 in both of those cases.
  • Where the device has no meshShaderQueries, the fields stay 0, as in #540. The feature is asked for when the device is created, and the third pool is only made where the device has it.
  • A third per-submission pool of that query type, begun and ended with each mesh segment, and the count added as field 5 of the segment's record, which statistics_sum.comp adds as CInvocations.

One divergence, which the documentation now states: Vulkan counts a primitive the mesh shader culled with gl_CullPrimitiveEXT, which D3D12 does not count, so a mesh segment's CInvocations can be higher than D3D12's. milk4sale's table and sodove's cross-API comparison both show it.

The GPU half is what is missing here. This machine's Radeon 780M is RDNA3, which has no mesh shader support, so the mesh-primitives query cannot be created on it and d3d12_mesh_test cannot run. The test compares the counts with each other rather than writing driver-dependent numbers down, so the run confirms the wiring and the field, not an exact count. The other half is a device without the feature: the fields must read 0 there.

sodove offered the RTX 5070 Ti under the Khronos validation layer, and milk4sale the RTX 4070 Ti. Either would do; say here and I will hand the GPU runs over instead.

What ran here: ctest --test-dir runtime/build -C Release on the delivered tree (upstream d42773d0 plus #540 plus this change), 71 of 72 passed and 2 skipped; the one failure is vk_queue_query_sync, which fails the same way on the unmodified d42773d0 tree (4 of 5 runs), so it is not this change. replay_query_edges_test runs the mesh sum through the CPU mocks and checks that the mesh segment is read from the mesh pool and the mesh-primitives pool, and that it fills CInvocations, PSInvocations and CSInvocations. replay_query_predication_test checks that the resolve plan hands the pool to the sum. The semantic suite: 465 files, 6105 tests, 0 files failed. check_no_game_data.py passes on all eleven changed files, and the regenerated SPIR-V passes spirv-val.

AI-assisted: yes.

**@⁠Mby159** on GitHub · 2026-11-24 08:55 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/577#issuecomment-7126741711) This is the follow-up to #540, stacked on its head: until #540 merges, the diff here shows both changes (the branch is `c9f4a569` plus this commit). The branch itself is one commit on top of #540. Three things to make the design explicit, answering the questions asked on #540: - The count goes into `CInvocations` only. `CPrimitives` stays 0: Vulkan keeps no clipped-primitive counter, and D3D12's `CPrimitives` is the clipper's output (0 when a triangle is dropped, 2 when it is split). The generated count is 1 in both of those cases. - Where the device has no `meshShaderQueries`, the fields stay 0, as in #540. The feature is asked for when the device is created, and the third pool is only made where the device has it. - A third per-submission pool of that query type, begun and ended with each mesh segment, and the count added as field 5 of the segment's record, which `statistics_sum.comp` adds as `CInvocations`. One divergence, which the documentation now states: Vulkan counts a primitive the mesh shader culled with `gl_CullPrimitiveEXT`, which D3D12 does not count, so a mesh segment's `CInvocations` can be higher than D3D12's. milk4sale's table and sodove's cross-API comparison both show it. **The GPU half is what is missing here.** This machine's Radeon 780M is RDNA3, which has no mesh shader support, so the mesh-primitives query cannot be created on it and `d3d12_mesh_test` cannot run. The test compares the counts with each other rather than writing driver-dependent numbers down, so the run confirms the wiring and the field, not an exact count. The other half is a device without the feature: the fields must read 0 there. sodove offered the RTX 5070 Ti under the Khronos validation layer, and milk4sale the RTX 4070 Ti. Either would do; say here and I will hand the GPU runs over instead. What ran here: `ctest --test-dir runtime/build -C Release` on the delivered tree (upstream `d42773d0` plus #540 plus this change), 71 of 72 passed and 2 skipped; the one failure is `vk_queue_query_sync`, which fails the same way on the unmodified `d42773d0` tree (4 of 5 runs), so it is not this change. `replay_query_edges_test` runs the mesh sum through the CPU mocks and checks that the mesh segment is read from the mesh pool and the mesh-primitives pool, and that it fills `CInvocations`, `PSInvocations` and `CSInvocations`. `replay_query_predication_test` checks that the resolve plan hands the pool to the sum. The semantic suite: 465 files, 6105 tests, 0 files failed. `check_no_game_data.py` passes on all eleven changed files, and the regenerated SPIR-V passes `spirv-val`. AI-assisted: yes.
Author
Owner

@⁠Mby159 on GitHub · 2026-11-24 08:58 UTC · original

Note on the duplicate: #575 is the same work, published a moment earlier from a session whose state was lost. It is closed in favour of this one. It never asks for the meshShaderQueries feature, so context_.mesh_queries would stay false and the third pool would never be made, and its d3d12_mesh_test.cpp reads a member the branch does not add, so it does not build. The three files that fix that are here: the feature is asked for when the device is created (runtime/shims/d3d12_vulkan_device.cpp, runtime/shims/d3d12_com.h) and the test device enables it (runtime/test/vk_test_device.h).

Review this pull request.

**@⁠Mby159** on GitHub · 2026-11-24 08:58 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/577#issuecomment-7126787276) Note on the duplicate: #575 is the same work, published a moment earlier from a session whose state was lost. It is closed in favour of this one. It never asks for the `meshShaderQueries` feature, so `context_.mesh_queries` would stay false and the third pool would never be made, and its `d3d12_mesh_test.cpp` reads a member the branch does not add, so it does not build. The three files that fix that are here: the feature is asked for when the device is created (`runtime/shims/d3d12_vulkan_device.cpp`, `runtime/shims/d3d12_com.h`) and the test device enables it (`runtime/test/vk_test_device.h`). Review this pull request.
Author
Owner

@⁠sodove on GitHub · 2026-11-24 10:05 UTC · original

Windows GPU verification of exact head 62c8311 on RTX 5070 Ti (610.74), MSVC Release and Khronos validation 1.4.369. The stock mesh test and both replay-query tests passed (3/3). The mesh test matched all 4,096 pixels, with zero validation errors.

I also printed the counters from the stock synthetic draw with a test-only change. With meshShaderQueries enabled, the mesh-only CInvocations was 8, the mixed result after subtracting its vertex-only contribution was 10, and mesh CPrimitives was 0. With the feature disabled at Vulkan device creation, all three counters were 0. Both runs again matched 4,096 pixels and had zero validation errors.

One test gap showed up in a negative control. I left the Vulkan feature enabled and passed false only in the layer's test device options. The stock enabled-feature assertion still passed with both invocation counts at zero. Asserting a positive mesh-only count for this visible synthetic draw would catch that loss of wiring while keeping the exact count driver-independent.

AI-assisted, synthetic tests only.

**@⁠sodove** on GitHub · 2026-11-24 10:05 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/577#issuecomment-7128298613) Windows GPU verification of exact head `62c8311` on RTX 5070 Ti (610.74), MSVC Release and Khronos validation 1.4.369. The stock mesh test and both replay-query tests passed (3/3). The mesh test matched all 4,096 pixels, with zero validation errors. I also printed the counters from the stock synthetic draw with a test-only change. With `meshShaderQueries` enabled, the mesh-only `CInvocations` was 8, the mixed result after subtracting its vertex-only contribution was 10, and mesh `CPrimitives` was 0. With the feature disabled at Vulkan device creation, all three counters were 0. Both runs again matched 4,096 pixels and had zero validation errors. One test gap showed up in a negative control. I left the Vulkan feature enabled and passed false only in the layer's test device options. The stock enabled-feature assertion still passed with both invocation counts at zero. Asserting a positive mesh-only count for this visible synthetic draw would catch that loss of wiring while keeping the exact count driver-independent. AI-assisted, synthetic tests only.
Author
Owner

@⁠Mby159 on GitHub · 2026-11-24 10:18 UTC · original

@⁠sodove your negative control found a real gap in the test, and it is fixed in 972a1e47 (parent 62c8311, the head you verified).

What the control showed: with the layer reporting the feature but the mesh-primitives pool never created, both counts stay at 0 and the enabled-feature assertion still held, because it compared 0 >= 0. The enabled branch now asks for a positive count:

if (d.mesh_shader_queries) {
    EXPECT(mesh_clipping >= mesh_only.CInvocations);
    EXPECT(mesh_only.CInvocations > 0);
} else {
    EXPECT(mesh_clipping == 0);
}

mesh_only is query 1, the DispatchMesh(2, 2, 1) draw whose red tint fills the top-left quadrant, so the mesh shader emits at least one primitive on any correct driver. The number stays driver-dependent, so the test asks for a positive count and not for a number. The disabled case is unchanged and stays pinned at zero (mesh_clipping == 0 and mesh_only.CInvocations == 0).

Your numbers are consistent with this: mesh-only CInvocations was 8, and the mixed range's mesh share was 10, which is the DispatchMesh(2, 2) draw plus the DispatchMesh(1, 1) one.

This is a test-only change, so the implementation is exactly the head you verified. The new head is 972a1e47 - could you re-run the mesh test on it, so the pull request carries a verification of the exact head?

Local verification is limited, and I want to be exact about it: this machine's GPU has no VK_EXT_mesh_shader, so the mesh block is skipped here, and the file does not compile here at all - the repository's d3d12_com.h wants the SDK's d3d12.h and MinGW's is older (ID3D12GraphicsCommandList8 and D3D12_RASTERIZER_DESC2 are missing), so the file needs the CI Windows build. The added block was compiled on its own with -Wall -Wextra -Wsign-compare and is clean, and python -I scripts/check_no_game_data.py on the file passes.

AI-assisted (MiniMax Code).

**@⁠Mby159** on GitHub · 2026-11-24 10:18 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/577#issuecomment-7128601159) @⁠sodove your negative control found a real gap in the test, and it is fixed in `972a1e47` (parent `62c8311`, the head you verified). What the control showed: with the layer reporting the feature but the mesh-primitives pool never created, both counts stay at 0 and the enabled-feature assertion still held, because it compared `0 >= 0`. The enabled branch now asks for a positive count: ```cpp if (d.mesh_shader_queries) { EXPECT(mesh_clipping >= mesh_only.CInvocations); EXPECT(mesh_only.CInvocations > 0); } else { EXPECT(mesh_clipping == 0); } ``` `mesh_only` is query 1, the `DispatchMesh(2, 2, 1)` draw whose red tint fills the top-left quadrant, so the mesh shader emits at least one primitive on any correct driver. The number stays driver-dependent, so the test asks for a positive count and not for a number. The disabled case is unchanged and stays pinned at zero (`mesh_clipping == 0` and `mesh_only.CInvocations == 0`). Your numbers are consistent with this: mesh-only `CInvocations` was 8, and the mixed range's mesh share was 10, which is the `DispatchMesh(2, 2)` draw plus the `DispatchMesh(1, 1)` one. This is a test-only change, so the implementation is exactly the head you verified. The new head is `972a1e47` - could you re-run the mesh test on it, so the pull request carries a verification of the exact head? Local verification is limited, and I want to be exact about it: this machine's GPU has no `VK_EXT_mesh_shader`, so the mesh block is skipped here, and the file does not compile here at all - the repository's `d3d12_com.h` wants the SDK's `d3d12.h` and MinGW's is older (`ID3D12GraphicsCommandList8` and `D3D12_RASTERIZER_DESC2` are missing), so the file needs the CI Windows build. The added block was compiled on its own with `-Wall -Wextra -Wsign-compare` and is clean, and `python -I scripts/check_no_game_data.py` on the file passes. AI-assisted (MiniMax Code).
Author
Owner

@⁠sodove on GitHub · 2026-11-24 10:25 UTC · original

@⁠Mby159 Confirmed on exact head 972a1e47: the stock d3d12_mesh test built with MSVC Release and passed on the RTX 5070 Ti (610.74), matching 4,096 pixels under Khronos validation 1.4.369 with zero validation errors.

The same test-only probe still reports 8 mesh-only clipping invocations and 10 mesh invocations added to the mixed range. Disabling the device feature gave zero and passed. Keeping it enabled on the device but disconnecting only the layer option now fails specifically at mesh_only.CInvocations > 0 with no validation errors. The new assertion catches the missing wiring.

AI-assisted, synthetic tests only.

**@⁠sodove** on GitHub · 2026-11-24 10:25 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/577#issuecomment-7128761648) @⁠Mby159 Confirmed on exact head `972a1e47`: the stock `d3d12_mesh` test built with MSVC Release and passed on the RTX 5070 Ti (610.74), matching 4,096 pixels under Khronos validation 1.4.369 with zero validation errors. The same test-only probe still reports 8 mesh-only clipping invocations and 10 mesh invocations added to the mixed range. Disabling the device feature gave zero and passed. Keeping it enabled on the device but disconnecting only the layer option now fails specifically at `mesh_only.CInvocations > 0` with no validation errors. The new assertion catches the missing wiring. AI-assisted, synthetic tests only.
Author
Owner

@⁠Mby159 on GitHub · 2026-11-24 12:36 UTC · original

Rebased onto main at 21625bca8 together with #540: new head 92977eee (parent 1bb23a28 = #540's new head 916dbc61). The three commits are the same three - d3d12/vulkan: the mesh statistics pool enables no forbidden counter, d3d12/vulkan: a mesh segment's clipping invocations come from a mesh-primitives query, tests: require a positive mesh clipping count when the feature is on - and the diff against main is the same eleven files and the same +289/-98 as on 972a1e47.

Why now. The base this pull request carried (7430f59b) is old enough that tests/test_cmake_translator_deps.py fails on the test merge, for a reason that has nothing to do with this change: build.py reaches tools/rdna2_isa_tables.py and tools/rdna2_decode.py, and the dependency list the test compares against was updated on main afterwards. main passes that test today; the test merge of this pull request did not.

The verification still applies. @⁠sodove's negative-control run was on 972a1e47: the same content now sits on 92977eee, including the mesh_only.CInvocations > 0 assertion that the control trips, and the counts it measured - 8 mesh-only clipping invocations, 10 in the mixed range, 0 with the device feature off - are unchanged by the rebase.

What stays red, and why. macos and linux-gpu-tools fail on cs_imgload_tfe and cs_imgload_d16_tfe, the two shaders main fails as well (#31). The Windows job's crt_timed_wait is a timing-sensitive test, and the same job passed on #540's head minutes earlier.

**@⁠Mby159** on GitHub · 2026-11-24 12:36 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/577#issuecomment-7131674415) Rebased onto `main` at `21625bca8` together with #540: new head `92977eee` (parent `1bb23a28` = #540's new head `916dbc61`). The three commits are the same three - `d3d12/vulkan: the mesh statistics pool enables no forbidden counter`, `d3d12/vulkan: a mesh segment's clipping invocations come from a mesh-primitives query`, `tests: require a positive mesh clipping count when the feature is on` - and the diff against `main` is the same eleven files and the same `+289/-98` as on `972a1e47`. **Why now.** The base this pull request carried (`7430f59b`) is old enough that `tests/test_cmake_translator_deps.py` fails on the test merge, for a reason that has nothing to do with this change: `build.py` reaches `tools/rdna2_isa_tables.py` and `tools/rdna2_decode.py`, and the dependency list the test compares against was updated on `main` afterwards. `main` passes that test today; the test merge of this pull request did not. **The verification still applies.** @⁠sodove's negative-control run was on `972a1e47`: the same content now sits on `92977eee`, including the `mesh_only.CInvocations > 0` assertion that the control trips, and the counts it measured - 8 mesh-only clipping invocations, 10 in the mixed range, 0 with the device feature off - are unchanged by the rebase. **What stays red, and why.** `macos` and `linux-gpu-tools` fail on `cs_imgload_tfe` and `cs_imgload_d16_tfe`, the two shaders `main` fails as well (#31). The Windows job's `crt_timed_wait` is a timing-sensitive test, and the same job passed on #540's head minutes earlier.
Author
Owner

@⁠QemmHD on GitHub · 2026-11-24 13:38 UTC · original

Merging.

Why merged: Stacked on #540: the clipping invocations of a mesh segment now come from a mesh-pipeline query, so CInvocations/CPrimitives stay correct for mixed vertex + mesh work. sodove verified the exact head, including the disconnected-feature negative control that found (and now proves fixed) a gap in the test.

Why it's good: The embedded SPIR-V in statistics_sum_spirv.h was recompiled from the PR's .comp: all 431 words are identical and spirv-val passes. d3d12_mesh with validation: 0 errors, mixed C 12 vs vertex-only C 2, so the mesh share is 10, as expected.

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).

**@⁠QemmHD** on GitHub · 2026-11-24 13:38 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/577#issuecomment-7133113193) Merging. **Why merged:** Stacked on #540: the clipping invocations of a mesh segment now come from a mesh-pipeline query, so CInvocations/CPrimitives stay correct for mixed vertex + mesh work. sodove verified the exact head, including the disconnected-feature negative control that found (and now proves fixed) a gap in the test. **Why it's good:** The embedded SPIR-V in statistics_sum_spirv.h was recompiled from the PR's .comp: all 431 words are identical and spirv-val passes. d3d12_mesh with validation: 0 errors, mixed C 12 vs vertex-only C 2, so the mesh share is 10, as expected. 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).
This discussion has been locked. Commenting is limited to contributors.
No description provided.