texture: add gfx10 tiling round-trip #1075

Merged
lambirou merged 1 commit from upstream-pr/1082 into main 2026-11-24 00:48:02 +00:00
lambirou commented 2026-11-24 00:29:27 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by lambirou on 2026-11-24T00:29:27Z.


Change

Add the missing forward GFX10 4 KiB tile and mip-tail packers to the existing BC7 tiling tools,
with a byte-exact synthetic round-trip.

  • tools/bc7_tiles.py gains tile_4k_s() and pack_4k_s_tail() as exact inverses of the
    existing linearize_4k_s() and linearize_4k_s_tail().
  • tests/gfx10_texture_roundtrip_check.py builds a BC7 64×64 texture with seven mips
    (64, 32, 16, 8, 4, 2, 1). Mip 0 is exactly one 4 KiB tile; mips 1–6 occupy one 4 KiB tail at
    slots 32×32→0, 16×16→1, 8×8→2, 4×4→3, 2×2→6 and 1×1→7. Total: 8 KiB.
  • Every 16-byte block has a unique (mip, x, y) tag and 0xff padding. The expected tile is
    built by an independent block-index oracle, not by the production packer.
  • The test compares mip 0 byte-for-byte, linearizes it back, repacks the tail in place and
    linearizes each tail mip.

Verification

  • out\pe-env\Scripts\python.exe -B tests/gfx10_texture_roundtrip_check.py
    • 6 tests, OK; gfx10_texture_roundtrip all: PASS.
  • Positive: exact 8 KiB chain and independent oracle.
  • Controls:
    • 81×69 BC7 with a 22-block pitch source round-trips visible blocks; pitch_blocks=21
      first differs exactly at (0, 1); pitch_blocks < width raises ValueError.
    • A 32×32 mip at level 1 raises; a 16×16 mip written at level 0 then read at level 1 differs
      at the first block; 4095- and 4097-byte tails raise.
  • docs_links_check.py: Self-test passed., Checked 15 Markdown files and 242 links..
  • git diff --check origin/main...HEAD: clean.
  • Not run: CTest (the Python script is registered in the Linux job), a runtime texture upload or
    a GPU draw. This PR is offline tiling evidence only.

Evidence and follow-up

  • Branch texture/gfx10-tiling, head b75ff64, based on the current origin/main.
  • The format is SW_4K_S BC7 with the documented block order y0 y1 x0 x1 y2 x2 y3 x3; the
    independent oracle and first-difference controls guard against a self-consistent wrong
    swizzle.
  • docs/experiments.md documents the chain, the byte-exact comparison and the negative
    controls. The check is registered in the Linux Python job and AGENTS list.
  • Provenance: Xbox2Windows tools and the public GFX10/BC7 layout evidence already documented in
    this tree; no XCL code, table or output is used.
  • Follow-up: a runtime texture path and other BC families remain separate work. This PR does not
    claim that a title texture uploads or renders.
  • No game files, dumps, shader bytes, title paths or secrets are included.

Checklist

  • One reviewable behavior: forward GFX10 4 KiB tiling and mip-tail packing.
  • Independent oracle, byte-exact positive and stride/tail negative controls.
  • Documentation and Linux Python job updated.
  • No game files, dumps, logs or secrets.
  • Provenance checked; no XCL code used.
  • AI-assisted (Codex).
<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6571795469 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1082). Originally posted by [lambirou](https://github.com/lambirou) on 2026-11-24T00:29:27Z. --- ## Change Add the missing forward GFX10 4 KiB tile and mip-tail packers to the existing BC7 tiling tools, with a byte-exact synthetic round-trip. - `tools/bc7_tiles.py` gains `tile_4k_s()` and `pack_4k_s_tail()` as exact inverses of the existing `linearize_4k_s()` and `linearize_4k_s_tail()`. - `tests/gfx10_texture_roundtrip_check.py` builds a BC7 64×64 texture with seven mips (64, 32, 16, 8, 4, 2, 1). Mip 0 is exactly one 4 KiB tile; mips 1–6 occupy one 4 KiB tail at slots 32×32→0, 16×16→1, 8×8→2, 4×4→3, 2×2→6 and 1×1→7. Total: 8 KiB. - Every 16-byte block has a unique `(mip, x, y)` tag and `0xff` padding. The expected tile is built by an independent block-index oracle, not by the production packer. - The test compares mip 0 byte-for-byte, linearizes it back, repacks the tail in place and linearizes each tail mip. ## Verification - `out\pe-env\Scripts\python.exe -B tests/gfx10_texture_roundtrip_check.py` - 6 tests, OK; `gfx10_texture_roundtrip all: PASS`. - Positive: exact 8 KiB chain and independent oracle. - Controls: - 81×69 BC7 with a 22-block pitch source round-trips visible blocks; `pitch_blocks=21` first differs exactly at `(0, 1)`; `pitch_blocks < width` raises `ValueError`. - A 32×32 mip at level 1 raises; a 16×16 mip written at level 0 then read at level 1 differs at the first block; 4095- and 4097-byte tails raise. - `docs_links_check.py`: `Self-test passed.`, `Checked 15 Markdown files and 242 links.`. - `git diff --check origin/main...HEAD`: clean. - Not run: CTest (the Python script is registered in the Linux job), a runtime texture upload or a GPU draw. This PR is offline tiling evidence only. ## Evidence and follow-up - Branch `texture/gfx10-tiling`, head `b75ff64`, based on the current `origin/main`. - The format is SW_4K_S BC7 with the documented block order `y0 y1 x0 x1 y2 x2 y3 x3`; the independent oracle and first-difference controls guard against a self-consistent wrong swizzle. - `docs/experiments.md` documents the chain, the byte-exact comparison and the negative controls. The check is registered in the Linux Python job and AGENTS list. - Provenance: Xbox2Windows tools and the public GFX10/BC7 layout evidence already documented in this tree; no XCL code, table or output is used. - Follow-up: a runtime texture path and other BC families remain separate work. This PR does not claim that a title texture uploads or renders. - No game files, dumps, shader bytes, title paths or secrets are included. ## Checklist - [x] One reviewable behavior: forward GFX10 4 KiB tiling and mip-tail packing. - [x] Independent oracle, byte-exact positive and stride/tail negative controls. - [x] Documentation and Linux Python job updated. - [x] No game files, dumps, logs or secrets. - [x] Provenance checked; no XCL code used. - [x] AI-assisted (Codex).
upstream-sync closed this pull request 2026-11-24 06:46:12 +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!1075
No description provided.