Repository navigation
Conversation
abnalstlll-byte
left a comment
There was a problem hiding this comment.
Audited and verified. Implements deferred DispatchMesh recording for D3D12 bundle command lists, validating dispatch grid dimensions (<= 65535) at record time and replaying calls onto the parent command list during ExecuteBundle. Includes comprehensive test additions in
untime/tests/d3d12_mesh_shader_test.cpp covering state inheritance, constant buffer offset updates across bundle executions, and negative error conditions. Approved.
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
3 open issues
What changed in this PR
Defers ID3D12GraphicsCommandList6::DispatchMesh through the bundle replay path so bundles correctly inherit parent state at ExecuteBundle, and adds regression tests + documentation for the behavior.
Changes:
- Route
DispatchMeshrecording throughdefer()and addrecord_dispatch_mesh()to replay with inherited parent state. - Add GPU + negative bundle coverage for deferred
DispatchMeshbehavior. - Document that
DispatchMeshis deferred like draws/dispatches for bundle replay.
| File | Description |
|---|---|
| runtime/shims/d3d12_com.cpp | Defers DispatchMesh via defer() and adds record_dispatch_mesh() for replay-time state snapshotting. |
| runtime/test/d3d12_mesh_test.cpp | Adds bundle execution + negative tests validating deferred DispatchMesh semantics and error cases. |
| docs/d3d12_vulkan.md | Updates bundle behavior documentation to include deferred DispatchMesh. |
Review effort: Lite
| const UINT64 bundle_fence = d.pipeline_statistics_query ? 4 : 3; | ||
| EXPECT(SUCCEEDED(queue->Signal(fence.p, bundle_fence)) && | ||
| SUCCEEDED(fence->SetEventOnCompletion(bundle_fence, nullptr))); | ||
|
|
||
| std::array<std::uint8_t, size * 256> bundle_pixels{}; | ||
| void* bundle_mapped = nullptr; | ||
| EXPECT(SUCCEEDED(readback->Map(0, nullptr, &bundle_mapped))); | ||
| std::memcpy(bundle_pixels.data(), bundle_mapped, bundle_pixels.size()); | ||
| readback->Unmap(0, nullptr); |
| void record_dispatch_mesh(UINT x, UINT y, UINT z) { | ||
| if (!graphics_pipeline_ || !graphics_.layout) return check(false); | ||
| note_direct_heap_indexing(graphics_.layout); | ||
| if (!(viewport_.width > 0) || !(viewport_.height > 0)) return; // as record_draw: nothing is rasterized | ||
| leonida::Draw draw{graphics_pipeline_, graphics_.data, draw_views(), depth_, {}, 0, viewport_, |
| scissor_, blend_factor_, front_stencil_ref_, back_stencil_ref_, false, x, y, z, 0, 0}; | ||
| draw.mesh = true; | ||
| check(list_.draw(std::move(draw))); | ||
| if (defer([=](GraphicsCommandList& l) { l.record_dispatch_mesh(x, y, z); }, true)) return; |
|
Addressed @copilot review comments (rebased onto current main): Rebuilt d3d12_mesh_test and verified on NVIDIA GeForce RTX 3080 (LEONIDA_VK_VALIDATION=1, 0 validation errors). AI-assisted. |
3067025 to
a74ab14
Compare
|
Tested a74ab14 on NVIDIA GeForce RTX 3080 Ti Laptop (Ampere, subgroup 32..32, mesh shaders), NVIDIA 621.24, Vulkan 1.4.357, Windows 11 Pro (build 26300), native Windows: pass Built at this head with
One observation, not a failure: the statistics line here reads |
Independent testing resultsVerified deferred Tested revisions
Test environment
Test configuration
Both revisions compiled successfully. CTest results
Combined: 30/30 PASS, with no failed or skipped CTest executions. Deferred DispatchMeshThe mesh test reported mesh shader tier 1 support on the RTX 5070. All three HEAD executions explicitly confirmed successful deferred bundle The relevant HEAD diagnostic was:
The pipeline state stream checks also consistently reported nine invalid cases and two not-implemented cases being rejected. Bundle regression coverageThe forbidden bundle calls test reported the same results on BASE and HEAD:
The close-parity test also remained unchanged:
Vulkan validationThe synchronization self-test produced the expected intentional Limitations
ConclusionResult: PASS — no regressions detected within the tested scope. The new deferred bundle DispatchMesh scenario successfully matched all 4096 pixels in every HEAD repetition. Invalid bundle replays were rejected as expected, and the existing bundle and close-parity regression tests remained successful. AI-assisted log analysis and report preparation. |
|
Hi @Maticcm, thanks for this pull request. It currently conflicts with AI-assisted (Claude Code, Claude Opus 5.5). |
a74ab14 to
c89e101
Compare
|
Rebased onto
GPUs tested: Profile M, NVIDIA GeForce RTX 3080 desktop (10 GiB), driver 630.20, Windows 11 build 26340, MSVC 19.50.35717, Vulkan SDK 1.4.363.1. AI-assisted (Codex). |
|
I compared the failing CI logs on
Windows CI was still running when I checked. AI-assisted (Codex). |
|
The Windows Runtime job finished successfully on |
c89e101 to
19b5988
Compare
|
Rebased onto On Windows 11 with RTX 3080 (NVIDIA 630.20), all 10 focused mesh, bundle, indirect-bundle, root-layout and close-parity CTests passed both with and without Vulkan validation. The mesh and heavy-cache variants matched all 4,096 pixels, including the deferred bundle draw. No validation errors were reported. Changed-file game-data and whitespace checks passed. Synthetic fixtures only. AI-assisted with OpenAI Codex. |
|
RUN of #841 (red/green, GPU box, merged build) Heads: PR head Commands (VS 2022 x64 environment, from the worktree root):
Machine: RTX 3090 24 GB, NVIDIA 621.40, Windows 11 Pro 10.0.26300, MSVC 19.44 (VS 2022 Build Tools), CMake + Ninja, RelWithDebInfo, |
19b5988 to
df84037
Compare
|
Rebased on RTX 3080 on Windows 11 passed 10/10 focused tests both with and without Vulkan validation. The normal and heavy-cache mesh variants each matched all 4,096 pixels. No validation errors were reported. Changed-file game-data and whitespace checks passed. Synthetic fixtures only. AI-assisted with OpenAI Codex. |
|
Independent verification on this machine (Windows 11, RTX 4090, MSVC 19.44.35226), with a negative control that bites on both tests. 1. It applies. 2. With the branch, both tests pass: 3. The control - revert only the shim, keep the test: Both bite, and the run-time line names the rule the change adds: a draw whose kind does not match the bound pipeline (mesh or vertex) must be refused at What I did not test: whether the shim refuses every mismatched combination the pipeline state allows, and the Why I am commenting: I verify open pull requests that replay onto current Written with an AI assistant. |
df84037 to
e6585b5
Compare
|
Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime ( |



Claim: D3D-BUNDLE-DISPATCH-MESH
Main picked up the DispatchMesh bundle implementation in 85f806b. This revision adds direct regression coverage and documents the behavior.
The synthetic mesh fixture executes the same bundle twice with different inherited root arguments. It resets the parent to a vertex PSO before a state-only bundle, then checks a direct mesh dispatch that depends on the bundle handing its PSO and root arguments back. It also checks that Close rejects an oversized grid, missing inherited root state and replay of an invalidated bundle.
Tested e6585b5 on Windows 11 with RTX 3080, NVIDIA driver 630.20. All 10 focused mesh, bundle, indirect-bundle, close-parity and root-layout CTests passed in each of two runs, with and without Vulkan validation. Both mesh variants matched all 4,096 expected pixels in both runs. Changed-file game-data and whitespace checks passed. Synthetic fixtures only.
AI-assisted with OpenAI Codex (GPT-6.2 Sol), with a separate reviewer.