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

Manually merged
github merged 3 commits from github-bot/gh-3603 into gh-pr/3603/base 2026-11-30 17:17:44 +00:00 AGit
Owner

@⁠mumba17 on GitHub · 2026-11-30 12:53 UTC · original
mumba17:runtime/mesh86-unreferenced-root → main · +245 −36 · 9 files · 3 commits · merged 2026-11-30 17:14 UTC

Part of #3547. Rebased on main after #3601 and #3608. 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 (#3595, #3601), 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 #3595/#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

**@⁠mumba17** on GitHub · 2026-11-30 12:53 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3603) `mumba17:runtime/mesh86-unreferenced-root` → `main` · +245 −36 · 9 files · 3 commits · merged 2026-11-30 17:14 UTC Part of #3547. Rebased on `main` after #3601 and #3608. 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 (#3595, #3601), 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 #3595/#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)
A heap-buffer window bound any typed buffer format, so a shader reading
Buffer<float4> could be given a UINT view. The publisher now takes each heap
read's component type from its annotation, requires one 32-bit read type
(f32, u32 or i32) across the window and records it in the profile 3 marker
(heap-buffer <first> <count> <type>). At ExecuteIndirect a slot whose view
format reads as another type is bound as a typed null, and every null view
uses the window's type. A window marker without a type is refused.

The heap fixture adds an R32G32B32A32_UINT view over the same bytes in an f32
window (red, slot 5 null) and the untyped marker; the publisher tests add u32,
F16 and mixed-type windows. Part of #3545.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The title's slot 86 roots hold descriptor tables, a root SRV and root
constants, and half of them also allow sampler-heap indexing (0xc00). With a
published heap-buffer window they still stopped at "root bindings outside
supported profile".

The publisher now decodes the request's RTS0 root and accepts a heap-buffer
pair only if each stage's DXIL resource bindings hold nothing but cbuffers at
the root's 32-bit-constants registers. For such a window the runtime accepts
descriptor tables and root CBV/SRV/UAV parameters, accepts 0x800 next to
0x400 (the stages provably never read the sampler heap), leaves those
parameters unset, and binds and checks only the constants.

startup_indirect_mesh_cache_heap_wide_{warp,hardware} repeat the heap window
cases with that root shape, and refuse a pixel stage that reads the table.
Part of #3545.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-30 12:57:21 +00:00
Author
Owner

@⁠R0Y00 on GitHub · 2026-11-30 15:49 UTC · original

#3601 and #3608 are now on main. The current #3605 head still conflicts with main after the #3601 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.

**@⁠R0Y00** on GitHub · 2026-11-30 15:49 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3603#issuecomment-7283654197) #3601 and #3608 are now on `main`. The current #3605 head still conflicts with `main` after the #3601 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.
github-bot force-pushed github-bot/gh-3603 from 9f2bb7dd27 to 1e55621640 2026-11-30 15:56:02 +00:00 Compare
Author
Owner

@⁠mumba17 on GitHub · 2026-11-30 15:56 UTC · original

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.

**@⁠mumba17** on GitHub · 2026-11-30 15:56 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3603#issuecomment-7283865074) 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.
Author
Owner

@⁠R0Y00 on GitHub · 2026-11-30 15:57 UTC · original · requested changes

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 #3601 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.

**@⁠R0Y00** on GitHub · 2026-11-30 15:57 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3603#pullrequestreview-6115605452) · **requested changes** 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 #3601 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.
The constants-only proof now checks each stage's cbuffer reads against the
root constants visible to that stage (ALL or its own visibility). D3D12 lets
parameters of disjoint visibility share a register, so mesh-only constants at
b0 no longer cover a pixel stage's cb0.

The publisher appends constants-only to the profile 3 marker. A wide heap
root (sampler indexing, or any parameter other than constants) requires it,
so a marker published before the proof stays refused until republished. A
root of constants only still accepts the older marker.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Owner

@⁠mumba17 on GitHub · 2026-11-30 16:07 UTC · original

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.

**@⁠mumba17** on GitHub · 2026-11-30 16:07 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3603#issuecomment-7284156040) 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.
github-bot changed target branch from main to gh-pr/3603/base 2026-11-30 17:17:42 +00:00
github manually merged commit 0a0dc40b74 into gh-pr/3603/base 2026-11-30 17:17:44 +00:00
Author
Owner

@⁠R0Y00 on GitHub · 2026-11-30 17:13 UTC · original · approved these changes

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.

**@⁠R0Y00** on GitHub · 2026-11-30 17:13 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3603#pullrequestreview-6116878290) · **approved these changes** 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.
This discussion has been locked. Commenting is limited to contributors.
No description provided.