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

Manually merged
github merged 1 commit from gh-pr/1557/head into gh-pr/1557/base 2026-11-26 23:16:25 +00:00
Owner

@⁠Asimmimx on GitHub · 2026-11-24 13:56 UTC · original
Asimmimx:tests/bc64-chain-check → main · +99 −1 · 3 files · 1 commits · merged 2026-11-24 14:39 UTC

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).

**@⁠Asimmimx** on GitHub · 2026-11-24 13:56 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1557) `Asimmimx:tests/bc64-chain-check` → `main` · +99 −1 · 3 files · 1 commits · merged 2026-11-24 14:39 UTC ## 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).
src/startup_stubs/bc64_chain.h decides with bc64::supports which
descriptions XGCreateTextureComputer gives the 64 KiB standard BC
table and which address SRVs are published as that tiled chain. The
existing checks (startup_xg_bc_chain_warp, startup_xg_bc_array_warp,
startup_xg_bc_tiling, startup_address_srv_warp and
startup_address_bc_view_warp) create only accepted shapes, and the
AddrLib comparison skips without addrlib. Single-point mutants that
drop the alignment, flags, layout, sample quality or dimension test,
accept six mips with two slices, accept any width of at least 1024 or
accept any format left them all passing.

startup_bc64_supports includes the header without a device. It lists
the ten accepted BC5/BC7 shapes and 16 descriptions that each change one
field of an accepted shape, with the expected result written by hand.
Each of the eight mutants above now fails it. The
startup_bc64_supports_layout_control run expects layout UNKNOWN to be
accepted and must fail.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 23:16:22 +00:00
github manually merged commit f0379d4ea0 into gh-pr/1557/base 2026-11-26 23:16:25 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.