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) #2831

Closed
opened 2026-11-26 12:50:32 +00:00 by tedin7 · 1 comment
tedin7 commented 2026-11-26 12:50:32 +00:00 (Migrated from github.com)
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T12:50:32Z.


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.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6627019812 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2839). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-26T12:50:32Z. --- 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 commented 2026-11-26 13:03:14 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T12:50:33Z.


Taking this one; a Draft PR will follow.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7192532192 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2839#issuecomment-7192532192). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-26T12:50:33Z. --- Taking this one; a Draft PR will follow.
Sign in to join this conversation.
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#2831
No description provided.