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

Manually merged
github merged 1 commit from github-bot/gh-3593 into gh-pr/3593/base 2026-11-30 12:22:21 +00:00 AGit
Owner

@⁠mumba17 on GitHub · 2026-11-30 12:10 UTC · original
mumba17:runtime/mesh86-heap-buffer-srv → main · +579 −19 · 9 files · 1 commits · merged 2026-11-30 12:19 UTC

Part of #3547. 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

**@⁠mumba17** on GitHub · 2026-11-30 12:10 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3593) `mumba17:runtime/mesh86-heap-buffer-srv` → `main` · +579 −19 · 9 files · 1 commits · merged 2026-11-30 12:19 UTC Part of #3547. 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)
A slot 86 Mesh root that indexes the resource heap (0x400) was refused at
creation. It now draws when its published pair declares the resource-heap
slots [first, first + count) its desktop stages may read.

mesh86_cache.py --heap-buffer FIRST COUNT --dxc DXC publishes a profile 3
marker only if every createHandleFromHeap reads the resource heap at a
constant slot or first + min(x, c) inside the window, is annotated as a
typed buffer SRV and is read only by BufferLoad.

At slot 61 ExecuteIndirect the runtime reads the window's view tokens from
the bound title heap and rebuilds it at the same indices in a private
shader-visible heap retained with the recording: a registered typed buffer
SRV on a complete GPU-backed range is recreated, every other slot in and
below the window is a typed null view. It then sets that heap and the
title's desktop root signature.

startup_indirect_mesh_cache_heap_{warp,hardware} check two GPU-selected
views, swapped views, an empty and a raw slot, and the refusal without a
window. 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:15:15 +00:00
github-bot changed target branch from main to gh-pr/3593/base 2026-11-30 12:22:20 +00:00
github manually merged commit 71a8bff9fe into gh-pr/3593/base 2026-11-30 12:22:21 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.