textures: refuse a block-compressed copy box that does not end on a block #2545

Merged
Asimmimx merged 3 commits from upstream-pr/2553 into main 2026-11-25 21:05:50 +00:00
Asimmimx commented 2026-11-25 20:36:46 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Asimmimx on 2026-11-25T20:36:46Z.


Summary

check() in src/startup_stubs/list_copy_texture.h now also returns bad_alignment when an explicit block-compressed box's right or bottom is not a multiple of the block. This includes a box that ends at the edge of a 2x2 or 6x6 mip. Slot 16 already refuses any verdict other than ok (list_copy_texture.inl), so such a copy is dropped and logged, and the rest of the title's command list still closes. Before this change, the copy was forwarded and the desktop Close returned E_INVALIDARG, which lost every command in the list. docs/startup-runtime.md gets one sentence.

Fixes #2552

Stacked on #2527. This branch contains #2527's commit (275d22a5, whole-block bounds). The accepted 8x8 box on a 6x6 mip relies on that rounding. Only the second commit (6cc133c3) belongs to this PR. I will rebase once #2527 lands.

Tests

Windows 11 build 26300, dev preset:

cmake --build --preset dev --target startup_list_copy_texture_check startup_list_copy_texture_warp
ctest --preset dev --no-tests=error -j 1 -R '^startup_list_copy_texture' --output-on-failure

5 of 5 passed: startup_list_copy_texture, _overflow_control (WILL_FAIL), _slice_control (WILL_FAIL), _warp (Microsoft Basic Render Driver) and _hardware (AMD Radeon RX 6600, driver 32.0.21045.29003, debug layer off). tests/docs_links_check.py and tests/bidi_controls_check.py pass.

New cases in tests/startup_list_copy_texture_check.cpp:

  • refused (bad_alignment): {0,0,2,2} on a 2x2 mip, {0,0,6,6} and {0,0,6,8} on a 6x6 mip;
  • still ok: {0,0,8,8} on a 6x6 mip, and an inner whole-block box {4,8,12,16} on a 64x64 texture.

Fail-first

With only the header change reverted, startup_list_copy_texture_check.exe exits 1:

FAIL: bc 2x2 mip, 2x2 box: got ok, want bad_alignment
FAIL: bc 6x6 mip, 6x6 box: got ok, want bad_alignment
FAIL: bc 6x6 mip, 6x8 box: got ok, want bad_alignment

With the fix it prints ok.

Device evidence

A source-built scratch program (not added here) records one copy per list with the debug layer off. On both WARP and the RX 6600:

  • each refused box makes Close return 0x80070057;
  • the whole-block boxes, the null-box copies and a control list recorded afterwards close and execute;
  • no device removal occurred.

The full table is in #2552.

Open

  • Whether a title issues such a box, and whether the console runtime accepts it.

AI-assisted (Claude Code).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6613260391 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2553). Originally posted by [Asimmimx](https://github.com/Asimmimx) on 2026-11-25T20:36:46Z. --- ## Summary `check()` in `src/startup_stubs/list_copy_texture.h` now also returns `bad_alignment` when an explicit block-compressed box's `right` or `bottom` is not a multiple of the block. This includes a box that ends at the edge of a 2x2 or 6x6 mip. Slot 16 already refuses any verdict other than `ok` (`list_copy_texture.inl`), so such a copy is dropped and logged, and the rest of the title's command list still closes. Before this change, the copy was forwarded and the desktop `Close` returned `E_INVALIDARG`, which lost every command in the list. `docs/startup-runtime.md` gets one sentence. Fixes #2552 **Stacked on #2527.** This branch contains #2527's commit (`275d22a5`, whole-block bounds). The accepted 8x8 box on a 6x6 mip relies on that rounding. Only the second commit (`6cc133c3`) belongs to this PR. I will rebase once #2527 lands. ## Tests Windows 11 build 26300, dev preset: ``` cmake --build --preset dev --target startup_list_copy_texture_check startup_list_copy_texture_warp ctest --preset dev --no-tests=error -j 1 -R '^startup_list_copy_texture' --output-on-failure ``` 5 of 5 passed: `startup_list_copy_texture`, `_overflow_control` (WILL_FAIL), `_slice_control` (WILL_FAIL), `_warp` (Microsoft Basic Render Driver) and `_hardware` (AMD Radeon RX 6600, driver 32.0.21045.29003, debug layer off). `tests/docs_links_check.py` and `tests/bidi_controls_check.py` pass. New cases in `tests/startup_list_copy_texture_check.cpp`: - refused (`bad_alignment`): `{0,0,2,2}` on a 2x2 mip, `{0,0,6,6}` and `{0,0,6,8}` on a 6x6 mip; - still `ok`: `{0,0,8,8}` on a 6x6 mip, and an inner whole-block box `{4,8,12,16}` on a 64x64 texture. ## Fail-first With only the header change reverted, `startup_list_copy_texture_check.exe` exits 1: ``` FAIL: bc 2x2 mip, 2x2 box: got ok, want bad_alignment FAIL: bc 6x6 mip, 6x6 box: got ok, want bad_alignment FAIL: bc 6x6 mip, 6x8 box: got ok, want bad_alignment ``` With the fix it prints `ok`. ## Device evidence A source-built scratch program (not added here) records one copy per list with the debug layer off. On both WARP and the RX 6600: - each refused box makes `Close` return `0x80070057`; - the whole-block boxes, the null-box copies and a control list recorded afterwards close and execute; - no device removal occurred. The full table is in #2552. ## Open - Whether a title issues such a box, and whether the console runtime accepts it. AI-assisted (Claude Code).
upstream-sync closed this pull request 2026-11-25 22:02:01 +00:00
R0Y00 commented 2026-11-25 22:02:16 +00:00 (Migrated from github.com)

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


I integrated main after #2527, kept the clamped-footprint regressions and added a wrapped-list control in 61401a58. On WARP and RTX 4060 Laptop the wrapper refuses an unaligned right edge and an unaligned bottom edge, then closes and executes the same list. The aligned BC1 block reads back all eight source bytes with the next sentinel intact. Removing only the bottom-edge guard brings back Close → E_INVALIDARG on WARP. The restored Release run passed all five cases with ctest --preset release --no-tests=error -j 1 -R '^startup_list_copy_texture' -V. This covers the source-built command list in #2552. The new head is waiting for GitHub’s checks.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7174552751 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2553#issuecomment-7174552751). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-25T21:03:32Z. --- I integrated main after #2527, kept the clamped-footprint regressions and added a wrapped-list control in `61401a58`. On WARP and RTX 4060 Laptop the wrapper refuses an unaligned right edge and an unaligned bottom edge, then closes and executes the same list. The aligned BC1 block reads back all eight source bytes with the next sentinel intact. Removing only the bottom-edge guard brings back `Close` → `E_INVALIDARG` on WARP. The restored Release run passed all five cases with `ctest --preset release --no-tests=error -j 1 -R '^startup_list_copy_texture' -V`. This covers the source-built command list in #2552. The new head is waiting for GitHub’s checks.
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!2545
No description provided.