Skip to content

d3d12: CreateCommandSignature creates a DISPATCH_MESH signature on a device with mesh shaders (ExecuteIndirect with it not replayed yet) - #7330

Closed
NiiRoZz wants to merge 1 commit into
ProjectLeonida:mainfrom
NiiRoZz:d3d12/dispatch-mesh-signature
Closed

NiiRoZz wants to merge 1 commit into
ProjectLeonida:mainfrom
NiiRoZz:d3d12/dispatch-mesh-signature

Conversation

@NiiRoZz

@NiiRoZz NiiRoZz commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Claimed in #7231 (comment)

Depends on: none (based on main). It overlaps #3777 on purpose: the new IndirectKind::dispatch_mesh = 3 has the name and value #3777 uses, and its creation case is the one #3777 adds. If #3777 lands first, this PR is unnecessary; if this lands first, #3777 drops the stand-in in ExecuteIndirect.

What

  • CreateCommandSignature on the Vulkan layer creates a one-argument DISPATCH_MESH signature when the device has VK_EXT_mesh_shader (it reports MeshShaderTier 1). Without the extension it is still E_NOTIMPL, the same answer a mesh PSO gets there. The stride and argument-order checks before it are unchanged, so a stride below the 12 bytes of D3D12_DISPATCH_MESH_ARGUMENTS is E_INVALIDARG.
  • ExecuteIndirect with such a signature validates its buffers as before, then records nothing and logs once: the replay is Runtime: ExecuteIndirect with DISPATCH_MESH signatures and the M5 mesh gate (translated mesh shader) #3777's (vkCmdDrawMeshTasksIndirectEXT). The list stays valid and closes.

Why

The retail boot under LEONIDA_D3D12=vulkan, with #7163 (type 105) and #7115 (slot 61) merged locally. The title's renderer init creates five one-argument command signatures at startup and asserts if any of them fails. The fifth is a 12-byte DISPATCH_MESH, which the layer refused with E_NOTIMPL. The PC runtime creates it on any mesh-tier-1 device, and the layer already has mesh PSOs and DispatchMesh on that tier.

This is a stand-in: the title's indirect mesh dispatches draw nothing until the replay lands. I'll post that remaining work on the coordination issue.

Tested

Windows 11, MSVC 2022 (14.44, RelWithDebInfo, Ninja), RTX 5090, Vulkan SDK 1.4.363.0:

  • d3d12_mesh_test: exit 0. New checks: without the extension, the signature is E_NOTIMPL. With it, the signature is created, a stride of 8 is E_INVALIDARG, and a list with ExecuteIndirect through the signature closes S_OK.
  • Negative control: without the creation case, the test fails at its CreateCommandSignature expectation.
  • d3d12_execute_indirect_validation_test: 49 parity cases, 0 failures.
  • d3d12_vulkan_device_test exits 1 here both with and without this change (no case reports a mismatch; it fails the same way on plain main on this machine).
  • Retail boot (locally merged with the boot-path PRs): before, the renderer-init assert after the five signatures (1,656 D3D12 calls). After, the init passes and the boot goes on to device slot 74.

AI-assisted: yes (Claude Code)

Checklist

  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. Only public API names, argument shapes and counts; no addresses, offsets, disassembly, strings or bytes from the executable.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a: no translator change)

🤖 Generated with Claude Code

…device with mesh shaders

The Vulkan layer created signatures for draw, draw-indexed and dispatch only and answered E_NOTIMPL
for DISPATCH_MESH, which the PC runtime creates on any mesh-shader tier 1 device. A title that
creates such a signature at startup and asserts on the result stopped there.

The signature is created when the device has VK_EXT_mesh_shader (MeshShaderTier 1), as a new
IndirectKind::dispatch_mesh (the name and value ItsNotRexed#3777 uses, so the two merge). ExecuteIndirect with
it records nothing yet and says so once; ItsNotRexed#3777 replays it as vkCmdDrawMeshTasksIndirectEXT.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@MartinIndra02

Copy link
Copy Markdown
Contributor

Independent Windows + GPU test of efc347830: pass.

Setup: Windows 11 x64, MSVC 19.44.35220 (RelWithDebInfo, Windows SDK 10.0.26100.0), NVIDIA GeForce RTX 3080 (driver 32.0.16.2124 / 621.24), Vulkan SDK 1.4.363.1, no game files.

  • d3d12_mesh_test.exe: PASS (exit 0) — confirms DISPATCH_MESH command signature returns E_NOTIMPL without VK_EXT_mesh_shader, succeeds with 12-byte stride on RTX 3080, returns E_INVALIDARG on 8-byte stride, and ExecuteIndirect logs once and lets the list close cleanly.
  • Under LEONIDA_VK_VALIDATION=1: 0 validation errors from this PR's code (only the pre-existing 3 VUID-vkCmdDrawMeshTasksEXT-pipelineStatistics-07076 errors in the statistics query test, tracked separately in Runtime: mesh-draw statistics segments count no clipping (VUID-07076); clipping from mesh-primitives queries #7112).

AI-assisted review/test.

@Pipodi

Pipodi commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Tested efc347830 on the retail boot: pass, and it unblocks the boot. Own 1.0.2.1 copy, Windows 11, RTX 4090 / 617.42, LEONIDA_D3D12=vulkan, on boot-integration plus #7115, #6891, #7201, #7163 and a local DirectStorage zlib stage (the #7180 idea).

AI-assisted (Claude Code).

@umnitus

umnitus commented Nov 23, 2026

Copy link
Copy Markdown

Independent native Windows check at efc3478, RTX 3060 12 GB / NVIDIA 621.14, clang-cl/xwin, Khronos validation 1.4.363.

d3d12_execute_indirect_validation passed all 49 parity cases against native NVIDIA D3D12 and WARP, including the positive GPU dispatch, with zero validation errors. d3d12_mesh passed with validation off. With validation on, it failed twice with three vkCmdDrawMeshTasksEXT-pipelineStatistics-07076 reports, for the clipping counters already reported in #2359. I saw no other validation errors in those runs. AI-assisted testing.

@memorypressure

Copy link
Copy Markdown

Verified at efc3478, merge-tree clean against current main 9177299. DISPATCH_MESH gated on the same MeshShaderTier as DispatchMesh, ExecuteIndirect-with-mesh records nothing and logs once — consistent with the stated "not replayed yet" scope (#3777) — and d3d12_mesh_test.cpp covers both the no-extension refusal and the create/execute/close path with stride<12 refused. C++/ctest not runnable on this box; CI pending is the execution gate. AI-assisted: yes. Tested on Linux (RTX 5080 host, CPU-only run, C++ review-only).

@jacksonslab

Copy link
Copy Markdown

Tested on the retail executable: pass. Windows 11, i7-14700K, RTX 4070 SUPER, MSVC RelWithDebInfo, LEONIDA_D3D12=vulkan, own 1.0.2.1 copy, on a local stack of the open boot-chain PRs (listed in #7231 (comment)). The title's graphics init returned false because the fifth CreateCommandSignature (slot 41) came back E_NOTIMPL, which I found with a probe after each call (#7555). With this PR applied it succeeds, the init returns true, and the boot goes on. AI-assisted (Claude Code).

@dracbat

dracbat commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

A host measurement for the path without mesh shaders. On an AMD RX 5700 (Windows 11, MeshShaderTier 0, AMD driver 32.0.21045.29003, D3D12 10.0.26100.9818), the host runtime answers CreateCommandSignature for a single 12-byte DISPATCH_MESH argument with S_OK, also with the debug layer on, which stores no message.

So E_NOTIMPL without mesh shaders differs from the host. It also leaves the title's fifth renderer-init signature failing on these GPUs (RDNA1 on AMD's Windows driver, Pascal, older Intel), which is stop 19 on them. ExecuteIndirect with the signature already records nothing here. Dropping the state_.info.mesh_shader check for the signature (the mesh PSOs stay refused) would therefore match the host and clear that stop.

Would you rather fold that into this PR, or shall I open a small follow-up on top of it? A follow-up would add a host-compared case and a GPU run on the RX 5700, which has no VK_EXT_mesh_shader. I claimed the no-mesh case in #7333.

AI-assisted (Claude Code).

@SamuelHaleDev

Copy link
Copy Markdown

Tested efc3478 on AMD Radeon RX 6650 XT (RDNA2), Windows 11, MSVC 14.44, Vulkan SDK 1.4.363:

@Marukooh

Copy link
Copy Markdown
Contributor

Live on Wine 11.22 + RTX 5070 Ti: with #7163 alone, stop 19 still fails (the title's DISPATCH_MESH signature is refused by the Vulkan layer). With #7330 on top, all five device-slot-41 calls succeed (type 105 as DISPATCH from #7163, DISPATCH_MESH from #7330) and init goes on to slots 61, 24, 74 and 86.

Environment: CachyOS, Wine 11.22, Intel i9-14900KF, RTX 5070 Ti / NVIDIA 620.73.04, Vulkan 1.4.357, clang-cl 23.1.5 + xwin SDK 10.0.26100, Release, LEONIDA_D3D12=vulkan, network blocked, own 1.0.2.1 copy, no int3 skipping. Boot stack on main 1d21030: #7411, #7110, #7076, #7066, #6954, #6582, #4348, #7216, #4313, #7499, #7516, #7163, #7330, #7115, #7323, #7201, #7286, #7290, #7180, #6891, #7111, #7403 (PR heads merged, conflicts resolved locally). AI-assisted (Claude Code).

@Zunraz

Zunraz commented Nov 23, 2026

Copy link
Copy Markdown

Independent combined-stack check of efc347830 with #7163 084c8c60e and #7115 e22994464 on the RT-5 integration described in my #7240 follow-up (#7240 (comment)): renderer init now proceeds to slot 61, CopyDescriptorsSimple, and slot 74 / PC ShaderCacheControl, where it stops (1,658 traced D3D12 calls). This is a combined-stack result, not a claim that #7330 alone clears the stop without the type-105 adaptation.

d3d12_execute_indirect_validation_test: 49 parity cases, positive GPU dispatch passes, zero fixture failures. d3d12_mesh_test is not configured in this cross-build because glslangValidator is missing; I did not run its new mesh-specific assertions. No indirect-mesh replay or rendered-frame claim.

Merge details: retained all existing overridden slots and tests. #7115's sampler handler additionally translates its destination via #7021's existing CPU-handle helper in this local integration. All seven combined proxy mock modes pass.

Windows 11 build 26300, RTX 5090 / driver 32.0.16.2124, clang-cl 21.1.8 + xwin SDK 10.0.26100, static CRT, Vulkan backend. Native Windows execution; socket/DNS/transmission entrypoints debugger-guarded, no assertion skipping. No Vulkan validation layer available. Counts and public API names only; no game data or raw diagnostics attached. AI-assisted (Codex).

@jtrudeau1530

Copy link
Copy Markdown

Independent Wine/RADV single-change comparison of #7330 at efc347830b9ccf1461baf9a764ac9e5e911de8f6.

Arch Linux, Wine 11.18, RX 7900 XT / RADV Mesa 26.2.3, clang-cl 23.1.6 + xwin, RelWithDebInfo. Same prefix, shader library and 30-second offline sandbox; display available, no assertion skipping. Local diagnostic integration only, not current main or ladder-frame.

Control: main 8575d36ed plus #6919/#4313/#6582/#4348/#7216, device stack #6954/#7076 (older #2490)/#6973/#6964/#7021/#6953/#7075/#7066/#7052/#7240, the section-view-only 0x600 protection mask, #6739's runtime loader, and #7163 at 084c8c60e. Combination resolutions preserve the slot-25/26 thunks, slot-70 handle translation and both slot-127/133 handlers/tests. #7240 is the only resource-lease mechanism. The shader library loads 26,503 main + 21 FSPX + 52 BVH entries. Raw inputs and logs stay local.

Synthetic results: 11/12 focused tests pass (seven proxy modes, COM, indirect-validation and two tiny-frame modes). d3d12_mesh fails at the pre-existing list->Close() == S_OK check before the new mesh-enabled signature checks. The unchanged older control reproduces that same failure. The new no-mesh refusal check runs and passes; the new mesh-enabled assertions remain unverified by that fixture. This is not a fully green suite.

This supports clearing the startup signature stop on this combination, not indirect mesh rendering: the PR's missing ExecuteIndirect replay remains missing. Next we are testing existing #7115, with attention to #7021's handle translation; no duplicate implementation.

AI-assisted testing and review (Codex).
agent: yes

@tedin7

tedin7 commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

checked: #7330 | with: merge of PR head onto main, then d3d12_mesh_test, d3d12_execute_indirect_validation_test, command_list_test (cross-built, run under Wine), plus a negative control | on: Wine 11 on a RunPod RTX 4090 (Linux, Vulkan), cross-built with clang-cl + xwin through the pod's ccache build script; not native Windows, and the host D3D12/WARP comparisons do not run (there is no WARP adapter under Wine). | result: pass on all three targets

  • PR head tested: efc3478, merged (clean) onto origin/main 867d922.
  • d3d12_mesh_test: exit 0 on the RTX 4090 Vulkan device (mesh tier 1): "DispatchMesh over X, Y and Z and a stream VS draw matched all 4096 pixels ... statistics queries around mesh draws resolve". This target really runs the Vulkan device here; it is not a skip.
  • d3d12_execute_indirect_validation_test: exit 0 ("49 parity cases ..., 0 validation errors, 0 failures"). The first run exited 1 with "wine: could not load kernel32.dll" (a Wine prefix race when two runs started at once on the pod); the rerun alone passed, and a clean origin/main copy also passes (exit 0).
  • command_list_test: exit 0 (builds with the new IndirectKind::dispatch_mesh value).
  • Negative control: with the three production files (d3d12_com.cpp, d3d12_vulkan_device.cpp, command_list.h) reverted to main and the PR's test kept, d3d12_mesh_test fails with exit 1 at test line 416 (creating the DISPATCH_MESH signature). So the new test does fail without the change.
  • Diff review (4 files, no game files): the new case sits inside the existing switch on argument type; a device without mesh_shader still gets E_NOTIMPL (the test checks the no-extension branch too). The stride check (12 bytes minimum, 8 refused with E_INVALIDARG) is exercised. In ExecuteIndirect the mesh kind returns after the existing count-buffer validation and before recording, with a one-time log line, so the list stays valid.
  • Concern (not a defect, a limit the PR states): ExecuteIndirect with a DISPATCH_MESH signature records nothing, so a title that really executes one gets silently missing GPU work after one log line. That is acceptable only as a boot-path step; it must not be read as mesh indirect support, and the replay (Runtime: ExecuteIndirect with DISPATCH_MESH signatures and the M5 mesh gate (translated mesh shader) #3777) is still needed. Other code that switches over IndirectKind was not audited beyond the build and the targets above.
  • Not verified: any replay of an indirect mesh dispatch, other test targets that include command_list.h, and anything on native Windows or with the retail title.

AI-assisted.

@sovljanskii

Copy link
Copy Markdown
Contributor

answer: dracbat's no-mesh proposal, measured on the retail title on a second GPU without VK_EXT_mesh_shader, this time on macOS.

base: ASTROWwwW:ladder-frame@a1751a9f0 (it carries this PR at efc347830) + #7896 | on: macOS 27.2.1, Apple M4, MoltenVK 1.4.0 (no VK_EXT_mesh_shader), Wine Staging 11.21, clang-cl 23 + xwin, LEONIDA_D3D12=vulkan, own 1.0.2.1 copy, a translated work folder (--mesh-compute), network off

  • As is: the title stops at its own int3 after 1,656 D3D12 calls. The last layer call is device slot 41. An init function returns false right after it, and its caller breaks. Same site in 2 of 2 runs.
  • With only the state_.info.mesh_shader check in CreateCommandSignature dropped (mesh PSOs still refused): no exception in 420 s (my timeout stopped it), 146,402 D3D12 calls, PresentX ready with a window. 1 run. What fails after that is the known rest: CreatePipelineState (the mesh PSOs this device refuses, plus MoltenVK pipeline errors) and device slot 57.

So on macOS this is the stop your change clears. Every Mac runs through MoltenVK, which has no VK_EXT_mesh_shader, so with the check no Mac gets past slot 41. I'm not taking it, since you claimed the no-mesh case in #7333. I can run your follow-up, or the commit if it's folded in here, on the M4.

AI-assisted. agent: yes

@byPreaZy

Copy link
Copy Markdown

checked: #7330 | with: applied the diff on main 6312c05, built d3d12_mesh_test (MSVC, Ninja RelWithDebInfo) | on: Windows 11, RX 9060 XT (mesh tier 1 confirmed by the test itself) | result: PASS — mesh tier 1, all 4096 pixels matched, pipeline-state-stream PSOs, statistics queries; the new DISPATCH_MESH signature cases (create with extension, E_NOTIMPL without, E_INVALIDARG under 12-byte stride, ExecuteIndirect records nothing and the list closes) all pass

Code read: dispatch_mesh is gated on state_.info.mesh_shader like DispatchMesh itself, the un-replayed ExecuteIndirect path logs once and leaves the list valid instead of failing, and IndirectKind::dispatch_mesh is appended (no renumbering of existing kinds).

AI-assisted check.

@CourtyardGames

Copy link
Copy Markdown

checked: efc3478 | base: main@8575d36ed + #7330 | on: Windows 11, MSVC 14.51, NVIDIA RTX 4070 SUPER (621.14) | result: builds clean and the PR's d3d12_mesh passes on the PR head and fails on the old code (control), so the test does exercise the change; no regression seen (one unrelated failure, below).

  • Read: the full diff (+39 lines, 4 files: the DISPATCH_MESH case in create_command_signature, a dispatch_mesh kind in command_list.h, the early return with a one-time log in ExecuteIndirect, and two test additions in d3d12_mesh_test.cpp). No networking, process, registry, clipboard or build-script changes.
  • Built: scripts/build_runtime.ps1 -jobs 4, exit 0. Note: d3d12_mesh_test is only built when glslangValidator is on PATH; mine was not, so the first build silently skipped it (the CMake message says so). I added the one in my conda env to PATH and rebuilt; then the test exists. Anyone checking this PR needs glslang on PATH or the PR's own test is not run.
  • Ran: ctest -R mesh: d3d12_mesh 1/1 passed. With LEONIDA_VK_DEVICE=4070. The mesh path is exercised on this GPU (mesh shaders present). Also xs_proxy* 6/6, d3d12_execute_indirect_validation, d3d12_indirect_zero, d3d12_indirect_rt passed. Whole suite with -E "d3d12_vulkan_device|d3d12_depth_resolve" (the two known failures): 1 failure, d3d12_indirect_dispatch_count ("count 0 update 1: host 6/10, layer 0/0, expected 6/10").
  • Controls: (1) d3d12_indirect_dispatch_count fails the same way with the PR's runtime changes reverted to the merge base (git checkout HEAD~1 -- runtime, rebuilt), so it is not from this PR; I did not investigate it further. (2) PR's new d3d12_mesh_test.cpp on the old source: fails (d3d12_mesh Failed), passes with the PR's source.
  • Code read: DISPATCH_MESH is only accepted when the device reports mesh shaders (E_NOTIMPL otherwise, which the test checks on the device without the extension); stride below 12 is refused (E_INVALIDARG, tested); ExecuteIndirect with it records nothing and logs once, and the list still closes (tested). The new case sits before the existing default: return E_NOTIMPL, so other types are unchanged. One thing to note: silently recording nothing means a title that really draws with it renders nothing without an error; the one-time [rt] log and the comment pointing at Runtime: ExecuteIndirect with DISPATCH_MESH signatures and the M5 mesh gate (translated mesh shader) #3777 cover that.

AI-assisted.
agent: yes

dadnotdaddy pushed a commit to dadnotdaddy/Leonida that referenced this pull request Nov 23, 2026
… DISPATCH_MESH signature on a device with mesh shaders (ExecuteIndirect with it not replayed yet)

Squashed from ItsNotRexed#7330 by NiiRoZz, head efc3478 (security scan PASS).
Raxstreams added a commit to Raxstreams/Leonida that referenced this pull request Nov 23, 2026
Reviewed head: efc3478
Review: ItsNotRexed#7330 (comment)
Board: ItsNotRexed#8919
AI-assisted integration.
@hammokko

Copy link
Copy Markdown

checked: #7330efc3478 | with: merged into a local retail-boot stack (main 867d922 + the boot PRs listed in #6824), retail 1.0.2.1 gta6rt --run | on: Windows 11 26200, RTX 5060 (32.0.16.2124), MSVC 14.44 RelWithDebInfo | result: the title's startup DISPATCH_MESH signature now succeeds; without it the E_NOTIMPL makes the title skip an initializer and later write through a null global, with it the boot goes on to the first PresentX. AI-assisted (Claude).

One note: d3d12_mesh fails on this machine at its line 372 (list->Close() == S_OK, before this PR's new block). I have not yet checked whether that also fails without #7330 on this GPU.

@ramenbellic

Copy link
Copy Markdown

Tested efc3478 under Wine: Proton Experimental (wine 11), runtime cross-built with clang-cl 23.1.6 + xwin SDK 10.0.26100 (RelWithDebInfo), merged onto main dfe4e4ad3: pass

  • Build: OK with clang-cl.
  • The tests this PR adds or touches, under Proton: 64 passed, 18 skipped, 6 failed (of 88).
  • The 6 failing (d3d12_clear, d3d12_clear_formats, d3d12_depth_resolve, d3d12_heap_properties, d3d12_residency, d3d12_vulkan_device) fail the same way on main dfe4e4ad3 alone in the same run, so none is from this PR.
  • 18 skipped under Wine, on main too (for example device_proxy needs a WARP adapter, which Wine doesn't have).

AI-assisted run (Claude Code); no game files used.

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.