test: cover a BC7 layout whose padded extent is not square #1735

Merged
ChazY11 merged 1 commit from upstream-pr/1742 into main 2026-11-24 18:28:57 +00:00
ChazY11 commented 2026-11-24 18:01:36 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by ChazY11 on 2026-11-24T18:01:36Z.


What

write_bc7_4k_s_layout in src/startup_stubs/xg_xs.cpp writes two padded extents into the layout:

put32(mip + 0x24, surface.padded_width());
put32(mip + 0x28, surface.padded_height());

tests/startup_xg_bc7_layout_check.py asserts both, but its two shapes are 81x69 and 64x64, which both pad to a square
grid
(32x32 and 16x16 blocks). With padded_width == padded_height in every case, writing the width into the height
field is invisible:

mip+0x28 written with padded_width    startup_xg_bc7_layout PASSED     (before this change)

Change

One case whose padded extent is not square, chosen from the shape already documented for this fixture:

+    check_layout(create, 200, 72, 256, 128)

200x72 blocks pad to 64x32 blocks (256x128), so the two fields differ and the assertion at mip+0x24 / mip+0x28
becomes a real check.

Tested at origin/main = 68969ed8

ctest --preset dev --no-tests=error -R '^startup_xg_bc7_' -V
BC7 81x69:  span=16384 padded_blocks=32x32 pitch=512  tiled copy exact, refusal controls passed
BC7 64x64:  span=4096  padded_blocks=16x16 pitch=256  tiled copy exact, refusal controls passed
BC7 200x72: span=32768 padded_blocks=64x32 pitch=1024 tiled copy exact, refusal controls passed   <- added

Negative control, xg_xs.dll rebuilt each time (timestamp checked):

mip+0x28 written with padded_width    startup_xg_bc7_layout FAILED with RuntimeError on the
                                      "pitch/alignment/padded and visible extent" tuple
reverted, rebuilt                     PASSED

The refusal controls inside check_copy also run for the new shape, so the added case is not just a layout read.

Scope

One test file, no behaviour change.

Notes

  • AI-assisted.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6588193840 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1742). Originally posted by [ChazY11](https://github.com/ChazY11) on 2026-11-24T18:01:36Z. --- ## What `write_bc7_4k_s_layout` in `src/startup_stubs/xg_xs.cpp` writes two padded extents into the layout: ```cpp put32(mip + 0x24, surface.padded_width()); put32(mip + 0x28, surface.padded_height()); ``` `tests/startup_xg_bc7_layout_check.py` asserts both, but its two shapes are **81x69 and 64x64, which both pad to a square grid** (32x32 and 16x16 blocks). With `padded_width == padded_height` in every case, writing the width into the height field is invisible: ```text mip+0x28 written with padded_width startup_xg_bc7_layout PASSED (before this change) ``` ## Change One case whose padded extent is not square, chosen from the shape already documented for this fixture: ```diff + check_layout(create, 200, 72, 256, 128) ``` 200x72 blocks pad to 64x32 blocks (256x128), so the two fields differ and the assertion at `mip+0x24` / `mip+0x28` becomes a real check. ## Tested at `origin/main` = `68969ed8` ```powershell ctest --preset dev --no-tests=error -R '^startup_xg_bc7_' -V ``` ```text BC7 81x69: span=16384 padded_blocks=32x32 pitch=512 tiled copy exact, refusal controls passed BC7 64x64: span=4096 padded_blocks=16x16 pitch=256 tiled copy exact, refusal controls passed BC7 200x72: span=32768 padded_blocks=64x32 pitch=1024 tiled copy exact, refusal controls passed <- added ``` Negative control, `xg_xs.dll` rebuilt each time (timestamp checked): ```text mip+0x28 written with padded_width startup_xg_bc7_layout FAILED with RuntimeError on the "pitch/alignment/padded and visible extent" tuple reverted, rebuilt PASSED ``` The refusal controls inside `check_copy` also run for the new shape, so the added case is not just a layout read. ## Scope One test file, no behaviour change. ## Notes - AI-assisted.
upstream-sync closed this pull request 2026-11-24 19:01:13 +00:00
tedin7 commented 2026-11-24 19:01:14 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T18:20:31Z.

Review: COMMENTED


Verified at commit 4baa900255f1545c4cc8d8cfa21e344f62cddb70 (tests/startup_xg_bc7_layout_check.py only; no production/tooling/workflow changes; clean-room and title-neutral).

Scope & Code Review

  • Adds a non-square padded BC7 shape check_layout(create, 200, 72, 256, 128) to tests/startup_xg_bc7_layout_check.py, covering both layout metadata (padded_width=256, padded_height=128, pitch=1024) and CopyIntoSubresource + refusal paths.
  • No defects found (0 P1, 0 P2).

Linux Checks

  • git diff --check origin/main...HEAD: pass
  • python3 tests/docs_links_check.py: pass
  • python3 tests/bidi_controls_check.py: pass
  • python3 -m py_compile tests/startup_xg_bc7_layout_check.py: pass

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

  • Debug (--preset dev):
    • cmake --build --preset dev --target startup_stream_consumer startup_stub_xg_xs -- -j 8: pass (4.17s)
    • ctest --preset dev -R '^(startup_xg_bc7_layout|startup_xg_bc_array_warp|startup_xg_bc_chain_warp|startup_xg_bc_tiling|startup_xg_tile64_tiling)$' --parallel 6 --no-tests=error --output-on-failure: 5/5 passed (7.78s; startup_xg_bc7_layout 0.18s)
  • Release /O2 (--preset release):
    • cmake --build --preset release --target startup_stream_consumer startup_stub_xg_xs -- -j 8: pass (1.32s)
    • ctest --preset release -R '^(startup_xg_bc7_layout|startup_xg_bc_array_warp|startup_xg_bc_chain_warp|startup_xg_bc_tiling|startup_xg_tile64_tiling)$' --parallel 6 --no-tests=error --output-on-failure: 5/5 passed (7.95s; startup_xg_bc7_layout 0.16s)

Mutation Check (Win2025 Debug)

  • Mutated src/startup_stubs/xg_xs.cpp:121 in write_bc7_4k_s_layout from put32(mip + 0x28, surface.padded_height()); to put32(mip + 0x28, surface.padded_width());.
  • Re-ran startup_xg_bc7_layout (ctest --preset dev -R '^startup_xg_bc7_layout$' --output-on-failure): failed as expected — the two existing square-padded shapes (81x69, 64x64) still passed, and the new 200x72 case caught the regression (got (256, 1024, 4096, 256, 256, 1, 200, 72, 1), expected (256, 1024, 4096, 256, 128, 1, 200, 72, 1)).

Note: Competing open PRs (#1746, #1748) also modify tests/startup_xg_bc7_layout_check.py.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6044940082 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1742#pullrequestreview-6044940082). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T18:20:31Z. **Review:** COMMENTED --- Verified at commit `4baa900255f1545c4cc8d8cfa21e344f62cddb70` (`tests/startup_xg_bc7_layout_check.py` only; no production/tooling/workflow changes; clean-room and title-neutral). ### Scope & Code Review - Adds a non-square padded BC7 shape `check_layout(create, 200, 72, 256, 128)` to `tests/startup_xg_bc7_layout_check.py`, covering both layout metadata (`padded_width=256`, `padded_height=128`, `pitch=1024`) and `CopyIntoSubresource` + refusal paths. - No defects found (0 P1, 0 P2). ### Linux Checks - `git diff --check origin/main...HEAD`: pass - `python3 tests/docs_links_check.py`: pass - `python3 tests/bidi_controls_check.py`: pass - `python3 -m py_compile tests/startup_xg_bc7_layout_check.py`: pass ### Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) - **Debug (`--preset dev`)**: - `cmake --build --preset dev --target startup_stream_consumer startup_stub_xg_xs -- -j 8`: pass (`4.17s`) - `ctest --preset dev -R '^(startup_xg_bc7_layout|startup_xg_bc_array_warp|startup_xg_bc_chain_warp|startup_xg_bc_tiling|startup_xg_tile64_tiling)$' --parallel 6 --no-tests=error --output-on-failure`: **5/5 passed** (`7.78s`; `startup_xg_bc7_layout` `0.18s`) - **Release `/O2` (`--preset release`)**: - `cmake --build --preset release --target startup_stream_consumer startup_stub_xg_xs -- -j 8`: pass (`1.32s`) - `ctest --preset release -R '^(startup_xg_bc7_layout|startup_xg_bc_array_warp|startup_xg_bc_chain_warp|startup_xg_bc_tiling|startup_xg_tile64_tiling)$' --parallel 6 --no-tests=error --output-on-failure`: **5/5 passed** (`7.95s`; `startup_xg_bc7_layout` `0.16s`) ### Mutation Check (Win2025 Debug) - Mutated `src/startup_stubs/xg_xs.cpp:121` in `write_bc7_4k_s_layout` from `put32(mip + 0x28, surface.padded_height());` to `put32(mip + 0x28, surface.padded_width());`. - Re-ran `startup_xg_bc7_layout` (`ctest --preset dev -R '^startup_xg_bc7_layout$' --output-on-failure`): **failed as expected** — the two existing square-padded shapes (`81x69`, `64x64`) still passed, and the new `200x72` case caught the regression (`got (256, 1024, 4096, 256, 256, 1, 200, 72, 1), expected (256, 1024, 4096, 256, 128, 1, 200, 72, 1)`). Note: Competing open PRs (#1746, #1748) also modify `tests/startup_xg_bc7_layout_check.py`. AI-assisted; commands listed were executed locally.
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!1735
No description provided.