slot 70: structured buffer views at an address that is not a whole number of elements into the 64 KiB page are refused (buffer_unavailable) #2839

Closed
opened 2026-11-27 01:26:03 +00:00 by github-bot · 1 comment
Owner

@⁠tedin7 on GitHub · 2026-11-26 12:50 UTC · original

Part of #870

Problem

Device slot 70 publishes a buffer memory SRV by address. When no placed resource covers the address, unplaced_memory_buffer in src/startup_stubs/d3d12_memory_srv.inl backs the view with the surrounding 64 KiB page (existing-heap wrap or an upload copy), and the wrapper's base is the page start.

resolve_buffer_srv_desc (src/startup_stubs/memory_srv_buffer.h) then needs (address - base) % element_bytes == 0 to express the address as a FirstElement. For a structured view (StructureByteStride 12, 180, 320, 2048, ...) at a sub-allocated address that is usually false, so the call ends in buffer_unavailable and the destination descriptor keeps its old content.

Expected

A structured or typed buffer view at any readable address inside memory the title owns publishes, and a shader reads element 0 from that address.

Proposed fix

When the page-start base cannot name the address (unplaced_view_needs_exact_start), back the view with an upload copy that starts at the view address (span = the view span), kept in separate cache entries, no existing-heap wrap. The page-coverage and nearby-owner checks still run on the page.

Verification

  • startup_memory_srv_buffer_check (new shapes; --mutate exact-start must fail), registered in the CMake mutant list.
  • startup_address_buffer_srv draw test: an unplaced structured view (stride 12, page offset 0x104) is read through slot 70; without the fix the column keeps the previous descriptor's value.
  • Win2025 WARP dev+release of the startup_memory_srv* / slot70 / address_buffer_srv tests.
**@⁠tedin7** on GitHub · 2026-11-26 12:50 UTC · [original](https://github.com/R0Y00/Xbox2Windows/issues/2839) Part of #870 ## Problem Device slot 70 publishes a buffer memory SRV by address. When no placed resource covers the address, `unplaced_memory_buffer` in `src/startup_stubs/d3d12_memory_srv.inl` backs the view with the surrounding 64 KiB page (existing-heap wrap or an upload copy), and the wrapper's base is the page start. `resolve_buffer_srv_desc` (`src/startup_stubs/memory_srv_buffer.h`) then needs `(address - base) % element_bytes == 0` to express the address as a FirstElement. For a structured view (StructureByteStride 12, 180, 320, 2048, ...) at a sub-allocated address that is usually false, so the call ends in `buffer_unavailable` and the destination descriptor keeps its old content. ## Expected A structured or typed buffer view at any readable address inside memory the title owns publishes, and a shader reads element 0 from that address. ## Proposed fix When the page-start base cannot name the address (`unplaced_view_needs_exact_start`), back the view with an upload copy that starts at the view address (span = the view span), kept in separate cache entries, no existing-heap wrap. The page-coverage and nearby-owner checks still run on the page. ## Verification - `startup_memory_srv_buffer_check` (new shapes; `--mutate exact-start` must fail), registered in the CMake mutant list. - `startup_address_buffer_srv` draw test: an unplaced structured view (stride 12, page offset 0x104) is read through slot 70; without the fix the column keeps the previous descriptor's value. - Win2025 WARP dev+release of the startup_memory_srv* / slot70 / address_buffer_srv tests.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 01:26:03 +00:00
Author
Owner

@⁠tedin7 on GitHub · 2026-11-26 12:50 UTC · original

Taking this one; a Draft PR will follow.

**@⁠tedin7** on GitHub · 2026-11-26 12:50 UTC · [original](https://github.com/R0Y00/Xbox2Windows/issues/2839#issuecomment-7192532192) Taking this one; a Draft PR will follow.
This discussion has been locked. Commenting is limited to contributors.
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.

Dependencies

No dependencies set

Reference
github/R0Y00--Xbox2Windows#2839
No description provided.