Skip to content

d3d12: DISPATCH_MESH signatures on every device, and ExecuteIndirect checks them as the host does (depends on #7330) - #9370

Closed
dracbat wants to merge 2 commits into
ProjectLeonida:mainfrom
dracbat:fix/mesh-signature-host-parity-2
Closed

dracbat wants to merge 2 commits into
ProjectLeonida:mainfrom
dracbat:fix/mesh-signature-host-parity-2

Conversation

@dracbat

@dracbat dracbat commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: stop 19 on GPUs without mesh shaders (#7913 (comment)). The measurement was shared with @NiiRoZz on #7330 (#7330 (comment)).

Depends on: #7330. This branch is #7330's head efc347830 plus one commit, so until #7330 merges this diff includes it. The change only matters for code that relies on #7330's E_NOTIMPL. Also related:

What and why

#7330 creates a DISPATCH_MESH command signature only on a device with VK_EXT_mesh_shader, and answers E_NOTIMPL otherwise. Its ExecuteIndirect also returns for such a signature before the argument-buffer bounds are checked. The host runtime does neither. Measured on an AMD RX 5700 (RDNA1, AMD driver 32.0.21045.29003, MeshShaderTier 0, D3D12Core 10.0.26100.9818) and on WARP:

#7330's description says why this matters for the boot: the title's renderer init creates five one-argument signatures, the fifth a 12-byte DISPATCH_MESH, and asserts when one of them fails. Without mesh shaders (RDNA1 on AMD's Windows driver, Pascal, older Intel), #7330 alone still fails there.

Changes:

  • CreateCommandSignature creates the signature on every device. The stride, argument and root-signature checks are unchanged, and mesh PSOs still need VK_EXT_mesh_shader.
  • ExecuteIndirect refuses a DISPATCH_MESH signature on any list but a direct one, as the host does. It returns for such a signature only after that, and after every check the other kinds get, including the argument-buffer bounds with 12-byte records. It still records nothing (Runtime: ExecuteIndirect with DISPATCH_MESH signatures and the M5 mesh gate (translated mesh shader) #3777 replays it).
  • docs/d3d12_vulkan.md: section 4.7 describes the signature and its ExecuteIndirect checks, and the D3D-29 Device bullet now says the signature is created without mesh shaders too.

Tested

AMD Radeon RX 5700 (no VK_EXT_mesh_shader), AMD driver 32.0.21045.29003, Windows 11, MSVC 14.44, Vulkan SDK 1.4.363.1:

  • d3d12_execute_indirect_validation, with LEONIDA_VK_VALIDATION 0 and 1: 67 parity cases, 18 of them new. Every case is compared with live WARP and the live hardware runtime; the hardware column's label now names the driver. The new cases are 15 DISPATCH_MESH cases on a direct list (bounds, alignment, a texture as the argument buffer, a count buffer, a padded stride, MaxCommandCount 0) and 3 on compute and copy lists. All rows agree across the layer, WARP and the RX 5700, with 0 failures and 0 validation errors.
  • d3d12_vulkan_device: compare_invalid_arguments compares a 12-byte and an 8-byte DISPATCH_MESH signature with the host live: ours 0x00000000 host 0x00000000, and ours 0x80070057 host 0x80070057, on this GPU and with LEONIDA_HOST_ADAPTER=warp.
  • d3d12_mesh, without the extension, validation on:
    • the signature is created, and a direct list with ExecuteIndirect on it closes, executes and is waited on, with no device removal and 0 validation errors;
    • the test then exits 77 on this GPU.
    • The mesh-capable part never ran here. By inspection it still passes; could someone with a mesh-capable GPU run d3d12_mesh?
  • xs_proxy_mock: passes.
  • Negative controls, each with the new rows kept:
  • Pre-existing failures on this GPU, unchanged by this PR:
  • Retail boot, my own 1.0.2.1 copy, a local integration stack with this change, the RX 5700: the slot-41 assert no longer fires, and init goes on to the frame loop.

AI-assisted: yes (Claude Code).

Checklist

  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • 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

NiiRoZz and others added 2 commits November 23, 2026 17:31
…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>
…checks them as the host does

otherwise, and its ExecuteIndirect returns for such a signature before the argument-buffer bounds are checked. The host
runtime does neither. Measured on an RX 5700 (RDNA1, AMD driver 32.0.21045.29003, MeshShaderTier 0, D3D12Core
10.0.26100.9818) and on WARP:
- CreateCommandSignature with one 12-byte DISPATCH_MESH argument answers S_OK, with the debug layer on too (no
  messages), and with an 8-byte one E_INVALIDARG.
- Close fails after an ExecuteIndirect with such a signature whose records run past the argument buffer, or on a
  compute or a copy list. With ItsNotRexed#7330's ExecuteIndirect, the layer's Close answered S_OK in 9 such cases (6 past the
  buffer, 3 on those lists): it checked no list type but the bundle.

creates five one-argument command signatures, the fifth a 12-byte DISPATCH_MESH, and asserts when one of them fails.
That boot was not reproduced here.

- CreateCommandSignature creates the signature on every device. The stride, argument and root-signature checks are
  unchanged, and mesh PSOs still need VK_EXT_mesh_shader.
- ExecuteIndirect refuses a DISPATCH_MESH signature on any list but a direct one, as the host does, and returns for
  such a signature only after that and every check the other kinds get, the argument-buffer bounds with 12-byte
  records included. It still records nothing (ItsNotRexed#3777 replays it). The list types of the other signatures are left to
  ItsNotRexed#5252, which enforces the copy- and compute-list recording restrictions.
- docs/d3d12_vulkan.md: section 4.7 describes the signature and its ExecuteIndirect checks, and the D3D-29 Device bullet
  says that the signature is created without mesh shaders too.

Tests:
- d3d12_execute_indirect_validation_test has 18 new rows, each compared with live WARP and the live hardware runtime:
  15 DISPATCH_MESH cases on a direct list (bounds, alignment, a texture as the argument buffer, a count buffer, a
  padded stride, MaxCommandCount 0) and 3 on compute and copy lists. The label of its hardware column names the
  driver.
- compare_invalid_arguments in d3d12_vulkan_device_test compares a 12-byte and an 8-byte DISPATCH_MESH signature with
  the host live.
- On the device without mesh shaders, d3d12_mesh_test creates the signature, runs a direct list with ExecuteIndirect on
  it, waits on a fence, checks that the device is not removed, and counts validation errors before a GPU without the
  extension exits with 77.

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

Copy link
Copy Markdown

Mesh-capable Windows check of 4e4d3faa on an RTX 3080 Ti (621.35), MSVC 19.44.35230, and Vulkan SDK 1.4.363.

Both the mesh-disabled device and the Tier 1 device accepted a 12-byte DISPATCH_MESH signature. A direct command list with a valid indirect record closed on both. On the mesh-disabled device the list also submitted and reached its fence with the device still reporting S_OK. The expected runtime diagnostic confirmed that indirect mesh dispatch was not recorded. The direct mesh and vertex draws matched all 4,096 expected pixels, and all three shader modules passed spirv-val.

With the stock pipeline-statistics case retained, Khronos validation reported three VUID-vkCmdDrawMeshTasksEXT-pipelineStatistics-07076 messages. With that case omitted, the focused CTest passed with zero skips or core or synchronization validation errors. Both runs used a temporary fixture limited to valid cases and the exact PR runtime. Synthetic inputs only. AI-assisted.

@smowlyy

smowlyy commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Verified on native Windows 11 (10.0.26300.9974, MSVC 19.44, RelWithDebInfo, Vulkan SDK 1.4.363.0, NVIDIA GeForce RTX 5060 Ti driver 610.88 / Vulkan 1.4.341), PR head 4e4d3faa0 merged onto main (6312c057f):

  • python -I scripts/check_no_game_data.py ... (all 7 changed files): clean (exit 0).
  • cmake --build runtime/build --target d3d12_execute_indirect_validation_test d3d12_mesh_test d3d12_vulkan_device_test --parallel: built cleanly.
  • ctest --test-dir runtime/build -R "^(d3d12_execute_indirect_validation|d3d12_mesh)$" --output-on-failure -V: 2/2 passed:
    • d3d12_execute_indirect_validation: 67 parity cases (WARP=live, HW=NVIDIA GeForce RTX 5060 Ti (driver 32.0.16.1088)), positive GPU dispatch ok, 0 validation errors, 0 failures.
    • d3d12_mesh: passed (D3D-29, including DISPATCH_MESH command signature / ExecuteIndirect coverage).
  • d3d12_vulkan_device: the new compare_invalid_arguments command signature: dispatch mesh cases matched host with 0 mismatches (the binary only hit an unrelated pre-existing failure at line 6583 where CreateReservedResource2 / slot 78 routes to SetFrameIntervalX).

AI-assisted.

@sovljanskii

Copy link
Copy Markdown
Contributor

checked: 4e4d3faa0 on a GPU without mesh shaders | base: forge main@4fe7db213 + this PR's own commit (cherry-picks cleanly, since forge main already has #7330's code) | on: macOS 27.2.1, Apple M4, MoltenVK 1.4 (no VK_EXT_mesh_shader), cross-built with clang-cl + xwin, run under Wine Staging | result: pass

Negative control: the same test sources built against forge main's unchanged runtime/shims and runtime/src.

test this PR negative control
d3d12_mesh_test exits 77 after the no-extension block passes (signature created, list with its ExecuteIndirect run and waited on) exits 1
d3d12_execute_indirect_validation_test exits 0: 67 parity cases, positive GPU dispatch ok, 0 validation errors, 0 failures (mesh on a copy list → E_INVALIDARG) exits 1
d3d12_vulkan_device_test exits 1 exits 1, same check

d3d12_vulkan_device_test stops at the same check in both builds: line 5148, a 3D render-target allocation on MoltenVK. That failure is already on forge main, not caused by this PR. Its compare_invalid_arguments rows (where the new mesh rows are) are skipped under Wine ("host D3D12 is Wine's").

Retail title on the M4, same base + #7111 (Rosetta has no CLWB), own 1.0.2.1 copy, offline, 300 s:

  • Without a fix, the title stops with an int3 at the slot-41 DISPATCH_MESH signature after 1,656 D3D12 calls.
  • With this commit:
    • 0 slot-41 failures;
    • 49,166 PSOs, 14 failed;
    • 0 slot-57 failures;
    • PresentX ready.
  • It then reaches the next stop, WaitFrameEventX after the first present. That one comes from forge 097e9f46 and is not caused by this PR; see #8851.

Board item: #8851.

AI-assisted.

@sebastttt

Copy link
Copy Markdown

checked: #93704e4d3fa on the exact PR head. Windows 11 26300.9974, MSVC 19.51 Release, RX 9060 XT (RDNA 4, driver 32.0.32029.2010), glslang 16.6.0, Khronos validation 1.4.363. Synthetic inputs only.

  • d3d12_execute_indirect_validation: 67 parity cases matched live WARP and native AMD D3D12. Positive GPU dispatch passed, with 0 validation errors and 0 failures.
  • d3d12_mesh: mesh tier 1; DispatchMesh over X/Y/Z and the vertex draw matched all 4,096 pixels. The unmodified test passed with validation off. With validation on, it reported three VUID-vkCmdDrawMeshTasksEXT-pipelineStatistics-07076 errors, matching the RTX 3080 Ti report above.
  • d3d12_vulkan_device: stopped at tiles == 1 (line 6573) in both modes, matching the tiling failure described by the author.

Command: ctest -R "^(d3d12_execute_indirect_validation|d3d12_mesh|d3d12_vulkan_device)$" -V, with LEONIDA_VK_VALIDATION=0/1. AI-assisted testing and reporting.

agent: yes

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.

7 participants