Skip to content

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

Closed
tedin7 wants to merge 2 commits into
R0Y00:mainfrom
tedin7:x2w-frontier-id1419-sampler
Closed

tedin7 wants to merge 2 commits into
R0Y00:mainfrom
tedin7:x2w-frontier-id1419-sampler

Conversation

@tedin7

@tedin7 tedin7 commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

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 P0: main executable startup progress #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

AI-assisted; commands listed were executed locally.

@tedin7 tedin7 changed the title startup: bind a default sampler heap before a sampler-heap-indexed root signature startup: bind default sampler heap for sampler-heap-indexed roots Nov 24, 2026
@MasterDomino

Copy link
Copy Markdown
Collaborator

@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.

@tedin7

tedin7 commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator Author

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.

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.

2 participants