Publish a placed R8 texture SRV by guest address in device slot 70 #1263

Manually merged
github merged 3 commits from gh-pr/1263/head into gh-pr/1263/base 2026-11-26 22:53:26 +00:00
Owner

@⁠R0Y00 on GitHub · 2026-11-24 06:09 UTC · original
R0Y00:codex/startup-memory-srv → main · +234 −1 · 7 files · 3 commits · merged 2026-11-24 06:35 UTC

Refs #1146 and #1150.

Device slot 70 takes a texture description, an SRV description followed by a guest address at offset 0x28, and a destination CPU descriptor handle. This change looks up a unique live placed texture by its exact base and description, validates the view heap slot, and uses the ordinary SRV writer so the title heap and the desktop heap see the same view. The supported profile is a single-sample, single-mip, single-layer R8_UNORM Texture2D. Zero/interior addresses and mismatched descriptions preserve the prior descriptor. Views over unregistered memory and the language-list mask remain open.

Source-built differential test

cmake --build --preset release --target startup_stream_consumer d3d12_xs_shim
ctest --preset release --no-tests=error -R '^startup_address_srv_' -V

On Windows 11 build 26200.9974 with the debug layer off, RTX 4060 Laptop (32.0.16.1656) and WARP (10.0.26100.9818) each matched all 32 expected RGBA pixels across two distinct row patterns, address switches, an ordinary slot-18 control and three rejected updates. Two passes, zero skips. On the original main revision 48b31812, the same test on each adapter gave 16 wrong pixels. Tested producer aa9d605e. The fixture contains generated inputs only.

**@⁠R0Y00** on GitHub · 2026-11-24 06:09 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1263) `R0Y00:codex/startup-memory-srv` → `main` · +234 −1 · 7 files · 3 commits · merged 2026-11-24 06:35 UTC Refs #1146 and #1150. Device slot 70 takes a texture description, an SRV description followed by a guest address at offset 0x28, and a destination CPU descriptor handle. This change looks up a unique live placed texture by its exact base and description, validates the view heap slot, and uses the ordinary SRV writer so the title heap and the desktop heap see the same view. The supported profile is a single-sample, single-mip, single-layer R8_UNORM Texture2D. Zero/interior addresses and mismatched descriptions preserve the prior descriptor. Views over unregistered memory and the language-list mask remain open. **Source-built differential test** ```powershell cmake --build --preset release --target startup_stream_consumer d3d12_xs_shim ctest --preset release --no-tests=error -R '^startup_address_srv_' -V ``` On Windows 11 build 26200.9974 with the debug layer off, RTX 4060 Laptop (32.0.16.1656) and WARP (10.0.26100.9818) each matched all 32 expected RGBA pixels across two distinct row patterns, address switches, an ordinary slot-18 control and three rejected updates. Two passes, zero skips. On the original main revision 48b31812, the same test on each adapter gave 16 wrong pixels. Tested producer aa9d605e. The fixture contains generated inputs only.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 22:53:24 +00:00
github manually merged commit 146e133b66 into gh-pr/1263/base 2026-11-26 22:53:26 +00:00
Author
Owner

@⁠tedin7 on GitHub · 2026-11-24 06:16 UTC · original · reviewed

Reviewed at commit aa9d605e8dcc8d95830bb732c78fb9ed1b67abf2.

Verification

Linux

  • git diff --check origin/main...HEAD — clean
  • tests/docs_links_check.py — passed (16 Markdown files, 282 links)
  • tests/bidi_controls_check.py — passed (1058 tracked files)

Windows Server 2025 (Build 26100, MSVC 14.44.35207, D3D12 WARP)

  • Debug (--preset dev):
    • cmake --build --preset dev --target startup_stream_consumer d3d12_xs_shim -- -j 6 — built cleanly (22.77s)
    • ctest --preset dev -R '^startup_address_srv_' --parallel 4 --no-tests=error --output-on-failure — 2/2 passed (startup_address_srv_warp 0.82s, startup_address_srv_hardware 0.83s; total 0.87s)
  • Release /O2 (--preset release):
    • cmake --build --preset release --target startup_stream_consumer d3d12_xs_shim -- -j 6 — built cleanly (38.72s)
    • ctest --preset release -R '^startup_address_srv_' --parallel 4 --no-tests=error --output-on-failure — 2/2 passed (startup_address_srv_hardware 0.95s, startup_address_srv_warp 1.00s; total 1.03s)

Code Review Notes

  • src/startup_stubs/d3d12_memory_srv.inl: Cleanly scopes slot 70 to single-sample, single-mip, single-layer DXGI_FORMAT_R8_UNORM Texture2D, validates the destination descriptor handle against heap_infos(), requires a unique live Wrapper* (refs > 0, exact title_memory base and info.console match), and delegates to view_slot<18, 2>.
  • Minor observation: device_memory_srv checks readable(input, sizeof(*input)) (48 bytes), while view_slot<18, 2> probes readable(&input->view, 64) for format remapping. Harmless for DXGI_FORMAT_R8_UNORM (maps to itself), though worth keeping in mind if MemoryShaderResourceView is ever placed at the end of a page or extended to mapped formats.
  • Good negative controls in tests/startup_address_srv.cpp (slot-18 control, alternating addresses, zero address, mismatched width, and +1 interior address), all verified pixel-exact.
**@⁠tedin7** on GitHub · 2026-11-24 06:16 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1263#pullrequestreview-6034560388) · **reviewed** Reviewed at commit `aa9d605e8dcc8d95830bb732c78fb9ed1b67abf2`. ### Verification **Linux** - `git diff --check origin/main...HEAD` — clean - `tests/docs_links_check.py` — passed (16 Markdown files, 282 links) - `tests/bidi_controls_check.py` — passed (1058 tracked files) **Windows Server 2025 (Build 26100, MSVC 14.44.35207, D3D12 WARP)** - **Debug (`--preset dev`)**: - `cmake --build --preset dev --target startup_stream_consumer d3d12_xs_shim -- -j 6` — built cleanly (`22.77s`) - `ctest --preset dev -R '^startup_address_srv_' --parallel 4 --no-tests=error --output-on-failure` — **2/2 passed** (`startup_address_srv_warp` `0.82s`, `startup_address_srv_hardware` `0.83s`; total `0.87s`) - **Release `/O2` (`--preset release`)**: - `cmake --build --preset release --target startup_stream_consumer d3d12_xs_shim -- -j 6` — built cleanly (`38.72s`) - `ctest --preset release -R '^startup_address_srv_' --parallel 4 --no-tests=error --output-on-failure` — **2/2 passed** (`startup_address_srv_hardware` `0.95s`, `startup_address_srv_warp` `1.00s`; total `1.03s`) ### Code Review Notes - `src/startup_stubs/d3d12_memory_srv.inl`: Cleanly scopes slot 70 to single-sample, single-mip, single-layer `DXGI_FORMAT_R8_UNORM` `Texture2D`, validates the destination descriptor handle against `heap_infos()`, requires a unique live `Wrapper*` (`refs > 0`, exact `title_memory` base and `info.console` match), and delegates to `view_slot<18, 2>`. - Minor observation: `device_memory_srv` checks `readable(input, sizeof(*input))` (48 bytes), while `view_slot<18, 2>` probes `readable(&input->view, 64)` for format remapping. Harmless for `DXGI_FORMAT_R8_UNORM` (maps to itself), though worth keeping in mind if `MemoryShaderResourceView` is ever placed at the end of a page or extended to mapped formats. - Good negative controls in `tests/startup_address_srv.cpp` (slot-18 control, alternating addresses, zero address, mismatched width, and `+1` interior address), all verified pixel-exact.
This discussion has been locked. Commenting is limited to contributors.
No description provided.