d3d12: ExecuteIndirect with DISPATCH_MESH records as DispatchMesh does (RT-INDIRECT-DISPATCH-MESH-PARITY) #2492
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2492"
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?
Imported from ubiquitarianism/leonida. Originally posted by Tyrannys on 2026-11-27T19:13:26Z.
Claimed in the coordination issue as: RT-INDIRECT-DISPATCH-MESH-PARITY (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7226165422)
Found by @kevincommits, item 1 of https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7226076494. Thank you for the precise line references.
What and why
GraphicsCommandList::record_indirectforIndirectKind::dispatch_mesh(runtime/shims/d3d12_com.cpp) recorded differently fromDispatchMeshand from the indirect DRAW/DRAW_INDEXED path:DispatchMesh)any_nonempty_viewport()draw.viewportsnot set, so the replay drew with viewport 0 / scissor 0 alone (vulkan_replay.h)draw.viewports = draw_viewports()mesh_okcheck: a root signature larger than the mesh shader's 16-dword window (s16..s31) recordedClosereturnsE_INVALIDARG), logged onceThe
mesh_okcheck and the direct-heap window notes that followed it inDispatchMeshmove into one helper,mesh_root_window_ok, which both paths call.DispatchMeshbehaves the same as before.Nearby open PRs: #1549 and #841 change
DispatchMeshitself, not this path. If one lands first, the conflict is inDispatchMesh's first lines only.Tested
Windows 11 Pro 26300, MSVC 14.52 (VS 2026), RelWithDebInfo, on
main43a9d562d. Profile M: RTX 4070 SUPER 12 GB, NVIDIA 621.01, 64 GB. Built at--parallel 4, below-normal priority, while a game boot was running on the same machine. No game files.New checks in
d3d12_mesh_test, in the existing DISPATCH_MESH command-signature block. They only record commands and execute nothing;rt::d3d12::recorded_commandsreads them back:ExecuteIndirect:Close() == E_INVALIDARG;viewportsnon-null, 2 viewports, 2 scissors, and viewport 1's width kept;Each check fails without its part of the fix:
main'sd3d12_com.cpp: line 717 (Close() == E_INVALIDARG);draw.viewportsremoved: line 733 (no arrays).With the fix,
d3d12_meshpasses. The existing indirect mesh pixel check still matches all 4096 pixels.ctest -R "mesh|indirect|bundle|command_list|d3d12_com": 38/38 pass.git diff --checkandscripts/check_no_game_data.pyon both files: clean.Not run: the full suite, because a boot was running.
GPUs tested: NVIDIA GeForce RTX 4070 SUPER, driver 621.01, Windows 11 (the test needs a device with
VK_EXT_mesh_shaderto create the mesh PSO; the new checks only record)AI-assisted: yes. AI-assisted (Claude Code).
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed: n/a (runtime shim).🤖 Generated with Claude Code
Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-27T21:11:05Z.
Review: APPROVED
Reviewed
455e574b7(runtime/shims/d3d12_com.cpp,runtime/test/d3d12_mesh_test.cpp) and tested on RTX 5070:mesh_root_window_okand bringingrecord_indirect(IndirectKind::dispatch_mesh) to parity withDispatchMesh(any_nonempty_viewport(),draw.viewports = draw_viewports(), and rejecting oversized mesh root signatures withE_INVALIDARGatClose()) is clean and well-tested.VK_LAYER_KHRONOS_validationnot installed locally):d3d12_mesh: passed (0.32 s; includingExecuteIndirect DISPATCH_MESH {2, 1, 1}4096/4096 pixels matched, root window check, viewport 1 of 2 drawn, viewport and scissor arrays kept).Looks good to merge.
AI-assisted (Antigravity, Gemini).
Imported from ubiquitarianism/leonida. Originally posted by timbot103 on 2026-11-28T02:01:53Z.
Reviewed at head
455e574b7on Windows 11 (MSVC 202219.44) with dual-GPU Vulkan validation (LEONIDA_VK_VALIDATION=1, Vulkan SDK1.4.363.0).Verification
d3d12_mesh_test.616.64,LEONIDA_VK_VALIDATION=1): passed (0 validation errors).25.10.30.02,LEONIDA_VK_VALIDATION=1): allExecuteIndirect(DISPATCH_MESH)checks passed (4096 pixels matched, root window check, viewport 1 of 2 drawn, viewport/scissor arrays kept, 0 validation errors); the binary exited 1 only on the pre-existing AMDmixed.GSInvocations == 0statistics assertion atd3d12_mesh_test.cpp:826(reproduced identically on unrelated PR#2474).Notes
ExecuteIndirect(DISPATCH_MESH)through the same root-window check, nonempty-viewport check, and graphics snapshot (viewport/scissor arrays + depth bounds) asDispatchMesh(d3d12_com.cpp:554-568,1027-1036,2022-2085) cleanly brings direct, terminal-only, and bundle paths into parity.Approve.
AI-assisted review + local MSVC/dual-GPU verification.
Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T10:22:47Z.
#2492 | head
455e574b72(merged cleanly with main33db04a701) |ctest --test-dir runtime/build -C RelWithDebInfo -R "^(d3d12_mesh|d3d12_mesh_heavy_cache)$" --output-on-failure(LEONIDA_VK_VALIDATION=1) | red on main:d3d12_mesh_testfails (d3d12_mesh_test.cpp:717: list->Close() == E_INVALIDARG:ExecuteIndirectwithDISPATCH_MESHskippedmesh_root_window_ok) | green on PR+main:2/2CTests pass on RTX 3090 (d3d12_meshin0.75sandd3d12_mesh_heavy_cachein0.70s,4096 pixels matched, root-window check, viewport 1-of-2 draw, and viewport/scissor array propagation passing withLEONIDA_VK_VALIDATION=1and0Khronos validation errors);check_no_game_data.py0violations | Windows 11, RTX 3090 (610.88), Vulkan SDK 1.4.363.1 | AI-assisted: yesImported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-28T22:02:56Z.
Verified by OreoFR
Run 1 (lot 4)
09c153948+ PR head455e574b7; integration package 2 of 6 (4 PRs, merged without conflict)Run 2 (lot 4 bis)
33db04a70+ PR head455e574b7; integration package of 15 PRsAll runs
AI-assisted (Claude Code, Claude Opus 5.5).
Imported from ubiquitarianism/leonida. Originally posted by enlight3d on 2026-11-29T00:46:04Z.
RUN (Windows 11, red/green)
Tested heads: PR head
455e574b721d6485402eb78f095bd913afea4e1b(base43a9d562d, one commit);mainat1bc055e6c2dedaa0de23ec79d8c4007c1dff1fb3.git merge-tree --write-tree main pr-2492merges cleanly.Machine: Windows 11 Pro 10.0.26300, MSVC 14.44 (VS 2022 Build Tools), RelWithDebInfo, Ninja, 8 jobs. GPU NVIDIA GeForce RTX 3090 24 GB, driver 621.40 (Vulkan device with VK_EXT_mesh_shader, needed to create the mesh PSO).
Commands (only the test target and its dependencies were built, not the whole runtime):
GREEN (PR head):
d3d12_meshpassed (1/1, not skipped). The final line of the test run is "ExecuteIndirect DISPATCH_MESH records as DispatchMesh: root window checked, viewport 1 of 2 drawn, viewport and scissor arrays kept"; the existing indirect mesh pixel check still matches 4096 pixels.RED (behavioural, not a missing header): PR head with only
runtime/shims/d3d12_com.cppput back to the base version (43a9d562d), test file kept; rebuiltd3d12_mesh_testand ran the same ctest:d3d12_meshFAILED with "line 717: list->Close() == E_INVALIDARG", the first new check (wide root signature plus viewport, then ExecuteIndirect, must fail Close). That matches what the PR description says for main. The test stops at the first failed check, so I did not see lines 730 and 733 (viewport 0 test, viewport array); I did not try the two partial reverts.Link check: merged into main
1bc055e6c, gta6rt.exe builds and links (RelWithDebInfo, MSVC 19.44); no new imports vs main.Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-29T01:03:24Z.
Merged after enlight3d (Thib)'s red/green run (RUN, RTX 3090, driver 621.40, Windows 11: green with this PR, red without it, and
gta6rt.exestill links) and a re-check here: no conflict withmain17f5b935d, same head as run,no-game-datagreen, and the only ctest failures in the Windows/macOS CI jobs are tests this diff does not touch (known onmainor Vulkan: vk_xdxr_postbuild_readback vk_bindless_dimensions d3d12_compile_pool xbox_present ).AI-assisted (Claude Code, Claude Opus 5.5), merged for MoonEyes.