D3D12.X: draws with untranslated pipelines get the title's root signature #142

Merged
tiagonleal merged 1 commit from upstream-pr/144 into main 2026-11-23 20:51:52 +00:00
tiagonleal commented 2026-11-23 15:12:54 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by tiagonleal on 2026-11-23T15:12:54Z.


Found while getting CI (#143) to run on a runner whose only GPU is WARP: the test title crashes inside d3d10warp.dll. With XCL_D3D12_DEBUG=1 the debug layer shows why, and it shows the same on an RTX 5070 Ti, where the driver just tolerates it:

D3D12 debug layer (error, id 200): ID3D12CommandList::DrawInstanced: No root signature has been set so calling Draw can lead to unexpected behavior.

13 times in one test-title run: 11× DrawInstanced, 2× DrawIndexedInstanced.

Why

bind::set_graphics_root_signature (console #34) only records the console layout and arguments. A translated draw then binds XCL's ABI root signature in bind_abi. A draw with an untranslated pipeline – PC shaders, a background build's stand-in, a fallback after the driver rejected the console shaders – went to the PC list as it was, with the comment "a PC pipeline: its own root signature and arguments". Nothing had ever bound that root signature on the PC list.

Change

bind::State keeps the title's graphics root signature (a PC object: dev_create_root_signature always returns one, an empty fallback at worst). It is cleared on Reset / ClearState. graphics_bound binds it before a draw with an untranslated pipeline. Stand-ins and fallbacks are made from a copy of the title's desc, pRootSignature included, so they match it. Translated draws are unchanged, and so is compute: untranslated dispatches are skipped already.

Test

e2e::test_title_draws_with_a_root_signature_under_the_debug_layer runs the test title with XCL_D3D12_DEBUG=1 and fails on any "No root signature has been set" in its log. Before: 13 draws without a root signature. After: none. It skips without d3d12SDKLayers.dll (Graphics Tools) or the system XGameRuntime, so it skips on the CI runner.

cargo test --workspace --no-fail-fast on main 484dd57 (RTX 5070 Ti): 561 passed, 0 failed, 39 ignored.

Not in this PR (seen in the same debug-layer run)

  • WARP still faults later: the unified memory cannot be made there (CreateReservedResource → E_OUTOFMEMORY), so IASetIndexBuffer gets a console address that is no GPU address (0x20010000 does not belong to any existing Resource or Heap). No title draws anything right without unified memory, so I left it.
  • One CopyBufferRegion on a resource in the wrong state (id 538), on the RTX 5070 Ti too.

AI-assisted.

🤖 Generated with Claude Code

<!-- greyfinch-sync:ivall/xcl:issue:6562396159 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/144). Originally posted by [tiagonleal](https://github.com/tiagonleal) on 2026-11-23T15:12:54Z. --- Found while getting CI (#143) to run on a runner whose only GPU is WARP: the test title crashes inside `d3d10warp.dll`. With `XCL_D3D12_DEBUG=1` the debug layer shows why, and it shows the same on an RTX 5070 Ti, where the driver just tolerates it: ``` D3D12 debug layer (error, id 200): ID3D12CommandList::DrawInstanced: No root signature has been set so calling Draw can lead to unexpected behavior. ``` 13 times in one test-title run: 11× `DrawInstanced`, 2× `DrawIndexedInstanced`. ### Why `bind::set_graphics_root_signature` (console #34) only records the console layout and arguments. A **translated** draw then binds XCL's ABI root signature in `bind_abi`. A draw with an **untranslated** pipeline – PC shaders, a background build's stand-in, a fallback after the driver rejected the console shaders – went to the PC list as it was, with the comment "a PC pipeline: its own root signature and arguments". Nothing had ever bound that root signature on the PC list. ### Change `bind::State` keeps the title's graphics root signature (a PC object: `dev_create_root_signature` always returns one, an empty fallback at worst). It is cleared on `Reset` / `ClearState`. `graphics_bound` binds it before a draw with an untranslated pipeline. Stand-ins and fallbacks are made from a copy of the title's desc, `pRootSignature` included, so they match it. Translated draws are unchanged, and so is compute: untranslated dispatches are skipped already. ### Test `e2e::test_title_draws_with_a_root_signature_under_the_debug_layer` runs the test title with `XCL_D3D12_DEBUG=1` and fails on any "No root signature has been set" in its log. Before: `13 draws without a root signature`. After: none. It skips without `d3d12SDKLayers.dll` (Graphics Tools) or the system XGameRuntime, so it skips on the CI runner. `cargo test --workspace --no-fail-fast` on `main` 484dd57 (RTX 5070 Ti): 561 passed, 0 failed, 39 ignored. ### Not in this PR (seen in the same debug-layer run) - WARP still faults later: the unified memory cannot be made there (`CreateReservedResource` → `E_OUTOFMEMORY`), so `IASetIndexBuffer` gets a console address that is no GPU address (`0x20010000 does not belong to any existing Resource or Heap`). No title draws anything right without unified memory, so I left it. - One `CopyBufferRegion` on a resource in the wrong state (id 538), on the RTX 5070 Ti too. _AI-assisted._ 🤖 Generated with [Claude Code](https://claude.com/claude-code)
upstream-sync closed this pull request 2026-11-24 06:57:22 +00:00
copilot-pull-request-reviewer[bot commented 2026-11-24 06:57:23 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by copilot-pull-request-reviewer[bot] on 2026-11-23T15:13:01Z.

Review: COMMENTED


Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

<!-- greyfinch-sync:ivall/xcl:review:6024106620 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/144#pullrequestreview-6024106620). Originally posted by [copilot-pull-request-reviewer[bot]](https://github.com/copilot-pull-request-reviewer%5Bbot%5D) on 2026-11-23T15:13:01Z. **Review:** COMMENTED --- Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
ivall commented 2026-11-24 07:04:17 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by ivall on 2026-11-23T20:52:43Z.


Merged (main 2abc562). Checked on an RX 9070 (RDNA4) with the 11 PRs merged together on main 38b05b7: cargo build --workspace && cargo test --workspace -- --test-threads=4 - 547 unit tests passed, 0 failed (19 ignored); the integration and e2e tests passed too.

<!-- greyfinch-sync:ivall/xcl:comment:7113684155 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/144#issuecomment-7113684155). Originally posted by [ivall](https://github.com/ivall) on 2026-11-23T20:52:43Z. --- Merged (main 2abc562). Checked on an RX 9070 (RDNA4) with the 11 PRs merged together on main 38b05b7: `cargo build --workspace && cargo test --workspace -- --test-threads=4` - 547 unit tests passed, 0 failed (19 ignored); the integration and e2e tests passed too.
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
xcl-dev/xcl!142
No description provided.