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

Merged
R0Y00 merged 3 commits from upstream-pr/1263 into main 2026-11-24 06:35:28 +00:00
R0Y00 commented 2026-11-24 06:09:02 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T06:09:02Z.


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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6575797118 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1263). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-24T06:09:02Z. --- 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.
tedin7 commented 2026-11-24 06:16:18 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T06:16:18Z.

Review: COMMENTED


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.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6034560388 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1263#pullrequestreview-6034560388). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T06:16:18Z. **Review:** COMMENTED --- 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.
upstream-sync closed this pull request 2026-11-24 06:47:25 +00:00
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!1256
No description provided.