d3d12: support Texture3D views in device slot 70 #2330

Merged
Holastor merged 1 commit from upstream-pr/2338 into main 2026-11-25 14:12:13 +00:00
Holastor commented 2026-11-25 12:47:11 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Holastor on 2026-11-25T12:47:11Z.


Accept placed Texture3D memory SRVs with D3D12_TEXTURE_LAYOUT_UNKNOWN and matching D3D12_SRV_DIMENSION_TEXTURE3D views in device slot 70 (device_memory_srv).

Changes

  1. Revert buffer fallback cache:
    • Reverted unbacked buffer fallback cache (publish_memory_buffer) to address review feedback and split concerns cleanly. Buffer memory SRVs keep the existing buffer_unavailable refusal.
  2. Texture3D view validation and sizing:
    • Enforce D3D12_SRV_DIMENSION_TEXTURE3D view dimension; refuse D3D12_SRV_DIMENSION_TEXTURE2D descriptions on 3D resources and D3D12_SRV_DIMENSION_TEXTURE3D descriptions on 2D resources.
    • Tightened address_view_fits: Texture2D and Texture2DArray view dimensions now explicitly check r.Dimension == D3D12_RESOURCE_DIMENSION_TEXTURE2D, refusing 2D views over non-2D resources.
    • Enforce block-compressed dimension constraints (r.Width % elem.texels == 0 and r.Height % elem.texels == 0).
    • Refuse depth/stencil formats (address_depth_format).
    • Pin supported layout to D3D12_TEXTURE_LAYOUT_UNKNOWN; refuse console swizzled layouts (e.g. 0x105).
    • Validate mip ranges (MostDetailedMip, MipLevels) against resource bounds; refuse out-of-bounds mips and explicit ResourceMinLODClamp > 0.0f.
    • Size volume mip chains in volume_texture_bytes, accounting for block texels ((w + texels - 1) / texels * (h + texels - 1) / texels * depth * elem.bytes).
    • In device runtime, address_texture_bytes uses SliceFootprints::size to account for desktop copyable footprint layout (256-byte row pitch alignment and 512-byte subresource placement alignment), preventing overlap checks from missing volume tails.
  3. Texture3D draw upload:
    • Include D3D12_RESOURCE_DIMENSION_TEXTURE3D in upload_texture in d3d12_draw.inl with slices = 1 (depth slices carried in Footprint.Depth and spanned by SliceFootprints::bytes()) and copy all depth slices and mips using footprint row/slice pitches.
  4. Tests and documentation:
    • startup_memory_srv_volume: device-free unit tests for Texture3D validation, fitting, and sizing across uncompressed (R8, RGBA8) and block-compressed (BC3, BC7, including 4-mip chains with sub-4x4 tail mips) formats, with 4 negative controls (layout, 2d-view, 3d-view, mips-overflow) registered with WILL_FAIL.
    • startup_gfx10_layout: added 3D resource/view test cases to layout test suite.
    • startup_memory_srv_report: updated refusal reason in slot 70 formatting check.
    • startup_address_volume_srv_warp and startup_address_volume_srv_hardware: device draws on WARP and hardware reading back multiple depth slices (z=0, z=1) and mip levels (mip 0, mip 1), asserting exact pixel readback, verifying footprint row pitch (256 bytes) exceeds packed row bytes (16 bytes), and checking exact refusal lines.
    • Documented volume SRV validation, controls, and hardware environment in docs/startup-runtime.md.

Evidence

  • ctest --preset dev -R "memory_srv_volume|address_volume_srv|gfx10_layout|memory_srv_report" -V:
    • startup_memory_srv_volume: Passed (0.01 sec)
    • startup_memory_srv_volume_layout_control: Passed (WILL_FAIL, 0.00 sec)
    • startup_memory_srv_volume_2d-view_control: Passed (WILL_FAIL, 0.00 sec)
    • startup_memory_srv_volume_3d-view_control: Passed (WILL_FAIL, 0.00 sec)
    • startup_memory_srv_volume_mips-overflow_control: Passed (WILL_FAIL, 0.00 sec)
    • startup_gfx10_layout: Passed (0.26 sec)
    • startup_gfx10_layout_display_control: Passed (WILL_FAIL, 0.26 sec)
    • startup_memory_srv_report: Passed (0.01 sec)
    • startup_address_volume_srv_warp: Passed (0.45 sec, all 32 RGBA pixels exact)
    • startup_address_volume_srv_hardware: Passed (0.50 sec, all 32 RGBA pixels exact; AMD Radeon RX 6600M, driver 32.0.21045.11001, Windows 11 Build 26100)
  • python3 tests/docs_links_check.py: Passed (18 Markdown files, 446 links)
  • python3 tests/bidi_controls_check.py: Passed (1595 tracked files)
  • git diff --check origin/main: clean
<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6604817678 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2338). Originally posted by [Holastor](https://github.com/Holastor) on 2026-11-25T12:47:11Z. --- Accept placed Texture3D memory SRVs with `D3D12_TEXTURE_LAYOUT_UNKNOWN` and matching `D3D12_SRV_DIMENSION_TEXTURE3D` views in device slot 70 (`device_memory_srv`). ### Changes 1. **Revert buffer fallback cache**: - Reverted unbacked buffer fallback cache (`publish_memory_buffer`) to address review feedback and split concerns cleanly. Buffer memory SRVs keep the existing `buffer_unavailable` refusal. 2. **Texture3D view validation and sizing**: - Enforce `D3D12_SRV_DIMENSION_TEXTURE3D` view dimension; refuse `D3D12_SRV_DIMENSION_TEXTURE2D` descriptions on 3D resources and `D3D12_SRV_DIMENSION_TEXTURE3D` descriptions on 2D resources. - Tightened `address_view_fits`: Texture2D and Texture2DArray view dimensions now explicitly check `r.Dimension == D3D12_RESOURCE_DIMENSION_TEXTURE2D`, refusing 2D views over non-2D resources. - Enforce block-compressed dimension constraints (`r.Width % elem.texels == 0` and `r.Height % elem.texels == 0`). - Refuse depth/stencil formats (`address_depth_format`). - Pin supported layout to `D3D12_TEXTURE_LAYOUT_UNKNOWN`; refuse console swizzled layouts (e.g. 0x105). - Validate mip ranges (`MostDetailedMip`, `MipLevels`) against resource bounds; refuse out-of-bounds mips and explicit `ResourceMinLODClamp > 0.0f`. - Size volume mip chains in `volume_texture_bytes`, accounting for block texels (`(w + texels - 1) / texels * (h + texels - 1) / texels * depth * elem.bytes`). - In device runtime, `address_texture_bytes` uses `SliceFootprints::size` to account for desktop copyable footprint layout (256-byte row pitch alignment and 512-byte subresource placement alignment), preventing overlap checks from missing volume tails. 3. **Texture3D draw upload**: - Include `D3D12_RESOURCE_DIMENSION_TEXTURE3D` in `upload_texture` in `d3d12_draw.inl` with `slices = 1` (depth slices carried in `Footprint.Depth` and spanned by `SliceFootprints::bytes()`) and copy all depth slices and mips using footprint row/slice pitches. 4. **Tests and documentation**: - `startup_memory_srv_volume`: device-free unit tests for Texture3D validation, fitting, and sizing across uncompressed (R8, RGBA8) and block-compressed (BC3, BC7, including 4-mip chains with sub-4x4 tail mips) formats, with 4 negative controls (`layout`, `2d-view`, `3d-view`, `mips-overflow`) registered with `WILL_FAIL`. - `startup_gfx10_layout`: added 3D resource/view test cases to layout test suite. - `startup_memory_srv_report`: updated refusal reason in slot 70 formatting check. - `startup_address_volume_srv_warp` and `startup_address_volume_srv_hardware`: device draws on WARP and hardware reading back multiple depth slices (z=0, z=1) and mip levels (mip 0, mip 1), asserting exact pixel readback, verifying footprint row pitch (256 bytes) exceeds packed row bytes (16 bytes), and checking exact refusal lines. - Documented volume SRV validation, controls, and hardware environment in `docs/startup-runtime.md`. ### Evidence - `ctest --preset dev -R "memory_srv_volume|address_volume_srv|gfx10_layout|memory_srv_report" -V`: - `startup_memory_srv_volume`: Passed (0.01 sec) - `startup_memory_srv_volume_layout_control`: Passed (WILL_FAIL, 0.00 sec) - `startup_memory_srv_volume_2d-view_control`: Passed (WILL_FAIL, 0.00 sec) - `startup_memory_srv_volume_3d-view_control`: Passed (WILL_FAIL, 0.00 sec) - `startup_memory_srv_volume_mips-overflow_control`: Passed (WILL_FAIL, 0.00 sec) - `startup_gfx10_layout`: Passed (0.26 sec) - `startup_gfx10_layout_display_control`: Passed (WILL_FAIL, 0.26 sec) - `startup_memory_srv_report`: Passed (0.01 sec) - `startup_address_volume_srv_warp`: Passed (0.45 sec, all 32 RGBA pixels exact) - `startup_address_volume_srv_hardware`: Passed (0.50 sec, all 32 RGBA pixels exact; AMD Radeon RX 6600M, driver 32.0.21045.11001, Windows 11 Build 26100) - `python3 tests/docs_links_check.py`: Passed (18 Markdown files, 446 links) - `python3 tests/bidi_controls_check.py`: Passed (1595 tracked files) - `git diff --check origin/main`: clean
tedin7 commented 2026-11-25 13:00:55 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T12:52:12Z.

Review: COMMENTED


Review of head f7d2b14f2fd8615f0b110e7c09e69fa9ae8c7d54 (comment only, no verdict).

Commands run locally (Linux):

  • git diff --stat origin/main...HEAD: 4 files, +105/-10
  • python3 tests/docs_links_check.py: self-test passed, 18 Markdown files, 446 links
  • python3 tests/bidi_controls_check.py: no bidirectional controls in 1593 files
  • git diff --check origin/main...HEAD: clean
  • gh pr checks: Linux Python checks, gfx1013 fixtures and Windows build/test are green. The /O2 job was skipped. The PR is MERGEABLE, the title is neutral, and no clean-room issue is visible in the diff.

The changed C++ needs the D3D12 headers, so it cannot be built here. I did not run Win2025. A real mutation of the new logic was not possible on Linux (see P1).

P1: the new test does not guard the new behavior.
tests/startup_memory_srv_report_check.cpp (new 3D case): the case calls line(..., "unsupported_description", ...) with a hard-coded reason. It only checks the formatting of mostmip/mips/clamp in memory_srv_report.h. It never reaches supports_placed_memory_srv, address_view_fits, desktop_address_view_supported, address_texture_bytes or publish_memory_buffer. If those were reverted, this test would still pass. The case also asserts the refusal reason this PR says it removes, which is confusing. The sibling suites startup_memory_srv_buffer_check.cpp and startup_memory_srv_census_check.cpp are the natural place for a test that covers the 3D accept path and the buffer fallback. A WARP readback of a 3D SRV and of a fallback-backed buffer would also help.

P2: address_texture_bytes ignores mips for 3D (d3d12_memory_srv.inl, new TEXTURE3D branch).
It returns Width*Height*Depth*elem for mip 0 only, but supports_placed_memory_srv accepts MipLevels > 1 and mip ranges (MostDetailedMip, MipLevels == ~0u). Then publish_tiled_texture reads and uploads only mip 0 bytes, so a view of mip 1 or higher samples data that was never uploaded. Either restrict 3D to MipLevels == 1 or size the whole mip chain. The code also treats console memory as linear. If the console data is tiled (as with the 2D path, which uses gfx10::Layout), the 3D image would be scrambled. Please state the layout assumption, or refuse 3D with a console layout.

P2: publish_memory_buffer caches by raw address and never invalidates (address_buffers).
The wrapper is created with wrap(nullptr, ...) and kept forever. If the title frees and reuses that address, the next call reuses the old wrapper. This is only safe if view_slot rereads the memory each time. The cache can grow but is never shrunk, and the memory is not checked again if it is unmapped later. Please say why this is safe, or hook it into the existing release path. Also, resolve_buffer_srv_desc(input->address, resource->Width, ...) bounds the view by resource->Width, while the publish step sizes the backing by max(Width, span_bytes). The two limits should match.

nit: in supports_placed_memory_srv, the 3D branch repeats the 2D mip-range checks, which address_view_fits already has (address_texture.h). address_view_fits now accepts a TEXTURE2D view on a 3D resource without checking r.Dimension first for the other branches. A shared helper would avoid drift.

Overall: the idea is sound, but the tests do not cover the logic and the mip handling in P2 looks wrong. Please add a test that fails without the change, and Win2025 evidence for the new paths.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6057950369 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2338#pullrequestreview-6057950369). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T12:52:12Z. **Review:** COMMENTED --- Review of head `f7d2b14f2fd8615f0b110e7c09e69fa9ae8c7d54` (comment only, no verdict). Commands run locally (Linux): - `git diff --stat origin/main...HEAD`: 4 files, +105/-10 - `python3 tests/docs_links_check.py`: self-test passed, 18 Markdown files, 446 links - `python3 tests/bidi_controls_check.py`: no bidirectional controls in 1593 files - `git diff --check origin/main...HEAD`: clean - `gh pr checks`: Linux Python checks, gfx1013 fixtures and Windows build/test are green. The /O2 job was skipped. The PR is MERGEABLE, the title is neutral, and no clean-room issue is visible in the diff. The changed C++ needs the D3D12 headers, so it cannot be built here. I did not run Win2025. A real mutation of the new logic was not possible on Linux (see P1). **P1: the new test does not guard the new behavior.** `tests/startup_memory_srv_report_check.cpp` (new 3D case): the case calls `line(..., "unsupported_description", ...)` with a hard-coded reason. It only checks the formatting of `mostmip/mips/clamp` in `memory_srv_report.h`. It never reaches `supports_placed_memory_srv`, `address_view_fits`, `desktop_address_view_supported`, `address_texture_bytes` or `publish_memory_buffer`. If those were reverted, this test would still pass. The case also asserts the refusal reason this PR says it removes, which is confusing. The sibling suites `startup_memory_srv_buffer_check.cpp` and `startup_memory_srv_census_check.cpp` are the natural place for a test that covers the 3D accept path and the buffer fallback. A WARP readback of a 3D SRV and of a fallback-backed buffer would also help. **P2: `address_texture_bytes` ignores mips for 3D** (`d3d12_memory_srv.inl`, new `TEXTURE3D` branch). It returns `Width*Height*Depth*elem` for mip 0 only, but `supports_placed_memory_srv` accepts `MipLevels > 1` and mip ranges (`MostDetailedMip`, `MipLevels == ~0u`). Then `publish_tiled_texture` reads and uploads only mip 0 bytes, so a view of mip 1 or higher samples data that was never uploaded. Either restrict 3D to `MipLevels == 1` or size the whole mip chain. The code also treats console memory as linear. If the console data is tiled (as with the 2D path, which uses `gfx10::Layout`), the 3D image would be scrambled. Please state the layout assumption, or refuse 3D with a console layout. **P2: `publish_memory_buffer` caches by raw address and never invalidates** (`address_buffers`). The wrapper is created with `wrap(nullptr, ...)` and kept forever. If the title frees and reuses that address, the next call reuses the old wrapper. This is only safe if `view_slot` rereads the memory each time. The cache can grow but is never shrunk, and the memory is not checked again if it is unmapped later. Please say why this is safe, or hook it into the existing release path. Also, `resolve_buffer_srv_desc(input->address, resource->Width, ...)` bounds the view by `resource->Width`, while the publish step sizes the backing by `max(Width, span_bytes)`. The two limits should match. **nit:** in `supports_placed_memory_srv`, the 3D branch repeats the 2D mip-range checks, which `address_view_fits` already has (`address_texture.h`). `address_view_fits` now accepts a `TEXTURE2D` view on a 3D resource without checking `r.Dimension` first for the other branches. A shared helper would avoid drift. Overall: the idea is sound, but the tests do not cover the logic and the mip handling in P2 looks wrong. Please add a test that fails without the change, and Win2025 evidence for the new paths. AI-assisted; commands listed were executed locally.
R0Y00 commented 2026-11-25 13:00:55 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-25T12:55:22Z.

Review: CHANGES_REQUESTED


Please split the Texture3D view change from the unbacked-buffer fallback. The new fallback cache is keyed only by CPU address and never retires its wrappers. Two devices can reuse one entry, and a freed address can be reused for a different allocation while the old wrapper still names it. A readable range at SRV creation establishes neither ownership nor a lifetime through draw submission. Keep the existing buffer refusal until the backing is tied to a device and a live allocation, with a remap or address-reuse negative.

For Texture3D, the new byte-count fallback only multiplies the dimensions of mip 0, but the view predicate accepts later mips. It also accepts a Texture2D description and silently turns it into a volume view. Please pin the supported layout and view kind, and add a real slot-70 volume readback with different depth slices and mip values, including a short backing or wrong-dimension refusal. The diagnostic formatting test by itself cannot verify those paths.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6057994010 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2338#pullrequestreview-6057994010). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-25T12:55:22Z. **Review:** CHANGES_REQUESTED --- Please split the Texture3D view change from the unbacked-buffer fallback. The new fallback cache is keyed only by CPU address and never retires its wrappers. Two devices can reuse one entry, and a freed address can be reused for a different allocation while the old wrapper still names it. A readable range at SRV creation establishes neither ownership nor a lifetime through draw submission. Keep the existing buffer refusal until the backing is tied to a device and a live allocation, with a remap or address-reuse negative. For Texture3D, the new byte-count fallback only multiplies the dimensions of mip 0, but the view predicate accepts later mips. It also accepts a Texture2D description and silently turns it into a volume view. Please pin the supported layout and view kind, and add a real slot-70 volume readback with different depth slices and mip values, including a short backing or wrong-dimension refusal. The diagnostic formatting test by itself cannot verify those paths.
upstream-sync changed title from [PR #2338] d3d12: support Texture3D views and fallback buffer backing in device slot 70 to [PR #2338] d3d12: support Texture3D views in device slot 70 2026-11-25 14:04:50 +00:00
tedin7 commented 2026-11-25 14:04:50 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T13:21:08Z.

Review: COMMENTED


Review of head a2058480710a04b01adc2c19f801ad0adfb7e052 (earlier review by @tedin7 was on f7d2b14f, so this is a new head).

State: MERGEABLE, not draft. CI on this head: Linux Python checks, gfx1013 fixtures, Windows build+test all pass (gh pr checks 2338). Title and body are neutral.

Commands executed locally (Linux, worktree of the PR head):

  • git diff --stat origin/main...HEAD: 12 files, +493/-10.
  • python3 tests/docs_links_check.py: self-test passed, 18 files, 446 links OK.
  • python3 tests/bidi_controls_check.py: 1595 files, no bidi controls.
  • git diff --check origin/main...HEAD: clean.
  • Not run: the C++ tests and the requested logic mutation. They include <d3d12.h> and cannot build on Linux (g++ ... startup_memory_srv_volume_check.cpp fails with d3d12.h: No such file). Only the Windows CI result above covers them. I did not run Win2025 WARP.

Findings

P2 src/startup_stubs/address_texture.h:112-126 (volume_texture_bytes) and :97-107 (supports_volume_memory_srv):

  • volume_texture_bytes computes w*h*d*elem per mip and ignores gfx10::element_of(...).texels.
  • element_of returns {8,4} or {16,4} for BC1-BC7, so bytes is per 4x4 block, not per texel.
  • supports_volume_memory_srv does not exclude block-compressed formats, so a BC Texture3D is accepted.
  • For such a volume the required size is overestimated by about 16x, and the mip extents are not rounded up to blocks.
  • Effect: valid BC volumes get refused as "short backing", or the size check is wrong.
  • Fix: either refuse texels != 1 in supports_volume_memory_srv, or size with ceil(w/texels)*ceil(h/texels)*d.
  • Add a BC3/BC7 case to tests/startup_memory_srv_volume_check.cpp. It has no BC format today (only R8 and RGBA8).

P2 src/startup_stubs/d3d12_draw.inl (upload_texture, slices change):

  • For Texture3D, slices is forced to 1 and, per the PR description, the subresource index maps to the mip level.
  • That is right for 3D subresources. The upload loop still needs to copy the full depth of each mip. Row pitch and slice pitch come from SliceFootprints.
  • The device tests (startup_address_volume_srv_*) cover this only through WARP. Please confirm they read back more than one depth slice at more than one mip. The docs say they do.
  • I could not verify this on Linux.

nit src/startup_stubs/address_texture.h:84-92: the new r.Dimension == TEXTURE2D guard on the 2D/2DArray cases is a good tightening. A negative control for "2D view on a 3D resource" exists (2d-view). A matching "3D view on a 2D resource" case would pin the opposite direction.

nit docs/startup-runtime.md: the volume paragraph says startup_address_volume_srv_* runs "on a device (WARP and hardware)". Please state whether the hardware run was actually done for this head.

Verdict: no P1 found. Two P2 items (BC sizing, 3D upload coverage). Please fix or justify before moving to Ready.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6058372942 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2338#pullrequestreview-6058372942). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T13:21:08Z. **Review:** COMMENTED --- Review of head `a2058480710a04b01adc2c19f801ad0adfb7e052` (earlier review by @tedin7 was on `f7d2b14f`, so this is a new head). **State:** MERGEABLE, not draft. CI on this head: Linux Python checks, gfx1013 fixtures, Windows build+test all pass (`gh pr checks 2338`). Title and body are neutral. **Commands executed locally (Linux, worktree of the PR head):** - `git diff --stat origin/main...HEAD`: 12 files, +493/-10. - `python3 tests/docs_links_check.py`: self-test passed, 18 files, 446 links OK. - `python3 tests/bidi_controls_check.py`: 1595 files, no bidi controls. - `git diff --check origin/main...HEAD`: clean. - Not run: the C++ tests and the requested logic mutation. They include `<d3d12.h>` and cannot build on Linux (`g++ ... startup_memory_srv_volume_check.cpp` fails with `d3d12.h: No such file`). Only the Windows CI result above covers them. I did not run Win2025 WARP. **Findings** P2 `src/startup_stubs/address_texture.h:112-126` (`volume_texture_bytes`) and `:97-107` (`supports_volume_memory_srv`): - `volume_texture_bytes` computes `w*h*d*elem` per mip and ignores `gfx10::element_of(...).texels`. - `element_of` returns `{8,4}` or `{16,4}` for BC1-BC7, so `bytes` is per 4x4 block, not per texel. - `supports_volume_memory_srv` does not exclude block-compressed formats, so a BC Texture3D is accepted. - For such a volume the required size is overestimated by about 16x, and the mip extents are not rounded up to blocks. - Effect: valid BC volumes get refused as "short backing", or the size check is wrong. - Fix: either refuse `texels != 1` in `supports_volume_memory_srv`, or size with `ceil(w/texels)*ceil(h/texels)*d`. - Add a BC3/BC7 case to `tests/startup_memory_srv_volume_check.cpp`. It has no BC format today (only R8 and RGBA8). P2 `src/startup_stubs/d3d12_draw.inl` (`upload_texture`, `slices` change): - For Texture3D, `slices` is forced to 1 and, per the PR description, the subresource index maps to the mip level. - That is right for 3D subresources. The upload loop still needs to copy the full depth of each mip. Row pitch and slice pitch come from `SliceFootprints`. - The device tests (`startup_address_volume_srv_*`) cover this only through WARP. Please confirm they read back more than one depth slice at more than one mip. The docs say they do. - I could not verify this on Linux. nit `src/startup_stubs/address_texture.h:84-92`: the new `r.Dimension == TEXTURE2D` guard on the 2D/2DArray cases is a good tightening. A negative control for "2D view on a 3D resource" exists (`2d-view`). A matching "3D view on a 2D resource" case would pin the opposite direction. nit `docs/startup-runtime.md`: the volume paragraph says `startup_address_volume_srv_*` runs "on a device (WARP and hardware)". Please state whether the hardware run was actually done for this head. **Verdict:** no P1 found. Two P2 items (BC sizing, 3D upload coverage). Please fix or justify before moving to Ready. AI-assisted; commands listed were executed locally.
tedin7 commented 2026-11-25 14:04:51 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T13:36:17Z.

Review: COMMENTED


Review of head e5939b1a8a84d59aebe3a223c79b883654b8a8ca (comment only, no approval).

Verdict: no P1. One P2, one nit. Logic looks correct; tests kill real mutations.

What I checked

  • Diff scope: 12 files, +526/-10. Title neutral, mergeable, CI green (Linux Python checks, gfx1013 fixtures, Windows build+test pass).
  • upload_texture (d3d12_draw.inl): slices = 1 for Texture3D is right. Depth is carried by Footprint.Depth, and SliceFootprints::bytes(i) already spans depth * rows (slice_footprints.h:46-55), so all depth slices and mips are copied.
  • address_view_fits: the new r.Dimension guards on the 2D and 2D-array views are correct and close the cross-dimension hole. The Texture3D branch pins ResourceMinLODClamp == 0 and the mip bounds.
  • supports_volume_memory_srv: layout UNKNOWN, no depth/stencil, matching format, BC base dimensions multiple of the block. Mip levels below 4 texels are not rejected, which matches D3D12 rules.
  • Routing: volumes are not published through publish_tiled_texture. They go through existing_memory_texture, so there is no over-read of guest memory from the footprint layout.

Findings

  • P2 src/startup_stubs/d3d12_memory_srv.inl:~296 (address_texture_bytes -> volume_texture_bytes): the size is tightly packed (no 256-byte row pitch). The resource that is actually uploaded is read in the desktop footprint layout, which is larger. The only caller on this path is address_resource_overlap(...) (line ~481), so the GPU-written overlap check can miss the tail of a volume. Suggest using SliceFootprints::size, or document why tight packing is intended, and add a case with a row pitch larger than the row bytes.
  • nit The _control runs (layout, 2d-view, 3d-view, mips-overflow) flip the test's expected value (== mutated("...")) and do not change production code. They prove the harness can fail, but not that the logic is guarded. The positive test itself does guard the logic (see the mutations below).

Commands run locally

  • git diff --stat origin/main...HEAD ok.
  • python3 tests/docs_links_check.py -> Checked 18 Markdown files and 446 links.
  • python3 tests/bidi_controls_check.py -> no bidirectional controls.
  • git diff --check origin/main...HEAD -> clean.
  • Built tests/startup_memory_srv_volume_check.cpp with x86_64-w64-mingw32-g++ -std=c++17 -static -Isrc and ran under wine: all checks passed. The 4 --mutate controls each exit 1 as expected.
  • Mutation 1: deleted the r.Layout != D3D12_TEXTURE_LAYOUT_UNKNOWN check -> FAIL console layout 0x105 refused, FAIL console linear layout 0x100 refused (killed).
  • Mutation 2: disabled the BC block-dimension check -> FAIL BC7 width not multiple of 4 refused, FAIL BC7 height ... (killed).
  • Mutations reverted with git checkout -- ..
  • Not run: Win2025 WARP and the startup_address_volume_srv_* GPU tests. CI Windows passed, and the PR reports a hardware readback. The Stage-2 gate should still run them before Ready.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6058595082 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2338#pullrequestreview-6058595082). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T13:36:17Z. **Review:** COMMENTED --- Review of head `e5939b1a8a84d59aebe3a223c79b883654b8a8ca` (comment only, no approval). **Verdict: no P1. One P2, one nit. Logic looks correct; tests kill real mutations.** ### What I checked - Diff scope: 12 files, +526/-10. Title neutral, mergeable, CI green (Linux Python checks, gfx1013 fixtures, Windows build+test pass). - `upload_texture` (`d3d12_draw.inl`): `slices = 1` for Texture3D is right. Depth is carried by `Footprint.Depth`, and `SliceFootprints::bytes(i)` already spans `depth * rows` (`slice_footprints.h:46-55`), so all depth slices and mips are copied. - `address_view_fits`: the new `r.Dimension` guards on the 2D and 2D-array views are correct and close the cross-dimension hole. The Texture3D branch pins `ResourceMinLODClamp == 0` and the mip bounds. - `supports_volume_memory_srv`: layout `UNKNOWN`, no depth/stencil, matching format, BC base dimensions multiple of the block. Mip levels below 4 texels are not rejected, which matches D3D12 rules. - Routing: volumes are not published through `publish_tiled_texture`. They go through `existing_memory_texture`, so there is no over-read of guest memory from the footprint layout. ### Findings - **P2** `src/startup_stubs/d3d12_memory_srv.inl:~296` (`address_texture_bytes` -> `volume_texture_bytes`): the size is tightly packed (no 256-byte row pitch). The resource that is actually uploaded is read in the desktop footprint layout, which is larger. The only caller on this path is `address_resource_overlap(...)` (line ~481), so the GPU-written overlap check can miss the tail of a volume. Suggest using `SliceFootprints::size`, or document why tight packing is intended, and add a case with a row pitch larger than the row bytes. - **nit** The `_control` runs (`layout`, `2d-view`, `3d-view`, `mips-overflow`) flip the test's expected value (`== mutated("...")`) and do not change production code. They prove the harness can fail, but not that the logic is guarded. The positive test itself does guard the logic (see the mutations below). ### Commands run locally - `git diff --stat origin/main...HEAD` ok. - `python3 tests/docs_links_check.py` -> `Checked 18 Markdown files and 446 links.` - `python3 tests/bidi_controls_check.py` -> `no bidirectional controls.` - `git diff --check origin/main...HEAD` -> clean. - Built `tests/startup_memory_srv_volume_check.cpp` with `x86_64-w64-mingw32-g++ -std=c++17 -static -Isrc` and ran under wine: `all checks passed`. The 4 `--mutate` controls each exit 1 as expected. - Mutation 1: deleted the `r.Layout != D3D12_TEXTURE_LAYOUT_UNKNOWN` check -> `FAIL console layout 0x105 refused`, `FAIL console linear layout 0x100 refused` (killed). - Mutation 2: disabled the BC block-dimension check -> `FAIL BC7 width not multiple of 4 refused`, `FAIL BC7 height ...` (killed). - Mutations reverted with `git checkout -- .`. - Not run: Win2025 WARP and the `startup_address_volume_srv_*` GPU tests. CI Windows passed, and the PR reports a hardware readback. The Stage-2 gate should still run them before Ready. AI-assisted; commands listed were executed locally.
tedin7 commented 2026-11-25 14:04:51 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T13:36:25Z.

Review: COMMENTED


Review of head e5939b1a8a84d59aebe3a223c79b883654b8a8ca (comment only, no approval).

Verdict: no P1. One P2, one nit. Logic looks correct; tests kill real mutations.

What I checked

  • Diff scope: 12 files, +526/-10. Title neutral, mergeable, CI green (Linux Python checks, gfx1013 fixtures, Windows build+test pass).
  • upload_texture (d3d12_draw.inl): slices = 1 for Texture3D is right. Depth is carried by Footprint.Depth, and SliceFootprints::bytes(i) already spans depth * rows (slice_footprints.h:46-55), so all depth slices and mips are copied.
  • address_view_fits: the new r.Dimension guards on the 2D and 2D-array views are correct and close the cross-dimension hole. The Texture3D branch pins ResourceMinLODClamp == 0 and the mip bounds.
  • supports_volume_memory_srv: layout UNKNOWN, no depth/stencil, matching format, BC base dimensions multiple of the block. Mip levels below 4 texels are not rejected, which matches D3D12 rules.
  • Routing: volumes are not published through publish_tiled_texture. They go through existing_memory_texture, so there is no over-read of guest memory from the footprint layout.

Findings

  • P2 src/startup_stubs/d3d12_memory_srv.inl:~296 (address_texture_bytes -> volume_texture_bytes): the size is tightly packed (no 256-byte row pitch). The resource that is actually uploaded is read in the desktop footprint layout, which is larger. The only caller on this path is address_resource_overlap(...) (line ~481), so the GPU-written overlap check can miss the tail of a volume. Suggest using SliceFootprints::size, or document why tight packing is intended, and add a case with a row pitch larger than the row bytes.
  • nit The _control runs (layout, 2d-view, 3d-view, mips-overflow) flip the test's expected value (== mutated("...")) and do not change production code. They prove the harness can fail, but not that the logic is guarded. The positive test itself does guard the logic (see the mutations below).

Commands run locally

  • git diff --stat origin/main...HEAD ok.
  • python3 tests/docs_links_check.py -> Checked 18 Markdown files and 446 links.
  • python3 tests/bidi_controls_check.py -> no bidirectional controls.
  • git diff --check origin/main...HEAD -> clean.
  • Built tests/startup_memory_srv_volume_check.cpp with x86_64-w64-mingw32-g++ -std=c++17 -static -Isrc and ran under wine: all checks passed. The 4 --mutate controls each exit 1 as expected.
  • Mutation 1: deleted the r.Layout != D3D12_TEXTURE_LAYOUT_UNKNOWN check -> FAIL console layout 0x105 refused, FAIL console linear layout 0x100 refused (killed).
  • Mutation 2: disabled the BC block-dimension check -> FAIL BC7 width not multiple of 4 refused, FAIL BC7 height ... (killed).
  • Mutations reverted with git checkout -- ..
  • Not run: Win2025 WARP and the startup_address_volume_srv_* GPU tests. CI Windows passed, and the PR reports a hardware readback. The Stage-2 gate should still run them before Ready.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6058597053 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2338#pullrequestreview-6058597053). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T13:36:25Z. **Review:** COMMENTED --- Review of head `e5939b1a8a84d59aebe3a223c79b883654b8a8ca` (comment only, no approval). **Verdict: no P1. One P2, one nit. Logic looks correct; tests kill real mutations.** ### What I checked - Diff scope: 12 files, +526/-10. Title neutral, mergeable, CI green (Linux Python checks, gfx1013 fixtures, Windows build+test pass). - `upload_texture` (`d3d12_draw.inl`): `slices = 1` for Texture3D is right. Depth is carried by `Footprint.Depth`, and `SliceFootprints::bytes(i)` already spans `depth * rows` (`slice_footprints.h:46-55`), so all depth slices and mips are copied. - `address_view_fits`: the new `r.Dimension` guards on the 2D and 2D-array views are correct and close the cross-dimension hole. The Texture3D branch pins `ResourceMinLODClamp == 0` and the mip bounds. - `supports_volume_memory_srv`: layout `UNKNOWN`, no depth/stencil, matching format, BC base dimensions multiple of the block. Mip levels below 4 texels are not rejected, which matches D3D12 rules. - Routing: volumes are not published through `publish_tiled_texture`. They go through `existing_memory_texture`, so there is no over-read of guest memory from the footprint layout. ### Findings - **P2** `src/startup_stubs/d3d12_memory_srv.inl:~296` (`address_texture_bytes` -> `volume_texture_bytes`): the size is tightly packed (no 256-byte row pitch). The resource that is actually uploaded is read in the desktop footprint layout, which is larger. The only caller on this path is `address_resource_overlap(...)` (line ~481), so the GPU-written overlap check can miss the tail of a volume. Suggest using `SliceFootprints::size`, or document why tight packing is intended, and add a case with a row pitch larger than the row bytes. - **nit** The `_control` runs (`layout`, `2d-view`, `3d-view`, `mips-overflow`) flip the test's expected value (`== mutated("...")`) and do not change production code. They prove the harness can fail, but not that the logic is guarded. The positive test itself does guard the logic (see the mutations below). ### Commands run locally - `git diff --stat origin/main...HEAD` ok. - `python3 tests/docs_links_check.py` -> `Checked 18 Markdown files and 446 links.` - `python3 tests/bidi_controls_check.py` -> `no bidirectional controls.` - `git diff --check origin/main...HEAD` -> clean. - Built `tests/startup_memory_srv_volume_check.cpp` with `x86_64-w64-mingw32-g++ -std=c++17 -static -Isrc` and ran under wine: `all checks passed`. The 4 `--mutate` controls each exit 1 as expected. - Mutation 1: deleted the `r.Layout != D3D12_TEXTURE_LAYOUT_UNKNOWN` check -> `FAIL console layout 0x105 refused`, `FAIL console linear layout 0x100 refused` (killed). - Mutation 2: disabled the BC block-dimension check -> `FAIL BC7 width not multiple of 4 refused`, `FAIL BC7 height ...` (killed). - Mutations reverted with `git checkout -- .`. - Not run: Win2025 WARP and the `startup_address_volume_srv_*` GPU tests. CI Windows passed, and the PR reports a hardware readback. The Stage-2 gate should still run them before Ready. AI-assisted; commands listed were executed locally.
tedin7 commented 2026-11-25 14:04:51 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T13:47:08Z.

Review: COMMENTED


Review of head 480e2f9b4eab2ea8f19c86337ed475309ac90f7a (Texture3D memory SRVs in device slot 70).

Commands executed locally (Linux, worktree at the head SHA):

  • git diff --check origin/main...HEAD -> clean
  • python3 tests/docs_links_check.py -> self-test passed, 18 Markdown files / 446 links OK
  • python3 tests/bidi_controls_check.py -> 1595 files, no bidirectional controls
  • Cross-built tests/startup_memory_srv_volume_check.cpp with mingw-w64 and ran it under wine: all checks passed
  • The four negative controls (--mutate layout|2d-view|3d-view|mips-overflow) each exit non-zero, as intended
  • Real mutation of the new logic: in address_view_fits the 3D branch's ResourceMinLODClamp == 0.0f replaced by true. The test fails with FAIL explicit LOD clamp refused, so it kills the mutation. Reverted with git checkout -- .

Findings:

  • P1: none
  • P2: none
  • nit (d3d12_draw.inl upload_texture): slices is forced to 1 for TEXTURE3D, so depth is handled only through the footprint plan. This is correct as long as SliceFootprints covers all depth slices. A one-line comment saying so would help the next reader.
  • nit (address_texture.h): the Texture2D/Texture2DArray branches now also require r.Dimension == TEXTURE2D. This is a correct tightening, and the 2d-view control covers it. Mention it in the PR body as a behavior change for 2D views over non-2D resources.

Notes:

  • Title is neutral, MERGEABLE, no clean-room concern seen in the diff.
  • CI checks were still pending when I reviewed (Windows build/test, Linux Python checks, gfx1013 fixtures). I did not run Win2025. The change adds no shader or HLSL lowering, and the new device test startup_address_volume_srv_{warp,hardware} runs in the Windows CI job. The result of that job should gate the merge.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6058768314 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2338#pullrequestreview-6058768314). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T13:47:08Z. **Review:** COMMENTED --- Review of head `480e2f9b4eab2ea8f19c86337ed475309ac90f7a` (Texture3D memory SRVs in device slot 70). Commands executed locally (Linux, worktree at the head SHA): - `git diff --check origin/main...HEAD` -> clean - `python3 tests/docs_links_check.py` -> self-test passed, 18 Markdown files / 446 links OK - `python3 tests/bidi_controls_check.py` -> 1595 files, no bidirectional controls - Cross-built `tests/startup_memory_srv_volume_check.cpp` with mingw-w64 and ran it under wine: `all checks passed` - The four negative controls (`--mutate layout|2d-view|3d-view|mips-overflow`) each exit non-zero, as intended - Real mutation of the new logic: in `address_view_fits` the 3D branch's `ResourceMinLODClamp == 0.0f` replaced by `true`. The test fails with `FAIL explicit LOD clamp refused`, so it kills the mutation. Reverted with `git checkout -- .` Findings: - P1: none - P2: none - nit (`d3d12_draw.inl` upload_texture): `slices` is forced to 1 for TEXTURE3D, so depth is handled only through the footprint plan. This is correct as long as `SliceFootprints` covers all depth slices. A one-line comment saying so would help the next reader. - nit (`address_texture.h`): the Texture2D/Texture2DArray branches now also require `r.Dimension == TEXTURE2D`. This is a correct tightening, and the 2d-view control covers it. Mention it in the PR body as a behavior change for 2D views over non-2D resources. Notes: - Title is neutral, MERGEABLE, no clean-room concern seen in the diff. - CI checks were still pending when I reviewed (Windows build/test, Linux Python checks, gfx1013 fixtures). I did not run Win2025. The change adds no shader or HLSL lowering, and the new device test `startup_address_volume_srv_{warp,hardware}` runs in the Windows CI job. The result of that job should gate the merge. AI-assisted; commands listed were executed locally.
Holastor commented 2026-11-25 14:05:08 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Holastor on 2026-11-25T13:17:54Z.


Thank you @tedin7 and @R0Y00 for the thorough review and constructive feedback!

I have addressed all the points and updated the PR accordingly:

  1. Split PR / Revert buffer fallback:

    • Completely reverted publish_memory_buffer and all unbacked buffer fallback cache logic. Buffer memory SRVs retain their existing buffer_unavailable refusal behavior until proper device lifecycle/invalidation is established in a separate PR.
    • PR title and scope are now strictly focused on Texture3D views.
  2. Pin Texture3D layout, view dimension, and mips:

    • View dimension: Strictly enforce v.ViewDimension == D3D12_SRV_DIMENSION_TEXTURE3D. A Texture2D description on a 3D resource is now refused without any silent conversion.
    • Resource dimension: Checked across all branches (supports_volume_memory_srv, address_view_fits).
    • Layout: Strictly pinned to r.Layout == D3D12_TEXTURE_LAYOUT_UNKNOWN (0); console swizzled layouts (e.g. 0x105) and linear console layouts are refused.
    • Mip bounds: v.Texture3D.MostDetailedMip < r.MipLevels, v.Texture3D.MipLevels <= r.MipLevels - v.Texture3D.MostDetailedMip (or ~0u), and v.Texture3D.ResourceMinLODClamp == 0.0f.
    • Byte sizing: In volume_texture_bytes, the entire mip chain is sized using element octets from gfx10::element_of.
    • Draw footprint: d3d12_draw.inl now includes desc.Dimension == D3D12_RESOURCE_DIMENSION_TEXTURE3D as uploadable, sizing slices as 1 and routing subresource indices to mip levels for SliceFootprints.
  3. Dedicated tests guarding the logic:

    • startup_memory_srv_volume: device-free unit check verifying supports_volume_memory_srv, address_view_fits, and volume_texture_bytes across valid 3D shapes/views, layout pinning, mip bounds, clamp, and sizing. Includes three negative controls (layout, 2d-view, mips-overflow) registered with WILL_FAIL.
    • Added 3D view test cases in tests/startup_gfx10_layout_check.cpp.
    • Updated tests/startup_memory_srv_report_check.cpp to use destination_outside_view_heaps for the 3D reporting test case to avoid asserting the removed refusal reason.
    • startup_address_volume_srv_warp and startup_address_volume_srv_hardware: WARP and hardware device draw fixture and Python test script sampling across different depth slices (z=0, z=1) and mip values (mips 0 and 1), and asserting exact refusal log lines for wrong view dimension (2D view on 3D), short backing / unplaced address, mip out of bounds, non-zero LOD clamp, and console layout.

Evidence

  • ctest --preset dev -R "memory_srv_volume|address_volume_srv|gfx10_layout|memory_srv_report" -V:
    • startup_memory_srv_volume: Passed (0.01 sec)
    • startup_memory_srv_volume_layout_control: Passed (WILL_FAIL, 0.00 sec)
    • startup_memory_srv_volume_2d-view_control: Passed (WILL_FAIL, 0.00 sec)
    • startup_memory_srv_volume_mips-overflow_control: Passed (WILL_FAIL, 0.00 sec)
    • startup_gfx10_layout: Passed (0.26 sec)
    • startup_gfx10_layout_display_control: Passed (WILL_FAIL, 0.26 sec)
    • startup_memory_srv_report: Passed (0.01 sec)
    • startup_address_volume_srv_warp: Passed (0.35 sec, all 32 RGBA pixels exact)
    • startup_address_volume_srv_hardware: Passed (0.47 sec, all 32 RGBA pixels exact; AMD Radeon RX 6600M, driver 32.0.21045.11001, Windows 11 Build 26100)
  • python3 tests/docs_links_check.py: Passed (18 Markdown files, 446 links)
  • python3 tests/bidi_controls_check.py: Passed (1593 tracked files)
  • git diff --check origin/main: clean
<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7163573992 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2338#issuecomment-7163573992). Originally posted by [Holastor](https://github.com/Holastor) on 2026-11-25T13:17:54Z. --- Thank you @tedin7 and @R0Y00 for the thorough review and constructive feedback! I have addressed all the points and updated the PR accordingly: 1. **Split PR / Revert buffer fallback**: - Completely reverted `publish_memory_buffer` and all unbacked buffer fallback cache logic. Buffer memory SRVs retain their existing `buffer_unavailable` refusal behavior until proper device lifecycle/invalidation is established in a separate PR. - PR title and scope are now strictly focused on Texture3D views. 2. **Pin Texture3D layout, view dimension, and mips**: - **View dimension**: Strictly enforce `v.ViewDimension == D3D12_SRV_DIMENSION_TEXTURE3D`. A `Texture2D` description on a 3D resource is now refused without any silent conversion. - **Resource dimension**: Checked across all branches (`supports_volume_memory_srv`, `address_view_fits`). - **Layout**: Strictly pinned to `r.Layout == D3D12_TEXTURE_LAYOUT_UNKNOWN` (0); console swizzled layouts (e.g. 0x105) and linear console layouts are refused. - **Mip bounds**: `v.Texture3D.MostDetailedMip < r.MipLevels`, `v.Texture3D.MipLevels <= r.MipLevels - v.Texture3D.MostDetailedMip` (or `~0u`), and `v.Texture3D.ResourceMinLODClamp == 0.0f`. - **Byte sizing**: In `volume_texture_bytes`, the entire mip chain is sized using element octets from `gfx10::element_of`. - **Draw footprint**: `d3d12_draw.inl` now includes `desc.Dimension == D3D12_RESOURCE_DIMENSION_TEXTURE3D` as uploadable, sizing slices as 1 and routing subresource indices to mip levels for `SliceFootprints`. 3. **Dedicated tests guarding the logic**: - `startup_memory_srv_volume`: device-free unit check verifying `supports_volume_memory_srv`, `address_view_fits`, and `volume_texture_bytes` across valid 3D shapes/views, layout pinning, mip bounds, clamp, and sizing. Includes three negative controls (`layout`, `2d-view`, `mips-overflow`) registered with `WILL_FAIL`. - Added 3D view test cases in `tests/startup_gfx10_layout_check.cpp`. - Updated `tests/startup_memory_srv_report_check.cpp` to use `destination_outside_view_heaps` for the 3D reporting test case to avoid asserting the removed refusal reason. - `startup_address_volume_srv_warp` and `startup_address_volume_srv_hardware`: WARP and hardware device draw fixture and Python test script sampling across different depth slices (z=0, z=1) and mip values (mips 0 and 1), and asserting exact refusal log lines for wrong view dimension (2D view on 3D), short backing / unplaced address, mip out of bounds, non-zero LOD clamp, and console layout. ### Evidence - `ctest --preset dev -R "memory_srv_volume|address_volume_srv|gfx10_layout|memory_srv_report" -V`: - `startup_memory_srv_volume`: Passed (0.01 sec) - `startup_memory_srv_volume_layout_control`: Passed (WILL_FAIL, 0.00 sec) - `startup_memory_srv_volume_2d-view_control`: Passed (WILL_FAIL, 0.00 sec) - `startup_memory_srv_volume_mips-overflow_control`: Passed (WILL_FAIL, 0.00 sec) - `startup_gfx10_layout`: Passed (0.26 sec) - `startup_gfx10_layout_display_control`: Passed (WILL_FAIL, 0.26 sec) - `startup_memory_srv_report`: Passed (0.01 sec) - `startup_address_volume_srv_warp`: Passed (0.35 sec, all 32 RGBA pixels exact) - `startup_address_volume_srv_hardware`: Passed (0.47 sec, all 32 RGBA pixels exact; AMD Radeon RX 6600M, driver 32.0.21045.11001, Windows 11 Build 26100) - `python3 tests/docs_links_check.py`: Passed (18 Markdown files, 446 links) - `python3 tests/bidi_controls_check.py`: Passed (1593 tracked files) - `git diff --check origin/main`: clean
Holastor commented 2026-11-25 14:05:10 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Holastor on 2026-11-25T13:30:43Z.


Addressed feedback from review on head a2058480:

  1. BC format volume sizing & support:

    • Updated volume_texture_bytes to compute block counts (w + elem.texels - 1) / elem.texels and (h + elem.texels - 1) / elem.texels before multiplying by depth * elem.bytes, accurately sizing BC1-BC7 block formats (e.g., 1024 bytes for 16x16x4 BC7; 144 bytes for 8x8x2 2-mip BC3).
    • Added block dimension validation to supports_volume_memory_srv: enforces r.Width % elem.texels == 0 and r.Height % elem.texels == 0 when elem.texels > 1.
    • Also explicitly refuse depth/stencil formats via address_depth_format(r.Format).
    • Added test cases in tests/startup_memory_srv_volume_check.cpp for BC7, multi-mip BC3, non-multiple-of-4 block refusals, and depth format refusal.
  2. 3D upload coverage:

    • Confirmed draw_volume_address_srvs and startup_address_volume_srv_check.py sample multiple depth slices (slice = (x == 1 || x == 5) ? 1 : 0, checking z=0 and z=1) and multiple mip levels (col 0/1 mip 0, col 2 mip 1, col 3 preserved after refusals, col 4-7 rebind) across a 2-mip 4x4x2 volume.
  3. Negative control for 3D view on 2D resource:

    • Added --mutate 3d-view to tests/startup_memory_srv_volume_check.cpp and registered startup_memory_srv_volume_3d-view_control with WILL_FAIL TRUE in CMakeLists.txt.
  4. Hardware environment details:

    • Documented the hardware run environment in docs/startup-runtime.md: AMD Radeon RX 6600M (driver 32.0.21045.11001) on Windows 11 Build 26100.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7163882442 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2338#issuecomment-7163882442). Originally posted by [Holastor](https://github.com/Holastor) on 2026-11-25T13:30:43Z. --- Addressed feedback from review on head `a2058480`: 1. **BC format volume sizing & support**: - Updated `volume_texture_bytes` to compute block counts `(w + elem.texels - 1) / elem.texels` and `(h + elem.texels - 1) / elem.texels` before multiplying by `depth * elem.bytes`, accurately sizing BC1-BC7 block formats (e.g., 1024 bytes for 16x16x4 BC7; 144 bytes for 8x8x2 2-mip BC3). - Added block dimension validation to `supports_volume_memory_srv`: enforces `r.Width % elem.texels == 0` and `r.Height % elem.texels == 0` when `elem.texels > 1`. - Also explicitly refuse depth/stencil formats via `address_depth_format(r.Format)`. - Added test cases in `tests/startup_memory_srv_volume_check.cpp` for BC7, multi-mip BC3, non-multiple-of-4 block refusals, and depth format refusal. 2. **3D upload coverage**: - Confirmed `draw_volume_address_srvs` and `startup_address_volume_srv_check.py` sample multiple depth slices (`slice = (x == 1 || x == 5) ? 1 : 0`, checking z=0 and z=1) and multiple mip levels (col 0/1 mip 0, col 2 mip 1, col 3 preserved after refusals, col 4-7 rebind) across a 2-mip 4x4x2 volume. 3. **Negative control for 3D view on 2D resource**: - Added `--mutate 3d-view` to `tests/startup_memory_srv_volume_check.cpp` and registered `startup_memory_srv_volume_3d-view_control` with `WILL_FAIL TRUE` in `CMakeLists.txt`. 4. **Hardware environment details**: - Documented the hardware run environment in `docs/startup-runtime.md`: AMD Radeon RX 6600M (driver 32.0.21045.11001) on Windows 11 Build 26100.
Holastor commented 2026-11-25 14:05:11 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Holastor on 2026-11-25T13:45:30Z.


Addressed feedback from review on head e5939b1a:

  1. P2 (address_texture_bytes footprint size & row pitch):
    • Updated address_texture_bytes(Wrapper* device, const D3D12_RESOURCE_DESC& desc) in src/startup_stubs/d3d12_memory_srv.inl to compute SliceFootprints plan(device_of(device), sanitized(desc), desc.MipLevels ? desc.MipLevels : 1) for 3D textures when a device is provided, returning plan.size (incorporating 256-byte row pitch alignment and 512-byte subresource placement alignment). Falls back to volume_texture_bytes(desc) when no device is available or footprints are empty.
    • Updated call sites in publish_tiled_texture and address_resource_overlap to pass the device wrapper (self / device).
    • Documented the distinction in src/startup_stubs/address_texture.h and docs/startup-runtime.md: volume_texture_bytes provides device-free packed payload sizing, while address_texture_bytes evaluates SliceFootprints::size in device runtime.
    • Added an explicit check in tests/startup_address_srv.cpp (draw_volume_address_srvs) asserting footprints[0].Footprint.RowPitch > row_bytes[0] (256 bytes pitch vs 16 bytes packed row bytes), returning code 52 if violated. Both WARP and hardware runs passed with all 32 RGBA pixels exact.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7164245529 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2338#issuecomment-7164245529). Originally posted by [Holastor](https://github.com/Holastor) on 2026-11-25T13:45:30Z. --- Addressed feedback from review on head `e5939b1a`: 1. **P2 (`address_texture_bytes` footprint size & row pitch)**: - Updated `address_texture_bytes(Wrapper* device, const D3D12_RESOURCE_DESC& desc)` in `src/startup_stubs/d3d12_memory_srv.inl` to compute `SliceFootprints plan(device_of(device), sanitized(desc), desc.MipLevels ? desc.MipLevels : 1)` for 3D textures when a device is provided, returning `plan.size` (incorporating 256-byte row pitch alignment and 512-byte subresource placement alignment). Falls back to `volume_texture_bytes(desc)` when no device is available or footprints are empty. - Updated call sites in `publish_tiled_texture` and `address_resource_overlap` to pass the device wrapper (`self` / `device`). - Documented the distinction in `src/startup_stubs/address_texture.h` and `docs/startup-runtime.md`: `volume_texture_bytes` provides device-free packed payload sizing, while `address_texture_bytes` evaluates `SliceFootprints::size` in device runtime. - Added an explicit check in `tests/startup_address_srv.cpp` (`draw_volume_address_srvs`) asserting `footprints[0].Footprint.RowPitch > row_bytes[0]` (256 bytes pitch vs 16 bytes packed row bytes), returning code 52 if violated. Both WARP and hardware runs passed with all 32 RGBA pixels exact.
Holastor commented 2026-11-25 14:05:15 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Holastor on 2026-11-25T13:53:49Z.


Addressed both review nits:

  1. upload_texture comment (src/startup_stubs/d3d12_draw.inl):

    • Added a comment documenting that for D3D12_RESOURCE_DIMENSION_TEXTURE3D, slices is set to 1 because depth slices are carried within Footprint.Depth and spanned by SliceFootprints::bytes().
  2. PR description update:

    • Explicitly documented in the PR body the behavior change in address_view_fits: Texture2D and Texture2DArray view validations now enforce r.Dimension == D3D12_RESOURCE_DIMENSION_TEXTURE2D, formally refusing 2D/2DArray views over non-2D resources.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7164448318 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2338#issuecomment-7164448318). Originally posted by [Holastor](https://github.com/Holastor) on 2026-11-25T13:53:49Z. --- Addressed both review nits: 1. **`upload_texture` comment (`src/startup_stubs/d3d12_draw.inl`)**: - Added a comment documenting that for `D3D12_RESOURCE_DIMENSION_TEXTURE3D`, `slices` is set to 1 because depth slices are carried within `Footprint.Depth` and spanned by `SliceFootprints::bytes()`. 2. **PR description update**: - Explicitly documented in the PR body the behavior change in `address_view_fits`: Texture2D and Texture2DArray view validations now enforce `r.Dimension == D3D12_RESOURCE_DIMENSION_TEXTURE2D`, formally refusing 2D/2DArray views over non-2D resources.
upstream-sync closed this pull request 2026-11-25 15:01:35 +00:00
R0Y00 commented 2026-11-25 15:01:36 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-25T14:11:32Z.

Review: APPROVED


Rechecked 4757c203. This revision leaves the unbacked-buffer fallback out and uses the device footprints for volume backing, including row pitch and placement alignment. My source-built Windows Release run passed 9/9. Both WARP and RTX 4060 Laptop matched the two depths and two mips. The short backing, incompatible view, mip overflow, explicit LOD clamp and unsupported layout were refused, and the existing 2D tests still passed. This clears my earlier blocking review.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6059181890 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2338#pullrequestreview-6059181890). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-25T14:11:32Z. **Review:** APPROVED --- Rechecked `4757c203`. This revision leaves the unbacked-buffer fallback out and uses the device footprints for volume backing, including row pitch and placement alignment. My source-built Windows Release run passed 9/9. Both WARP and RTX 4060 Laptop matched the two depths and two mips. The short backing, incompatible view, mip overflow, explicit LOD clamp and unsupported layout were refused, and the existing 2D tests still passed. This clears my earlier blocking review.
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!2330
No description provided.