runtime: forward indirect Dispatch signatures with root constants #2084

Merged
Not-Saii merged 3 commits from upstream-pr/2091 into main 2026-11-25 00:25:12 +00:00
Not-Saii commented 2026-11-25 00:07:32 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Not-Saii on 2026-11-25T00:07:32Z.


Refs #1759 (part 2, root arguments in signatures)

Summary

Device slot 41 now records a compute command signature created with a root signature, whose arguments are one or more CONSTANT arguments followed by DISPATCH. The stride must equal the constants plus the 12-byte Dispatch record exactly. List slot 61 executes it when the desktop compute root bound through slot 33 is the signature's root, and checks that the whole record (constants and Dispatch) fits in the placed argument buffer. If the bound root differs, the call is refused with signature root constants require the bound compute root before anything is recorded.

Root views, vertex and index buffer views, graphics commands with root arguments and the console-only argument type are still refused, as before. The rootless Dispatch, Draw, DrawIndexed and DispatchMesh paths are unchanged.

Fixture

startup_indirect_dispatch gains a constants mode, registered as startup_indirect_root_constants_{warp,hardware}:

  • Root and writers. The root has a UAV and two 32-bit constants (scale, bias) at b0. The GPU writer stores (3, 7) and groups (4, 3, 2) after a padding word, on the same list. The swapped writer stores (7, 3).
  • Consumer. It accumulates scale * (1 + x + 10y + 100z) + bias per group, so swapped or missing constants change the exact result.
  • Controls. An omitted writer, then the existing unmapped, short-range and placeholder refusals. Three cases are new:
    • a guest compute root that lacks the constants;
    • a record that starts 12 bytes before the buffer end, where a Dispatch alone would fit but the constants and Dispatch do not;
    • a signature with 4 spare stride bytes.

The rootless mode keeps its existing cases.

Command

.\tools\dev.ps1
cmake --preset dev
cmake --build --preset dev --target startup_indirect_dispatch
ctest --preset dev --no-tests=error -R '^startup_indirect_(dispatch|root_constants)_(warp|hardware)$' -V

Result

Environment: Windows 11 build 26300.9974, MSVC 14.44, dev preset (Debug). Branch head: 91b2ca48, on top of 6218beb2. The D3D12 debug layer was enabled on both adapters.

Test WARP (Microsoft Basic Render Driver 10.0.26100.9818) NVIDIA GeForce RTX 4090 (32.0.16.1088)
startup_indirect_dispatch Passed Passed
startup_indirect_root_constants Passed Passed

4 passed, 0 failed, 0 capability skips. The same four tests also passed on the release preset after the rebase onto 6218beb2.

In the constants mode, both adapters read back the following. Both argument guards held in every case.

Case Expected and observed
Writer (3, 7) 0x31416b62
Writer (7, 3) 0x31418272
Omitted writer 0x31415926 (sentinel)
Unmapped, short range, placeholder, other root, partial record, padded stride 0x31415926 (refused)

Negative controls

  • Upstream slot 41 and slot 61 code, new fixture. Both adapters fail at word 6 with 0x31415926, expected 0x31416b62. The call is refused as not a single rootless signature.
  • Root comparison removed. Both adapters fail the other-root case. WARP reports debug-layer message 744 (root signature mismatch). On the RTX 4090 the consumer writes 0x31416b62 where the sentinel is expected.
  • Range check over the Dispatch record alone. The partial record is executed, and the desktop runtime fails the list's Close with E_INVALIDARG on both adapters.
  • Stride >= instead of ==. The padded signature executes, and both adapters write 0x31416b62 where the sentinel is expected.

Other checks

  • ctest --preset {dev,release} --no-tests=error -R '^startup_indirect_': 10/10 passed on each preset, including Draw, DrawIndexed and DispatchMesh on WARP and the RTX 4090, with no skips.
  • ctest --preset dev --no-tests=error -R 'command_signature|startup_d3d12|signature': 10/10 passed.
  • ctest --preset dev --no-tests=error -R '^startup_' -j 8 on 91b2ca48: 323 passed, 0 failed, 2 capability skips (startup_view_heap_warp, startup_logical_view_warp), out of 325.
  • tests/docs_links_check.py and tests/bidi_controls_check.py passed.

Scope

This uses source-built desktop pipelines only. The #1412 census recorded only argument types 0, 1, 2 and 10 plus one console-only type, so this slice completes the issue's stated contract and does not follow an observed application call. Root views (part 2 continued), console signatures and the application submission path remain open on #1759. No game files were used.

AI-assisted (Claude Code).

🤖 Generated with Claude Code

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6594039549 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2091). Originally posted by [Not-Saii](https://github.com/Not-Saii) on 2026-11-25T00:07:32Z. --- Refs #1759 (part 2, root arguments in signatures) ### Summary Device slot 41 now records a compute command signature created with a root signature, whose arguments are one or more `CONSTANT` arguments followed by `DISPATCH`. The stride must equal the constants plus the 12-byte Dispatch record exactly. List slot 61 executes it when the desktop compute root bound through slot 33 is the signature's root, and checks that the whole record (constants and Dispatch) fits in the placed argument buffer. If the bound root differs, the call is refused with `signature root constants require the bound compute root` before anything is recorded. Root views, vertex and index buffer views, graphics commands with root arguments and the console-only argument type are still refused, as before. The rootless Dispatch, Draw, DrawIndexed and DispatchMesh paths are unchanged. ### Fixture `startup_indirect_dispatch` gains a `constants` mode, registered as `startup_indirect_root_constants_{warp,hardware}`: - **Root and writers.** The root has a UAV and two 32-bit constants (`scale`, `bias`) at `b0`. The GPU writer stores `(3, 7)` and groups `(4, 3, 2)` after a padding word, on the same list. The swapped writer stores `(7, 3)`. - **Consumer.** It accumulates `scale * (1 + x + 10y + 100z) + bias` per group, so swapped or missing constants change the exact result. - **Controls.** An omitted writer, then the existing unmapped, short-range and placeholder refusals. Three cases are new: - a guest compute root that lacks the constants; - a record that starts 12 bytes before the buffer end, where a Dispatch alone would fit but the constants and Dispatch do not; - a signature with 4 spare stride bytes. The rootless mode keeps its existing cases. ### Command ```powershell .\tools\dev.ps1 cmake --preset dev cmake --build --preset dev --target startup_indirect_dispatch ctest --preset dev --no-tests=error -R '^startup_indirect_(dispatch|root_constants)_(warp|hardware)$' -V ``` ### Result Environment: Windows 11 build 26300.9974, MSVC 14.44, `dev` preset (Debug). Branch head: `91b2ca48`, on top of `6218beb2`. The D3D12 debug layer was enabled on both adapters. | Test | WARP (Microsoft Basic Render Driver 10.0.26100.9818) | NVIDIA GeForce RTX 4090 (32.0.16.1088) | |---|---|---| | `startup_indirect_dispatch` | Passed | Passed | | `startup_indirect_root_constants` | Passed | Passed | 4 passed, 0 failed, 0 capability skips. The same four tests also passed on the `release` preset after the rebase onto `6218beb2`. In the constants mode, both adapters read back the following. Both argument guards held in every case. | Case | Expected and observed | |---|---| | Writer `(3, 7)` | `0x31416b62` | | Writer `(7, 3)` | `0x31418272` | | Omitted writer | `0x31415926` (sentinel) | | Unmapped, short range, placeholder, other root, partial record, padded stride | `0x31415926` (refused) | ### Negative controls - **Upstream slot 41 and slot 61 code, new fixture.** Both adapters fail at word 6 with `0x31415926`, expected `0x31416b62`. The call is refused as not a single rootless signature. - **Root comparison removed.** Both adapters fail the other-root case. WARP reports debug-layer message 744 (root signature mismatch). On the RTX 4090 the consumer writes `0x31416b62` where the sentinel is expected. - **Range check over the Dispatch record alone.** The partial record is executed, and the desktop runtime fails the list's Close with `E_INVALIDARG` on both adapters. - **Stride `>=` instead of `==`.** The padded signature executes, and both adapters write `0x31416b62` where the sentinel is expected. ### Other checks - `ctest --preset {dev,release} --no-tests=error -R '^startup_indirect_'`: 10/10 passed on each preset, including Draw, DrawIndexed and DispatchMesh on WARP and the RTX 4090, with no skips. - `ctest --preset dev --no-tests=error -R 'command_signature|startup_d3d12|signature'`: 10/10 passed. - `ctest --preset dev --no-tests=error -R '^startup_' -j 8` on `91b2ca48`: 323 passed, 0 failed, 2 capability skips (`startup_view_heap_warp`, `startup_logical_view_warp`), out of 325. - `tests/docs_links_check.py` and `tests/bidi_controls_check.py` passed. ### Scope This uses source-built desktop pipelines only. The #1412 census recorded only argument types 0, 1, 2 and 10 plus one console-only type, so this slice completes the issue's stated contract and does not follow an observed application call. Root views (part 2 continued), console signatures and the application submission path remain open on #1759. No game files were used. AI-assisted (Claude Code). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
upstream-sync closed this pull request 2026-11-25 01:01:36 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
R0Y00/Xbox2Windows!2084
No description provided.