runtime: leave unreferenced root parameters of slot 86 heap windows unset (Part of #3545) #3603

Merged
mumba17 merged 3 commits from upstream-pr/3603 into main 2026-11-30 17:14:04 +00:00
mumba17 commented 2026-11-30 12:53:54 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by mumba17 on 2026-11-30T12:53:54Z.


Part of #3545. Rebased on main after #3599 and #3606. The second commit adds startup_indirect_mesh_cache_heap_wide_warp to the pr preset filter. The third addresses the review: per-stage visibility and a constants-only marker flag.

Problem

Every slot 86 request in a local title shader cache uses one root layout:

  • three descriptor tables, a root SRV and two 32-bit constants;
  • 0x400 on half of them and 0xc00 on the other half.

With a published heap-buffer window (#3593, #3599), these roots still stopped at root bindings outside supported profile, or at root heap indexing (0xc00) has no verified binding. The cached path only accepted roots made of constants.

Change

Publisher (mesh86_cache.py):

  • Decodes the request's RTS0 root (root_constant_registers).
  • Accepts a heap-buffer pair only if each stage's DXIL Resource Bindings table holds nothing but cbuffers at the root's 32-bit-constants registers visible to that stage, ALL or its own visibility (prove_constants_only). D3D12 lets disjoint visibilities share a register, so mesh-only constants at b0 do not cover a pixel stage's cb0.
  • Appends constants-only to the profile 3 marker to record that this proof ran.
  • Together with the existing window proof, which already refuses sampler-heap reads, this shows that the stages reference nothing in the root except its constants and the resource-heap window.

Runtime (mesh86_cache.inl, d3d12_xs_device.cpp):

  • For a root with a heap window, descriptor tables and root CBV/SRV/UAV parameters are accepted and left unset.
  • 0x800 is accepted next to 0x400. A sampler-heap flag without the resource-heap flag is still refused.
  • Such a wide root (sampler indexing, or any parameter other than constants) requires a constants-only marker: one published before the proof is refused until republished. A root of constants only still accepts the older marker.
  • The cached-mesh constants check and the root-argument loop now act only on 32-bit-constants parameters. Before, the loop called SetGraphicsRoot32BitConstants on every parameter except the root SRV, which would have been wrong for a table.

Tests

  • startup_indirect_mesh_cache_heap_wide_{warp,hardware} repeat the five heap window cases from #3593/#3599 (views, swapped, empty, raw, uint) with the title root shape:
    • the constants at parameter 0;
    • an SRV table (t0-t3, space 1) that is never set;
    • a root SRV (t4, space 3) that is never set;
    • 0xc00.
  • A pixel stage that also reads t0, space1 from the table is refused at publication.
  • A marker without constants-only is refused at creation for the wide root and still draws for the narrow one.
  • Both run the binding proof on the fixture's real DXC pixel dump (it reads cb0): constants at b0 with ALL or pixel visibility pass, mesh-only constants are refused.
  • runtime_mesh86_cache_cli_check adds cases for:
    • a pair with no cbuffer;
    • an unused table in the root;
    • a cbuffer at another register (refused);
    • a texture from the table (refused);
    • mesh-only constants at b0 next to a pixel-only CBV table at b0 (refused), and the reverse with pixel-visible constants (accepted).
  • Mutation check: accepting constants of any visibility fails both runtime_mesh86_cache_cli_check and startup_indirect_mesh_cache_heap_warp. After the review fixes, all 25 slot 86 tests (mesh86|indirect_mesh_cache|indirect_mesh_lease) pass on the RTX 3090 and WARP.

Windows 11 build 26300, MSVC 19.44, Release, debug layer enabled. On an RTX 3090 (driver 32.0.16.1664) and WARP 10.0.26100.9818, both new tests passed with zero D3D12 warnings or errors, so leaving those parameters unset is clean on both. A serial run of startup_(indirect|list|mesh|native_mesh|translated|compute_dispatch|resource_retire)|mesh86 passed 229 of 229, with three native-compute WARP capability skips.

ctest --preset release --no-tests=error -j1 -R '^(startup_indirect_mesh_cache_heap|runtime_mesh86_cache_cli_check$)' -V

Title run

Setup: this branch, tools/startup/run_preset.py --console x --gpu nvidia with a saved profile, on an RTX 3090. The run was stopped by hand at 545.7 s, after 7,131 presented frames.

  • The title created 4 slot 86 pipelines, 2 with 0x400 and 2 with 0xc00. All 4 now reach slot86 mesh request <key> pending, meaning they wait for a published pair. Before this change they stopped at the root-profile and sampler-heap refusals described above.
  • None of the 4 keys was used by an ExecuteIndirect in this run window, so no title draw was attempted through them.
  • There is still no translator that publishes desktop pairs for title .m86 requests. A title draw through this path needs a hand-published pair, and that pair has to pass the window and constants-only proofs.

🤖 Generated with Claude Code

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:5565669052 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3603). Originally posted by [mumba17](https://github.com/mumba17) on 2026-11-30T12:53:54Z. --- Part of #3545. Rebased on `main` after #3599 and #3606. The second commit adds `startup_indirect_mesh_cache_heap_wide_warp` to the `pr` preset filter. The third addresses the review: per-stage visibility and a `constants-only` marker flag. ## Problem Every slot 86 request in a local title shader cache uses one root layout: - three descriptor tables, a root SRV and two 32-bit constants; - `0x400` on half of them and `0xc00` on the other half. With a published heap-buffer window (#3593, #3599), these roots still stopped at `root bindings outside supported profile`, or at `root heap indexing (0xc00) has no verified binding`. The cached path only accepted roots made of constants. ## Change **Publisher** (`mesh86_cache.py`): - Decodes the request's RTS0 root (`root_constant_registers`). - Accepts a heap-buffer pair only if each stage's DXIL `Resource Bindings` table holds nothing but cbuffers at the root's 32-bit-constants registers visible to that stage, `ALL` or its own visibility (`prove_constants_only`). D3D12 lets disjoint visibilities share a register, so mesh-only constants at `b0` do not cover a pixel stage's `cb0`. - Appends `constants-only` to the profile 3 marker to record that this proof ran. - Together with the existing window proof, which already refuses sampler-heap reads, this shows that the stages reference nothing in the root except its constants and the resource-heap window. **Runtime** (`mesh86_cache.inl`, `d3d12_xs_device.cpp`): - For a root with a heap window, descriptor tables and root CBV/SRV/UAV parameters are accepted and left unset. - `0x800` is accepted next to `0x400`. A sampler-heap flag without the resource-heap flag is still refused. - Such a wide root (sampler indexing, or any parameter other than constants) requires a `constants-only` marker: one published before the proof is refused until republished. A root of constants only still accepts the older marker. - The cached-mesh constants check and the root-argument loop now act only on 32-bit-constants parameters. Before, the loop called `SetGraphicsRoot32BitConstants` on every parameter except the root SRV, which would have been wrong for a table. ## Tests - `startup_indirect_mesh_cache_heap_wide_{warp,hardware}` repeat the five heap window cases from #3593/#3599 (views, swapped, empty, raw, uint) with the title root shape: - the constants at parameter 0; - an SRV table (`t0`-`t3`, space 1) that is never set; - a root SRV (`t4`, space 3) that is never set; - `0xc00`. - A pixel stage that also reads `t0, space1` from the table is refused at publication. - A marker without `constants-only` is refused at creation for the wide root and still draws for the narrow one. - Both run the binding proof on the fixture's real DXC pixel dump (it reads `cb0`): constants at `b0` with `ALL` or pixel visibility pass, mesh-only constants are refused. - `runtime_mesh86_cache_cli_check` adds cases for: - a pair with no cbuffer; - an unused table in the root; - a cbuffer at another register (refused); - a texture from the table (refused); - mesh-only constants at `b0` next to a pixel-only CBV table at `b0` (refused), and the reverse with pixel-visible constants (accepted). - Mutation check: accepting constants of any visibility fails both `runtime_mesh86_cache_cli_check` and `startup_indirect_mesh_cache_heap_warp`. After the review fixes, all 25 slot 86 tests (`mesh86|indirect_mesh_cache|indirect_mesh_lease`) pass on the RTX 3090 and WARP. Windows 11 build 26300, MSVC 19.44, Release, debug layer enabled. On an RTX 3090 (driver 32.0.16.1664) and WARP 10.0.26100.9818, both new tests passed with zero D3D12 warnings or errors, so leaving those parameters unset is clean on both. A serial run of `startup_(indirect|list|mesh|native_mesh|translated|compute_dispatch|resource_retire)|mesh86` passed 229 of 229, with three native-compute WARP capability skips. ```powershell ctest --preset release --no-tests=error -j1 -R '^(startup_indirect_mesh_cache_heap|runtime_mesh86_cache_cli_check$)' -V ``` ## Title run Setup: this branch, `tools/startup/run_preset.py --console x --gpu nvidia` with a saved profile, on an RTX 3090. The run was stopped by hand at 545.7 s, after 7,131 presented frames. - The title created 4 slot 86 pipelines, 2 with `0x400` and 2 with `0xc00`. All 4 now reach `slot86 mesh request <key> pending`, meaning they wait for a published pair. Before this change they stopped at the root-profile and sampler-heap refusals described above. - None of the 4 keys was used by an `ExecuteIndirect` in this run window, so no title draw was attempted through them. - There is still no translator that publishes desktop pairs for title `.m86` requests. A title draw through this path needs a hand-published pair, and that pair has to pass the window and constants-only proofs. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
R0Y00 commented 2026-11-30 15:49:33 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-30T15:49:33Z.


#3599 and #3606 are now on main. The current #3603 head still conflicts with main after the #3599 squash. Please refresh the branch as planned and retain runtime_mesh86_cache_cli_check and startup_indirect_mesh_cache_heap_warp in the pr preset when adding the wide-window case. That will let us review only the new root-binding change and rerun all three slot 86 checks together.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7283654197 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3603#issuecomment-7283654197). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-30T15:49:33Z. --- #3599 and #3606 are now on `main`. The current #3603 head still conflicts with `main` after the #3599 squash. Please refresh the branch as planned and retain `runtime_mesh86_cache_cli_check` and `startup_indirect_mesh_cache_heap_warp` in the `pr` preset when adding the wide-window case. That will let us review only the new root-binding change and rerun all three slot 86 checks together.
mumba17 commented 2026-11-30 15:56:45 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by mumba17 on 2026-11-30T15:56:45Z.


Refreshed on main (f50b85c5), head is now 1e556216. The second commit widens the pr filter to startup_indirect_mesh_cache_heap(_wide)?_warp and keeps runtime_mesh86_cache_cli_check, so ctest --preset pr -N lists all three slot 86 checks. 25/25 slot 86 tests pass locally, CI is running.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7283865074 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3603#issuecomment-7283865074). Originally posted by [mumba17](https://github.com/mumba17) on 2026-11-30T15:56:45Z. --- Refreshed on `main` (`f50b85c5`), head is now `1e556216`. The second commit widens the `pr` filter to `startup_indirect_mesh_cache_heap(_wide)?_warp` and keeps `runtime_mesh86_cache_cli_check`, so `ctest --preset pr -N` lists all three slot 86 checks. 25/25 slot 86 tests pass locally, CI is running.
R0Y00 commented 2026-11-30 15:57:29 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-30T15:57:29Z.

Review: CHANGES_REQUESTED


Two gaps remain in the proof that lets ExecuteIndirect leave nonconstant root parameters unset.

  1. root_constant_registers() drops shader visibility. I compiled a valid root with mesh-only root constants at b0 and a pixel-only CBV table also at b0. For a PS that reads cb0, prove_constants_only() accepted the actual DXC dump ({(0, 0)}), although the PS binding resolves to the table that the runtime leaves unset. D3D12 allows overlapping register namespaces for disjoint shader visibility. Please check each dump against the constants visible to that stage, or restrict the proof to SHADER_VISIBILITY_ALL. Add a control for this split binding. https://learn.microsoft.com/en-us/windows/win32/direct3d12/creating-a-root-signature#shader-visibility

  2. A wide root still accepts the same profile 3 marker that #3599 could publish before it checked ordinary bindings. Its hash fields identify the blobs but do not distinguish whether the new proof ran. Please require a new proof marker version or flag before using the widened runtime path. A legacy marker for a wide root should remain refused until republished; an existing narrow profile can retain its old behavior.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6115605452 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3603#pullrequestreview-6115605452). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-30T15:57:29Z. **Review:** CHANGES_REQUESTED --- Two gaps remain in the proof that lets ExecuteIndirect leave nonconstant root parameters unset. 1. `root_constant_registers()` drops shader visibility. I compiled a valid root with mesh-only root constants at `b0` and a pixel-only CBV table also at `b0`. For a PS that reads `cb0`, `prove_constants_only()` accepted the actual DXC dump (`{(0, 0)}`), although the PS binding resolves to the table that the runtime leaves unset. D3D12 allows overlapping register namespaces for disjoint shader visibility. Please check each dump against the constants visible to that stage, or restrict the proof to `SHADER_VISIBILITY_ALL`. Add a control for this split binding. https://learn.microsoft.com/en-us/windows/win32/direct3d12/creating-a-root-signature#shader-visibility 2. A wide root still accepts the same profile 3 marker that #3599 could publish before it checked ordinary bindings. Its hash fields identify the blobs but do not distinguish whether the new proof ran. Please require a new proof marker version or flag before using the widened runtime path. A legacy marker for a wide root should remain refused until republished; an existing narrow profile can retain its old behavior.
mumba17 commented 2026-11-30 16:07:35 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by mumba17 on 2026-11-30T16:07:35Z.


Both fixed in 0a0dc40b.

  1. root_constant_registers() now keeps each parameter's visibility, and prove_constants_only() checks each stage's cbuffers against constants with ALL or that stage's visibility (MS 7, PS 5). Controls: the CLI check has mesh-only constants at b0 with a pixel-only CBV table at b0 (refused), plus the reverse with pixel-visible constants (accepted). run_heap also runs the proof on the fixture's real DXC pixel dump (cb0): ALL and pixel visibility pass, mesh-only is refused.
  2. Profile 3 markers now end in constants-only. A wide heap root (0x800, or any parameter other than constants) requires it and refuses an older marker with wide heap root requires a constants-only heap-buffer window. A root of constants only still accepts the older marker. heap_wide checks the refusal, and the narrow heap test draws with the older marker.

Mutation check: accepting constants of any visibility fails both runtime_mesh86_cache_cli_check and startup_indirect_mesh_cache_heap_warp. All 25 slot 86 tests pass on an RTX 3090 and WARP.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7284156040 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3603#issuecomment-7284156040). Originally posted by [mumba17](https://github.com/mumba17) on 2026-11-30T16:07:35Z. --- Both fixed in `0a0dc40b`. 1. `root_constant_registers()` now keeps each parameter's visibility, and `prove_constants_only()` checks each stage's cbuffers against constants with `ALL` or that stage's visibility (MS 7, PS 5). Controls: the CLI check has mesh-only constants at `b0` with a pixel-only CBV table at `b0` (refused), plus the reverse with pixel-visible constants (accepted). `run_heap` also runs the proof on the fixture's real DXC pixel dump (`cb0`): `ALL` and pixel visibility pass, mesh-only is refused. 2. Profile 3 markers now end in `constants-only`. A wide heap root (`0x800`, or any parameter other than constants) requires it and refuses an older marker with `wide heap root requires a constants-only heap-buffer window`. A root of constants only still accepts the older marker. `heap_wide` checks the refusal, and the narrow `heap` test draws with the older marker. Mutation check: accepting constants of any visibility fails both `runtime_mesh86_cache_cli_check` and `startup_indirect_mesh_cache_heap_warp`. All 25 slot 86 tests pass on an RTX 3090 and WARP.
R0Y00 commented 2026-11-30 17:13:25 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-30T17:13:25Z.

Review: APPROVED


Verified the two findings from my earlier review on this revision. The publisher now checks root-constant visibility against each actual shader stage, and wide roots require the new proof marker while narrow legacy caches still draw. Local Windows Debug: 5/5 via ctest --preset pr --no-tests=error --output-on-failure -j 1 -R '^(runtime_mesh86_cache_cli_check|startup_indirect_mesh_cache_heap_(wide_)?(warp|hardware))$'. A separate source-built DXC split-visibility fixture was refused for the pixel stage and accepted by the pixel-visible positive control.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6116878290 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3603#pullrequestreview-6116878290). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-30T17:13:25Z. **Review:** APPROVED --- Verified the two findings from my earlier review on this revision. The publisher now checks root-constant visibility against each actual shader stage, and wide roots require the new proof marker while narrow legacy caches still draw. Local Windows Debug: 5/5 via `ctest --preset pr --no-tests=error --output-on-failure -j 1 -R '^(runtime_mesh86_cache_cli_check|startup_indirect_mesh_cache_heap_(wide_)?(warp|hardware))$'`. A separate source-built DXC split-visibility fixture was refused for the pixel stage and accepted by the pixel-visible positive control.
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!3603
No description provided.