runtime: bind a published heap-buffer window for slot 86 mesh draws (Part of #3545) #3593

Merged
mumba17 merged 1 commit from upstream-pr/3593 into main 2026-11-30 12:19:37 +00:00
mumba17 commented 2026-11-30 12:10:27 +00:00 (Migrated from github.com)

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


Part of #3545. Target main.

Change

A slot 86 Mesh root with CBV_SRV_UAV_HEAP_DIRECTLY_INDEXED (0x400) was refused at creation with root heap indexing (0x400) has no verified binding. It can now draw when its published pair declares a heap-buffer window, the resource-heap slots [first, first + count) the desktop stages may read.

Publisher. tools/startup/mesh86_cache.py --heap-buffer FIRST COUNT --dxc <dxc> dumps both stages with DXC and publishes only if every createHandleFromHeap:

  • reads the resource heap, not the sampler heap;
  • uses a constant slot or first + min(x, c), whose whole range lies inside the window;
  • is annotated as a typed buffer SRV;
  • is read only by BufferLoad.

The window holds at most 64 slots below slot 65536. The marker records it as x2w-mesh86 3 <key> <ms> <ps> heap-buffer <first> <count>.

Runtime (mesh86_cache.inl, d3d12_xs_device.cpp):

  • At creation, a 0x400 root needs a profile 3 marker that names a window. Sampler-heap indexing (0x800) is still refused. Without the marker, the request stays pending as before.
  • At slot 61 ExecuteIndirect, the runtime reads the window from the title's bound shader-visible heap, the same 32-byte view tokens the slot 57 path reads.
    • A registered typed buffer SRV with a valid component mapping and a complete GPU-backed range is recreated at the same index in a private shader-visible heap.
    • Every other window slot, and every slot below the window, gets a typed null view: empty, stale, another view kind, raw or structured, or an incomplete range. A shader index inside the heap therefore cannot reach an unrelated view.
    • The page is retained with the recording, and an identical window on the same recording reuses it. The runtime sets that heap and the title's desktop root signature before the root constants.

Fixture

startup_indirect_mesh_cache_heap_{warp,hardware}. The pixel stage reads slot 4 and slot 4 + min(gates.y - 28, 1) = 5 and writes (slot4.x, slot5.y, slot4.z, 1). One GPU buffer holds (1,0,0,0) and (0,1,1,0), and the two views select them by FirstElement. On the left half of three targets:

Heap layout Expected
both views yellow 0xff00ffff
views swapped blue 0xffff0000
slot 5 empty red (slot 5 typed null)
slot 5 raw buffer view red (slot 5 typed null)
no window published, or a profile 1 marker refused, targets clear

Publishing a window that leaves out slot 5 is refused. startup_mesh86_cache_cli_check.py adds seven publisher cases: clamped, constant, outside the window, unbounded, sampler heap, UAV, and over the limit.

Results

Windows 11 build 26300, MSVC 19.44, Release, debug layer enabled:

  • RTX 3090, driver 32.0.16.1664: startup_indirect_mesh_cache_heap_hardware passed.
  • WARP 10.0.26100.9818: startup_indirect_mesh_cache_heap_warp passed.
  • No D3D12 errors in either run.
  • The 21 existing slot 86, cached mesh and mesh lease tests still pass. A serial run of startup_(indirect|list|mesh|native_mesh|translated|compute_dispatch|resource_retire) passed 226 of 226. Three native-compute WARP tests reported capability skips (startup_compute_dispatch_texture_native_warp, startup_compute_dispatch_native_warp, startup_compute_dispatch_sampler_heap_warp).
cmake --build --preset release
ctest --preset release --no-tests=error -j1 -R '^(startup_indirect_mesh_cache_heap_|runtime_mesh86_cache_cli_check$)' -V

Captured-scene pass (third acceptance item)

Not reached yet, and this PR does not claim it. The four slot 86 requests in a local title shader cache all use one root layout:

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

With this change, the 0x400 roots get past the heap-flag refusal. They then stop on root bindings outside supported profile, because the cached path still refuses descriptor tables and the root SRV next to heap indexing. The 0xc00 roots keep the sampler-heap refusal.

There is also still no translator that publishes desktop pairs for title .m86 requests, so a scene draw needs a hand-published pair. A follow-up can accept root parameters the published pair provably never references, which the DXIL proof can show from the resource bindings. Taken alone, that would make the 0x400 roots reachable.

🤖 Generated with Claude Code

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:5564998236 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3593). Originally posted by [mumba17](https://github.com/mumba17) on 2026-11-30T12:10:27Z. --- Part of #3545. Target `main`. ## Change A slot 86 Mesh root with `CBV_SRV_UAV_HEAP_DIRECTLY_INDEXED` (0x400) was refused at creation with `root heap indexing (0x400) has no verified binding`. It can now draw when its published pair declares a **heap-buffer window**, the resource-heap slots `[first, first + count)` the desktop stages may read. **Publisher.** `tools/startup/mesh86_cache.py --heap-buffer FIRST COUNT --dxc <dxc>` dumps both stages with DXC and publishes only if every `createHandleFromHeap`: - reads the resource heap, not the sampler heap; - uses a constant slot or `first + min(x, c)`, whose whole range lies inside the window; - is annotated as a typed buffer SRV; - is read only by `BufferLoad`. The window holds at most 64 slots below slot 65536. The marker records it as `x2w-mesh86 3 <key> <ms> <ps> heap-buffer <first> <count>`. **Runtime** (`mesh86_cache.inl`, `d3d12_xs_device.cpp`): - At creation, a 0x400 root needs a profile 3 marker that names a window. Sampler-heap indexing (0x800) is still refused. Without the marker, the request stays pending as before. - At slot 61 `ExecuteIndirect`, the runtime reads the window from the title's bound shader-visible heap, the same 32-byte view tokens the slot 57 path reads. - A registered typed buffer SRV with a valid component mapping and a complete GPU-backed range is recreated at the same index in a private shader-visible heap. - Every other window slot, and every slot below the window, gets a typed null view: empty, stale, another view kind, raw or structured, or an incomplete range. A shader index inside the heap therefore cannot reach an unrelated view. - The page is retained with the recording, and an identical window on the same recording reuses it. The runtime sets that heap and the title's desktop root signature before the root constants. ## Fixture `startup_indirect_mesh_cache_heap_{warp,hardware}`. The pixel stage reads slot 4 and slot `4 + min(gates.y - 28, 1)` = 5 and writes `(slot4.x, slot5.y, slot4.z, 1)`. One GPU buffer holds `(1,0,0,0)` and `(0,1,1,0)`, and the two views select them by `FirstElement`. On the left half of three targets: | Heap layout | Expected | |---|---| | both views | yellow `0xff00ffff` | | views swapped | blue `0xffff0000` | | slot 5 empty | red (slot 5 typed null) | | slot 5 raw buffer view | red (slot 5 typed null) | | no window published, or a profile 1 marker | refused, targets clear | Publishing a window that leaves out slot 5 is refused. `startup_mesh86_cache_cli_check.py` adds seven publisher cases: clamped, constant, outside the window, unbounded, sampler heap, UAV, and over the limit. ## Results Windows 11 build 26300, MSVC 19.44, Release, debug layer enabled: - RTX 3090, driver 32.0.16.1664: `startup_indirect_mesh_cache_heap_hardware` passed. - WARP 10.0.26100.9818: `startup_indirect_mesh_cache_heap_warp` passed. - No D3D12 errors in either run. - The 21 existing slot 86, cached mesh and mesh lease tests still pass. A serial run of `startup_(indirect|list|mesh|native_mesh|translated|compute_dispatch|resource_retire)` passed 226 of 226. Three native-compute WARP tests reported capability skips (`startup_compute_dispatch_texture_native_warp`, `startup_compute_dispatch_native_warp`, `startup_compute_dispatch_sampler_heap_warp`). ```powershell cmake --build --preset release ctest --preset release --no-tests=error -j1 -R '^(startup_indirect_mesh_cache_heap_|runtime_mesh86_cache_cli_check$)' -V ``` ## Captured-scene pass (third acceptance item) Not reached yet, and this PR does not claim it. The four slot 86 requests in a local title shader cache all use one root layout: - three descriptor tables, a root SRV and two root constants; - 0x400 on two of them and 0xc00 on the other two. With this change, the 0x400 roots get past the heap-flag refusal. They then stop on `root bindings outside supported profile`, because the cached path still refuses descriptor tables and the root SRV next to heap indexing. The 0xc00 roots keep the sampler-heap refusal. There is also still no translator that publishes desktop pairs for title `.m86` requests, so a scene draw needs a hand-published pair. A follow-up can accept root parameters the published pair provably never references, which the DXIL proof can show from the resource bindings. Taken alone, that would make the 0x400 roots reachable. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
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!3593
No description provided.