startup: bind default sampler heap for sampler-heap-indexed roots #1678

Closed
tedin7 wants to merge 2 commits from upstream-pr/1685 into main
tedin7 commented 2026-11-24 17:02:30 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T17:02:30Z.


Sets a default sampler heap on the desktop list before a title root signature that indexes the sampler heap is set (debug layer message ID 1419).

What and why

  • The desktop command list never receives the title's heaps (list slot 32 only records the sampler source). A title root signature created with D3D12_ROOT_SIGNATURE_FLAG_SAMPLER_HEAP_DIRECTLY_INDEXED was set by slot 34 with no sampler heap bound.
  • CreateRootSignature now records the root signature flags. When slot 34 sets a flagged root signature on a list with no sampler heap bound, one shared one-entry shader-visible sampler heap per device is bound first (keeping the view heap a translated draw already bound). A sampler heap already bound is never replaced, and Reset() / Close() clear the per-list Pass state so subsequent frames re-bind cleanly. One rate-limited log line (at most 4).
  • Docs: docs/startup-runtime.md and docs/experiments.md.

Not covered

  • The translated root signature is created with no flags, so the 43 translated-draw and 2 pipeline-creation messages from the #870 reports are not explained by this change and are not claimed fixed.

Verification

  • Linux checks (at 5dbd2711ba5af3f592ce83e4f4456a61fc0c5e06):
    • git diff --check origin/main...HEAD: pass
    • python -B tests/docs_links_check.py: pass (17 Markdown files, 364 links)
    • python -B tests/bidi_controls_check.py: pass (1281 tracked files)
  • Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at 5dbd2711ba5af3f592ce83e4f4456a61fc0c5e06:
    • Debug (--preset dev):
      • cmake --build --preset dev --target d3d12_xs_shim startup_root_sampler_heap offscreen_check startup_stream_consumer startup_stub_consumer startup_translated_sampler_bindings_check -- -j 6 (28.79s)
      • ctest --preset dev -R '^(startup_root_sampler_heap_warp|startup_sampler_heap_warp|startup_sampler_heap_wrapped_warp|startup_sampler_x_warp|startup_inline_sampler_warp|startup_stream_draw_warp|startup_stubs|startup_translated_sampler_bindings|startup_translated_sampler_bindings_shared_axis_control)$' --parallel 4 --no-tests=error --output-on-failure: 8/9 passed, 1 skipped (startup_root_sampler_heap_warp, exit 77: no debug layer capability on this Windows Server 2025 host).
    • Release /O2 (--preset release):
      • cmake --build --preset release --target d3d12_xs_shim startup_root_sampler_heap offscreen_check startup_stream_consumer startup_stub_consumer startup_translated_sampler_bindings_check -- -j 6 (53.72s)
      • ctest --preset release -R '^(startup_root_sampler_heap_warp|startup_sampler_heap_warp|startup_sampler_heap_wrapped_warp|startup_sampler_x_warp|startup_inline_sampler_warp|startup_stream_draw_warp|startup_stubs|startup_translated_sampler_bindings|startup_translated_sampler_bindings_shared_axis_control)$' --parallel 4 --no-tests=error --output-on-failure: 8/9 passed, 1 skipped (startup_root_sampler_heap_warp, exit 77: no debug layer capability on this Windows Server 2025 host).

Overlap

  • git merge-tree against #1567, #1641, #1657, #1658 and #1277: clean. #1441 and #1469 already conflict with main by themselves; with this branch their source files auto-merge and only CMakeLists.txt conflicts (adjacent test blocks).

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6587141436 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1685). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T17:02:30Z. --- Sets a default sampler heap on the desktop list before a title root signature that indexes the sampler heap is set (debug layer message ID 1419). ## What and why - The desktop command list never receives the title's heaps (list slot 32 only records the sampler source). A title root signature created with `D3D12_ROOT_SIGNATURE_FLAG_SAMPLER_HEAP_DIRECTLY_INDEXED` was set by slot 34 with no sampler heap bound. - `CreateRootSignature` now records the root signature flags. When slot 34 sets a flagged root signature on a list with no sampler heap bound, one shared one-entry shader-visible sampler heap per device is bound first (keeping the view heap a translated draw already bound). A sampler heap already bound is never replaced, and `Reset()` / `Close()` clear the per-list `Pass` state so subsequent frames re-bind cleanly. One rate-limited log line (at most 4). - Docs: `docs/startup-runtime.md` and `docs/experiments.md`. ## Not covered - The translated root signature is created with no flags, so the 43 translated-draw and 2 pipeline-creation messages from the #870 reports are not explained by this change and are not claimed fixed. ## Verification - **Linux checks** (at `5dbd2711ba5af3f592ce83e4f4456a61fc0c5e06`): - `git diff --check origin/main...HEAD`: pass - `python -B tests/docs_links_check.py`: pass (17 Markdown files, 364 links) - `python -B tests/bidi_controls_check.py`: pass (1281 tracked files) - **Windows Server 2025** (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at `5dbd2711ba5af3f592ce83e4f4456a61fc0c5e06`: - **Debug (`--preset dev`)**: - `cmake --build --preset dev --target d3d12_xs_shim startup_root_sampler_heap offscreen_check startup_stream_consumer startup_stub_consumer startup_translated_sampler_bindings_check -- -j 6` (`28.79s`) - `ctest --preset dev -R '^(startup_root_sampler_heap_warp|startup_sampler_heap_warp|startup_sampler_heap_wrapped_warp|startup_sampler_x_warp|startup_inline_sampler_warp|startup_stream_draw_warp|startup_stubs|startup_translated_sampler_bindings|startup_translated_sampler_bindings_shared_axis_control)$' --parallel 4 --no-tests=error --output-on-failure`: **8/9 passed**, 1 skipped (`startup_root_sampler_heap_warp`, exit 77: no debug layer capability on this Windows Server 2025 host). - **Release `/O2` (`--preset release`)**: - `cmake --build --preset release --target d3d12_xs_shim startup_root_sampler_heap offscreen_check startup_stream_consumer startup_stub_consumer startup_translated_sampler_bindings_check -- -j 6` (`53.72s`) - `ctest --preset release -R '^(startup_root_sampler_heap_warp|startup_sampler_heap_warp|startup_sampler_heap_wrapped_warp|startup_sampler_x_warp|startup_inline_sampler_warp|startup_stream_draw_warp|startup_stubs|startup_translated_sampler_bindings|startup_translated_sampler_bindings_shared_axis_control)$' --parallel 4 --no-tests=error --output-on-failure`: **8/9 passed**, 1 skipped (`startup_root_sampler_heap_warp`, exit 77: no debug layer capability on this Windows Server 2025 host). ## Overlap - `git merge-tree` against #1567, #1641, #1657, #1658 and #1277: clean. #1441 and #1469 already conflict with main by themselves; with this branch their source files auto-merge and only `CMakeLists.txt` conflicts (adjacent test blocks). AI-assisted; commands listed were executed locally.
upstream-sync closed this pull request 2026-11-24 18:02:30 +00:00
MasterDomino commented 2026-11-24 18:02:56 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by MasterDomino on 2026-11-24T17:13:53Z.


@tedin7, R0Y00 asked us to keep this as one implementation (see the go-ahead on #870) and preferred a different shape from the default sampler heap:

  • Defer the bind. Don't set the native root signature at slot 34 for a directly indexed root signature. Bind it only when a real draw has the indexed heaps it needs.
  • Translated path unchanged. It keeps tracking guest parameters and uses its own root signature.
  • Specific refusal. A real draw that lacks a required heap records its own refusal, because a one-entry sampler heap can't stand in for another index or for the view heap.
  • Coverage. Both flags independently and together, the unflagged real path, the existing root-CBV controls, and the 1419 fail-first case.

I have a prototype of the deferral running on Windows: RX 9070 XT, X2W_D3D12_DEBUG=1, 75 s on the main executable, id 1419 went from 394 to 0 with unchanged draw counts. Your test's message-callback counter and plain-list control are exactly the fail-first case R0Y00 asked for.

Two options, whichever you prefer:

  1. I open the PR. It combines the deferral with your startup_root_sampler_heap test, extended to the flag matrix and the real-path refusal. You're credited as co-author, and this draft closes.
  2. You keep the PR. You switch it to the deferral, and I supply the Windows WARP and RX 9070 XT runs plus the main-executable before/after counts.

I'll start on option 1 locally, but I won't push until you've answered.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7138882888 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1685#issuecomment-7138882888). Originally posted by [MasterDomino](https://github.com/MasterDomino) on 2026-11-24T17:13:53Z. --- @tedin7, R0Y00 asked us to keep this as one implementation (see [the go-ahead on #870](https://github.com/R0Y00/Xbox2Windows/issues/870)) and preferred a different shape from the default sampler heap: - **Defer the bind.** Don't set the native root signature at slot 34 for a directly indexed root signature. Bind it only when a real draw has the indexed heaps it needs. - **Translated path unchanged.** It keeps tracking guest parameters and uses its own root signature. - **Specific refusal.** A real draw that lacks a required heap records its own refusal, because a one-entry sampler heap can't stand in for another index or for the view heap. - **Coverage.** Both flags independently and together, the unflagged real path, the existing root-CBV controls, and the 1419 fail-first case. I have a prototype of the deferral running on Windows: RX 9070 XT, `X2W_D3D12_DEBUG=1`, 75 s on the main executable, id 1419 went from 394 to 0 with unchanged draw counts. Your test's message-callback counter and plain-list control are exactly the fail-first case R0Y00 asked for. Two options, whichever you prefer: 1. **I open the PR.** It combines the deferral with your `startup_root_sampler_heap` test, extended to the flag matrix and the real-path refusal. You're credited as co-author, and this draft closes. 2. **You keep the PR.** You switch it to the deferral, and I supply the Windows WARP and RX 9070 XT runs plus the main-executable before/after counts. I'll start on option 1 locally, but I won't push until you've answered. AI-assisted.
tedin7 commented 2026-11-24 18:02:56 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T17:15:02Z.


Sounds great, @MasterDomino — closing this draft so you have a clean runway for the single implementation @R0Y00 preferred on #870. Happy to review and run Windows Debug + Release /O2 verification as soon as your PR is open!

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7138912169 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1685#issuecomment-7138912169). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T17:15:02Z. --- Sounds great, @MasterDomino — closing this draft so you have a clean runway for the single implementation @R0Y00 preferred on #870. Happy to review and run Windows Debug + Release /O2 verification as soon as your PR is open! AI-assisted.

Pull request closed

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!1678
No description provided.