startup: read block-compressed 0x105 volumes in slot 70 #2881

Manually merged
github merged 4 commits from github-bot/gh-2881 into main 2026-11-28 08:31:54 +00:00 AGit
Owner

@⁠pigalot on GitHub · 2026-11-26 16:19 UTC · original
pigalot:slot70/console-3d-bc → main · +175 −53 · 7 files · 4 commits · merged 2026-11-28 08:25 UTC

Depends on #2876 (and through it #2871). Until those merge, this PR's diff includes their commits. Review the last commit only.

A Texture3D description in 0x105 with a block-compressed format (BC1 to BC7) was still refused as unsupported_description. This change reads those volumes too, with one mip or a mip chain. The rest of the accepted shape is unchanged. The largest mip must be whole 4x4 blocks across and down, as for 2D BC textures; the depth can be any value.

addrlib's rule for a block-compressed surface (ElemLib::AdjustSurfaceInfo from Addr2ComputeSurfaceInfo):

  • the texel width and height are rounded up to whole 4x4 blocks before the layout is computed;
  • the depth is not divided;
  • the surface is then laid out as an uncompressed surface of 8- or 16-byte elements, so every mip size, the tail test and the tail origins are counted in blocks.

A BC volume therefore takes the thick layout of the volume of its blocks, each block one depth layer deep. As before, the rule is restated in our own code; no addrlib code is included.

Changes:

  • gfx10_layout.h: supports_volume takes block-compressed formats. Layout::thick sizes the mips, tail and blocks from the element sides (texel sides rounded up to blocks) instead of the texel sides.

Still refused, unchanged: volumes in every other mode, cube views, and layout 0/0x100 without a live texture.

Tests:

  • startup_gfx10_volume:
    • BC1 64x64x16 with five mips and BC7 48x20x9 with three mips take, element for element, the addresses of the 8-byte and 16-byte volumes of their blocks;
    • distinct bytes and tile/detile round trips for every mip of seven BC volumes (BC1 to BC7, with and without a chain, sides that are not powers of two, mips smaller than a block);
    • BC1 and BC7 volumes (one with a chain) are now taken, a BC1 volume that is not whole blocks wide is refused, and a BC1 volume of depth 3 is taken.
  • New startup_gfx10_volume_bc_control (WILL_FAIL): sizes a BC volume's blocks and mips by its texel sides. It fails 4 checks.
  • startup_gfx10_volume_addrlib: passes each BC format to addrlib as itself (ADDR_FMT_BC1 to ADDR_FMT_BC7) and the coordinates in blocks. It now also compares every mip count of four chains for each of BC1 to BC7: 501 volumes, 13,205,290 element addresses, 0 mismatches (305 volumes before).
  • startup_address_console_{warp,hardware}: also draws three BC1 volume mips: 48x40x12 with one mip, and mips 1 and 3 (the second in the tail) of 64x64x8 with five mips. The Python oracle builds the backing from the 8-byte S3 row. Each block is one solid colour, and all 65,536 pixels of each draw must match.
  • startup_gfx10_layout: two checks asserted that a BC volume in 0x105 is refused. That is the behaviour this PR changes. They now check a BC volume in 0x109, which is still refused.

Negative control run once by hand, not registered: sizing the thick layout by texels instead of blocks in gfx10_layout.h fails startup_address_console_warp on the first BC volume.

Checks (Windows 11 build 26200, MSVC 14.52, debug layer off; the _hardware run's adapter on this host was Microsoft Basic Render Driver 10.0.26100.9818, so no physical-GPU result is claimed):

ctest --preset dev --no-tests=error -j 1 -R "startup_gfx10_(layout|volume)|startup_memory_srv_volume|startup_address_|startup_small_texture_4k|xg_swizzle|bc7_|texture_bc_volume"
# 55 passed; bc7_mode6_multiblock_{warp,hardware} skipped (77), unchanged
python -B tests/docs_links_check.py      # Checked 29 Markdown files and 545 links.
python -B tests/bidi_controls_check.py   # no bidirectional controls

Only BC1 volumes are drawn. BC2 to BC7 volumes are checked against addrlib and by round trip, not by a draw. The layout is checked against addrlib, not against console memory.

This change was AI-assisted.

**@⁠pigalot** on GitHub · 2026-11-26 16:19 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2881) `pigalot:slot70/console-3d-bc` → `main` · +175 −53 · 7 files · 4 commits · merged 2026-11-28 08:25 UTC Depends on #2876 (and through it #2871). Until those merge, this PR's diff includes their commits. Review the last commit only. A Texture3D description in `0x105` with a block-compressed format (BC1 to BC7) was still refused as `unsupported_description`. This change reads those volumes too, with one mip or a mip chain. The rest of the accepted shape is unchanged. The largest mip must be whole 4x4 blocks across and down, as for 2D BC textures; the depth can be any value. addrlib's rule for a block-compressed surface (`ElemLib::AdjustSurfaceInfo` from `Addr2ComputeSurfaceInfo`): - the texel width and height are rounded up to whole 4x4 blocks before the layout is computed; - the depth is not divided; - the surface is then laid out as an uncompressed surface of 8- or 16-byte elements, so every mip size, the tail test and the tail origins are counted in blocks. A BC volume therefore takes the thick layout of the volume of its blocks, each block one depth layer deep. As before, the rule is restated in our own code; no addrlib code is included. Changes: - `gfx10_layout.h`: `supports_volume` takes block-compressed formats. `Layout::thick` sizes the mips, tail and blocks from the element sides (texel sides rounded up to blocks) instead of the texel sides. Still refused, unchanged: volumes in every other mode, cube views, and layout `0`/`0x100` without a live texture. Tests: - `startup_gfx10_volume`: - BC1 64x64x16 with five mips and BC7 48x20x9 with three mips take, element for element, the addresses of the 8-byte and 16-byte volumes of their blocks; - distinct bytes and tile/detile round trips for every mip of seven BC volumes (BC1 to BC7, with and without a chain, sides that are not powers of two, mips smaller than a block); - BC1 and BC7 volumes (one with a chain) are now taken, a BC1 volume that is not whole blocks wide is refused, and a BC1 volume of depth 3 is taken. - New `startup_gfx10_volume_bc_control` (`WILL_FAIL`): sizes a BC volume's blocks and mips by its texel sides. It fails 4 checks. - `startup_gfx10_volume_addrlib`: passes each BC format to addrlib as itself (`ADDR_FMT_BC1` to `ADDR_FMT_BC7`) and the coordinates in blocks. It now also compares every mip count of four chains for each of BC1 to BC7: 501 volumes, 13,205,290 element addresses, 0 mismatches (305 volumes before). - `startup_address_console_{warp,hardware}`: also draws three BC1 volume mips: 48x40x12 with one mip, and mips 1 and 3 (the second in the tail) of 64x64x8 with five mips. The Python oracle builds the backing from the 8-byte S3 row. Each block is one solid colour, and all 65,536 pixels of each draw must match. - `startup_gfx10_layout`: two checks asserted that a BC volume in `0x105` is refused. That is the behaviour this PR changes. They now check a BC volume in `0x109`, which is still refused. Negative control run once by hand, not registered: sizing the thick layout by texels instead of blocks in `gfx10_layout.h` fails `startup_address_console_warp` on the first BC volume. Checks (Windows 11 build 26200, MSVC 14.52, debug layer off; the `_hardware` run's adapter on this host was Microsoft Basic Render Driver 10.0.26100.9818, so no physical-GPU result is claimed): ``` ctest --preset dev --no-tests=error -j 1 -R "startup_gfx10_(layout|volume)|startup_memory_srv_volume|startup_address_|startup_small_texture_4k|xg_swizzle|bc7_|texture_bc_volume" # 55 passed; bc7_mode6_multiblock_{warp,hardware} skipped (77), unchanged python -B tests/docs_links_check.py # Checked 29 Markdown files and 545 links. python -B tests/bidi_controls_check.py # no bidirectional controls ``` Only BC1 volumes are drawn. BC2 to BC7 volumes are checked against addrlib and by round trip, not by a draw. The layout is checked against addrlib, not against console memory. This change was AI-assisted.
A Texture3D description in the 4 KiB standard layout with one mip and an uncompressed format is now detiled from its thick blocks (GFX10_SW_4K_S3_PATINFO rows) instead of refused. The XG-size hold counts a volume as one slice, since its footprints already span every depth layer.
A Texture3D description in the 4 KiB standard layout with a mip chain is now detiled instead of refused. Each layer of thick blocks holds that layer of every mip: the shared tail block, then the mips from the smallest to the largest, with the tail mips at the origins addrlib gives them. The mip-count check counts a volume's depth.
A Texture3D description in 0x105 with a BC1 to BC7 format was refused as
unsupported_description. addrlib rounds the texel width and height of a
block-compressed surface up to whole 4x4 blocks before laying it out and
does not divide the depth, so a BC volume takes the thick layout of the
volume of its blocks. Layout::thick now sizes the mips, the tail and the
blocks from those element sides.

startup_gfx10_volume checks two BC volumes against the volumes of their
blocks and round-trips seven more; the new bc control sizes them by
texels and must fail. The addrlib run compares 501 volumes (13,205,290
addresses, 0 mismatches), and startup_address_console draws three BC1
volume mips. startup_gfx10_layout's two BC-volume refusals now use
0x109, which stays refused.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 01:27:47 +00:00
Author
Owner

@⁠RonLogic on GitHub · 2026-11-26 16:37 UTC · original

Independent physical-GPU verification at 5ac7ed06673bd3ccca659c08ef563796465d4645 on Windows 26300.10075, MSVC x64 Release. The registered layout/volume and address tests produced 10 passes and one addrlib skip. The three registered BC1 draws matched all 65,536 pixels each on in-box WARP 10.0.26100.10068 and RTX 4070 32.0.16.2124.

I also ran a local source-built BC7 mode-6 probe through the same slot-70 draw path. It reused the existing Python volume address oracle with the 16-byte S3 row and generated distinct block contents per slice and mip using bc7_draw_check.make_block. The 48×20×9 single mip and the 64×64×8 chain's mip 1 and tail mip 3 each matched 65,536/65,536 pixels on both adapters. Swapping backing layers 0 and 1 failed at (0,0) on each (expected 0000183c, actual 3812183c). The BC7 probe was local and did not change the PR or its registered tests.

**@⁠RonLogic** on GitHub · 2026-11-26 16:37 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2881#issuecomment-7197891337) Independent physical-GPU verification at `5ac7ed06673bd3ccca659c08ef563796465d4645` on Windows `26300.10075`, MSVC x64 Release. The registered layout/volume and address tests produced 10 passes and one addrlib skip. The three registered BC1 draws matched all 65,536 pixels each on in-box WARP `10.0.26100.10068` and RTX 4070 `32.0.16.2124`. I also ran a local source-built BC7 mode-6 probe through the same slot-70 draw path. It reused the existing Python volume address oracle with the 16-byte S3 row and generated distinct block contents per slice and mip using `bc7_draw_check.make_block`. The 48×20×9 single mip and the 64×64×8 chain's mip 1 and tail mip 3 each matched 65,536/65,536 pixels on both adapters. Swapping backing layers 0 and 1 failed at `(0,0)` on each (`expected 0000183c`, `actual 3812183c`). The BC7 probe was local and did not change the PR or its registered tests.
Author
Owner

@⁠tedin7 on GitHub · 2026-11-27 21:53 UTC · original

This PR is stacked on #2876 (and carries the old #2871 commit, which has since merged as a squash) and no longer merges cleanly with main.

Order: #2876 first, then this one. Please merge main into the branch after #2876 lands; expect conflicts in src/startup_stubs/gfx10_layout.h, tests/startup_address_console_check.py, tests/startup_gfx10_volume_check.cpp and the docs.

AI-assisted; commands listed were executed locally.

**@⁠tedin7** on GitHub · 2026-11-27 21:53 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2881#issuecomment-7228846084) This PR is stacked on #2876 (and carries the old #2871 commit, which has since merged as a squash) and no longer merges cleanly with main. Order: #2876 first, then this one. Please merge main into the branch after #2876 lands; expect conflicts in `src/startup_stubs/gfx10_layout.h`, `tests/startup_address_console_check.py`, `tests/startup_gfx10_volume_check.cpp` and the docs. AI-assisted; commands listed were executed locally.
Main now holds the volume mip chain change as a squashed commit; its files
replace the old copies here and only the block-compressed volume change remains.
Author
Owner

@⁠tedin7 on GitHub · 2026-11-28 00:09 UTC · original

Merged main into this branch after #2876 landed (merge commit fd41d5a70, no rebase); main's files replace the old copies of #2871 and #2876 here and only the block-compressed volume change remains. Testing on Windows now.

AI-assisted; commands listed were executed locally.

**@⁠tedin7** on GitHub · 2026-11-28 00:09 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2881#issuecomment-7230687651) Merged main into this branch after #2876 landed (merge commit fd41d5a70, no rebase); main's files replace the old copies of #2871 and #2876 here and only the block-compressed volume change remains. Testing on Windows now. AI-assisted; commands listed were executed locally.
Author
Owner

@⁠JohnConnorNPC on GitHub · 2026-11-28 08:03 UTC · original

Thanks for this. I reviewed head fd41d5a7 and found nothing blocking: it looks ready from our side, with one suggestion and two nits below. We ran a clang-cl cross build under Wine on the CPU only. We had no WARP and no GPU, so startup_address_console_{warp,hardware} were not run here.

  • Merge: fd41d5a7 merges main after #2876 without a rebase (parents 5ac7ed06 and b1e92256), as requested. git diff --shortstat b1e92256 fd41d5a7 gives 7 files changed, 175 insertions(+), 53 deletions(-), which matches 5ac7ed06's own diff apart from one docstring line. git merge-tree --write-tree origin/main fd41d5a7 against main c3204a9c returns rc=0.
  • Results on that merge tree: startup_gfx10_volume PASS (27 volumes round-tripped, 2 block-compressed volumes against their blocks). With addrlib: 501 volumes, 13205290 element addresses compared, 0 mismatches, the same as your numbers. The thin, tail and bc controls each fail, bc with exactly the 4 FAILs the body describes. startup_gfx10_layout PASS.
  • Source mutants, all of which fail: sizing thick() by texel sides (plain run fails, 153 addrlib mismatches), refusing BC volumes again (11 FAILs), and a tail test that uses texel sides (plain run fails, 736 addrlib mismatches).
  • CI passed on fd41d5a7, but ctest --preset pr doesn't run the touched tests (grep -c startup_gfx10_volume on the Windows job log gives 0), so local runs are their only coverage so far.

Suggestion (not blocking):

  1. startup-runtime.md says a mip "can be a block wider in the layout than in the view", but no case covers this. A mutant that sizes BC mips from the view (columns(mip)/rows(mip)) instead of shifted(columns0, mip) passes everything, addrlib included. The PR is correct here. With an added shape {260,32,8,BC1,9}, your code gives 0 mismatches and the mutant gives FAIL 260x32x8 8-byte 9 mips: size 0x13000, addrlib 0x14000. For a case that doesn't need addrlib, the check_block_compressed pair {volume(260,32,8,BC1,0x105,7), volume(65,8,8,R16G16B16A16_UNORM,0x105,7)} passes on your code and fails the mutant with block-compressed 260x32: size 73728.

Nits:
2. The body and experiments.md describe "round trips for every mip of seven BC volumes (BC1 to BC7 …)". The round-trip shapes array has no BC2 and has BC5 twice, so BC2 is covered only by the addrlib chains.
3. The body still says it depends on #2876 and to review the last commit only, but #2876 has merged. No Windows result has been posted for fd41d5a7 yet. The WARP + RTX 4070 pass in this thread was for 5ac7ed06.

This comment was AI-assisted.

**@⁠JohnConnorNPC** on GitHub · 2026-11-28 08:03 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2881#issuecomment-7236329672) Thanks for this. I reviewed head `fd41d5a7` and found nothing blocking: it looks ready from our side, with one suggestion and two nits below. We ran a clang-cl cross build under Wine on the CPU only. We had no WARP and no GPU, so `startup_address_console_{warp,hardware}` were not run here. - Merge: `fd41d5a7` merges main after #2876 without a rebase (parents `5ac7ed06` and `b1e92256`), as requested. `git diff --shortstat b1e92256 fd41d5a7` gives `7 files changed, 175 insertions(+), 53 deletions(-)`, which matches `5ac7ed06`'s own diff apart from one docstring line. `git merge-tree --write-tree origin/main fd41d5a7` against `main` `c3204a9c` returns rc=0. - Results on that merge tree: `startup_gfx10_volume` PASS (27 volumes round-tripped, 2 block-compressed volumes against their blocks). With addrlib: `501 volumes, 13205290 element addresses compared, 0 mismatches`, the same as your numbers. The thin, tail and bc controls each fail, bc with exactly the 4 FAILs the body describes. `startup_gfx10_layout` PASS. - Source mutants, all of which fail: sizing `thick()` by texel sides (plain run fails, 153 addrlib mismatches), refusing BC volumes again (11 FAILs), and a tail test that uses texel sides (plain run fails, 736 addrlib mismatches). - CI passed on `fd41d5a7`, but `ctest --preset pr` doesn't run the touched tests (`grep -c startup_gfx10_volume` on the Windows job log gives 0), so local runs are their only coverage so far. Suggestion (not blocking): 1. startup-runtime.md says a mip "can be a block wider in the layout than in the view", but no case covers this. A mutant that sizes BC mips from the view (`columns(mip)`/`rows(mip)`) instead of `shifted(columns0, mip)` passes everything, addrlib included. The PR is correct here. With an added shape `{260,32,8,BC1,9}`, your code gives 0 mismatches and the mutant gives `FAIL 260x32x8 8-byte 9 mips: size 0x13000, addrlib 0x14000`. For a case that doesn't need addrlib, the `check_block_compressed` pair `{volume(260,32,8,BC1,0x105,7), volume(65,8,8,R16G16B16A16_UNORM,0x105,7)}` passes on your code and fails the mutant with `block-compressed 260x32: size 73728`. Nits: 2. The body and experiments.md describe "round trips for every mip of seven BC volumes (BC1 to BC7 …)". The round-trip `shapes` array has no BC2 and has BC5 twice, so BC2 is covered only by the addrlib chains. 3. The body still says it depends on #2876 and to review the last commit only, but #2876 has merged. No Windows result has been posted for `fd41d5a7` yet. The WARP + RTX 4070 pass in this thread was for `5ac7ed06`. This comment was AI-assisted.
github manually merged commit 6ddf1b2886 into main 2026-11-28 08:31:54 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.