textures: check which descriptions take the 64 KiB BC chain #1550

Merged
Asimmimx merged 1 commit from upstream-pr/1557 into main 2026-11-24 14:39:17 +00:00
Asimmimx commented 2026-11-24 13:56:27 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Asimmimx on 2026-11-24T13:56:27Z.


Change

Refs #1149. This adds a device-free check of x2w_startup::bc64::supports() in src/startup_stubs/bc64_chain.h. The predicate decides which texture descriptions take the 64 KiB BC chain, and that choice drives two code paths:

  • the bc64 vtable selected in XGCreateTextureComputer (xg_xs.cpp);
  • whether an address SRV is published as the tiled chain (d3d12_memory_srv.inl).

The Chain address and tile arithmetic is well covered by the existing XG checks. The predicate is not, because every existing test builds only accepted shapes. A predicate that accepts too much passes them all. 8 of 10 mutants left these tests passing:

  • startup_xg_bc_tiling
  • startup_xg_bc7_layout
  • startup_address_srv_warp
  • startup_address_bc_view_warp
  • startup_xg_bc_chain_warp
  • startup_xg_bc_array_warp

The rejected fields (layout 0x109, default alignment, no flags, and so on) are documented as requirements in docs/experiments.md.

startup_bc64_supports includes only the header and has 26 hand-written descriptions:

  • 10 accepted shapes: 2 six-mip and 8 nine-mip, in BC5 and BC7.
  • 16 rejections, each changing one field of an accepted shape: height, slices, mip count, width, 3D, 64 KiB alignment, 4 samples, quality 1, layout UNKNOWN, layout 64KB_STANDARD_SWIZZLE, the render-target flag, BC7_UNORM_SRGB, BC5_SNORM and BC3_UNORM.

startup_bc64_supports_layout_control runs --mutate layout, which expects layout UNKNOWN to be accepted, and must fail (WILL_FAIL).

The change is test, CMake and docs/experiments.md only. The CMake block follows xg_bc64_tiling_reference, and one paragraph of "Nine-mip BC5/BC7 tile queries" is extended.

Verification

Commit 309cfede (main) plus this change, dev preset (Debug), Windows 11 Pro build 26300.9974, MSVC 19.51.36260, Windows SDK 10.0.26100.0, WARP 10.0.26100.9818.

ctest --preset dev --no-tests=error -R '^(startup_bc64_supports(_layout_control)?|startup_xg_bc_(array|chain)_warp|startup_xg_bc_tiling)$' -V
#   5/5 passed; the check prints "10 of 26 descriptions accepted",
#   and the control prints "FAIL layout UNKNOWN: rejected, expected accepted"

xg_bc64_tiling_reference and xg_swizzle_select skip (77) here because addrlib is not configured. tests/docs_links_check.py, tests/bidi_controls_check.py and git diff --check passed.

Mutation probe

I applied each mutation to the header alone, rebuilt startup_stream_consumer and startup_stub_xg_xs, ran the six tests, then reverted. None of this is committed.

Mutant Existing startup_bc64_supports
control: (y & 3) << 4 → << 5 in address killed (bc_chain_warp, bc_array_warp) n/a (arithmetic)
drop Alignment == 0 survived fails
drop Flags == NONE survived fails
drop Layout == 0x109 survived fails
drop SampleDesc.Quality == 0 survived fails
six-mip DepthOrArraySize == 1 → <= 2 survived fails
drop the TEXTURE2D test survived fails
last tail offset 0x600 → 0x400 killed (bc_array_warp) n/a (arithmetic)
Width == 1024 → >= 1024 survived fails
BC5/BC7 format test → != UNKNOWN survived fails

I did not test flag value 0x300000. tiled_bc_srv accepts it on another path, and whether the bc64 chain should ever take it is not settled.

Checklist

  • This pull request covers one reviewable behavior.
  • I included the exact command and result for every check I ran.
  • I considered a negative control or failure case for a new fixture.
  • I updated README/docs when a capability or build requirement changed.
  • I did not include game files, dumps, distribution links or secrets.

AI-assisted (Claude Code).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6583409707 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1557). Originally posted by [Asimmimx](https://github.com/Asimmimx) on 2026-11-24T13:56:27Z. --- ## Change Refs #1149. This adds a device-free check of `x2w_startup::bc64::supports()` in `src/startup_stubs/bc64_chain.h`. The predicate decides which texture descriptions take the 64 KiB BC chain, and that choice drives two code paths: - the bc64 vtable selected in `XGCreateTextureComputer` (`xg_xs.cpp`); - whether an address SRV is published as the tiled chain (`d3d12_memory_srv.inl`). The `Chain` address and tile arithmetic is well covered by the existing XG checks. The predicate is not, because every existing test builds only accepted shapes. A predicate that accepts too much passes them all. 8 of 10 mutants left these tests passing: - `startup_xg_bc_tiling` - `startup_xg_bc7_layout` - `startup_address_srv_warp` - `startup_address_bc_view_warp` - `startup_xg_bc_chain_warp` - `startup_xg_bc_array_warp` The rejected fields (layout `0x109`, default alignment, no flags, and so on) are documented as requirements in `docs/experiments.md`. `startup_bc64_supports` includes only the header and has 26 hand-written descriptions: - 10 accepted shapes: 2 six-mip and 8 nine-mip, in BC5 and BC7. - 16 rejections, each changing one field of an accepted shape: height, slices, mip count, width, 3D, 64 KiB alignment, 4 samples, quality 1, layout `UNKNOWN`, layout `64KB_STANDARD_SWIZZLE`, the render-target flag, `BC7_UNORM_SRGB`, `BC5_SNORM` and `BC3_UNORM`. `startup_bc64_supports_layout_control` runs `--mutate layout`, which expects layout `UNKNOWN` to be accepted, and must fail (`WILL_FAIL`). The change is test, CMake and `docs/experiments.md` only. The CMake block follows `xg_bc64_tiling_reference`, and one paragraph of "Nine-mip BC5/BC7 tile queries" is extended. ## Verification Commit `309cfede` (`main`) plus this change, `dev` preset (Debug), Windows 11 Pro build 26300.9974, MSVC 19.51.36260, Windows SDK 10.0.26100.0, WARP 10.0.26100.9818. ```powershell ctest --preset dev --no-tests=error -R '^(startup_bc64_supports(_layout_control)?|startup_xg_bc_(array|chain)_warp|startup_xg_bc_tiling)$' -V # 5/5 passed; the check prints "10 of 26 descriptions accepted", # and the control prints "FAIL layout UNKNOWN: rejected, expected accepted" ``` `xg_bc64_tiling_reference` and `xg_swizzle_select` skip (77) here because addrlib is not configured. `tests/docs_links_check.py`, `tests/bidi_controls_check.py` and `git diff --check` passed. ## Mutation probe I applied each mutation to the header alone, rebuilt `startup_stream_consumer` and `startup_stub_xg_xs`, ran the six tests, then reverted. None of this is committed. | Mutant | Existing | `startup_bc64_supports` | |---|---|---| | control: `(y & 3) << 4` → `<< 5` in `address` | killed (bc_chain_warp, bc_array_warp) | n/a (arithmetic) | | drop `Alignment == 0` | **survived** | fails | | drop `Flags == NONE` | **survived** | fails | | drop `Layout == 0x109` | **survived** | fails | | drop `SampleDesc.Quality == 0` | **survived** | fails | | six-mip `DepthOrArraySize == 1` → `<= 2` | **survived** | fails | | drop the `TEXTURE2D` test | **survived** | fails | | last tail offset `0x600` → `0x400` | killed (bc_array_warp) | n/a (arithmetic) | | `Width == 1024` → `>= 1024` | **survived** | fails | | BC5/BC7 format test → `!= UNKNOWN` | **survived** | fails | I did not test flag value `0x300000`. `tiled_bc_srv` accepts it on another path, and whether the bc64 chain should ever take it is not settled. ## Checklist - [x] This pull request covers one reviewable behavior. - [x] I included the exact command and result for every check I ran. - [x] I considered a negative control or failure case for a new fixture. - [x] I updated README/docs when a capability or build requirement changed. - [x] I did not include game files, dumps, distribution links or secrets. AI-assisted (Claude Code).
upstream-sync closed this pull request 2026-11-24 15:01:59 +00:00
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!1550
No description provided.