textures: check 4 KiB BC7 surface linearization against a bit-order oracle #439
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/445"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from R0Y00/Xbox2Windows. Originally posted by roansystemlabs on 2026-11-22T03:45:25Z.
Change
tools/bc7_tiles.py::linearize_4k_sconverts a GFX10 4 KiB standard-swizzle BC7surface into linear block rows. Today it is exercised only by
bc7_draw_check.py,which needs DXC and a D3D12 adapter, so the platform-independent Python job never
runs it, and nothing checks its rejection paths.
This PR adds
tests/bc7_tiles_check.py(standard library only) and registers itlike the neighbouring texture checks: CTest
bc7_tile_swizzle, the Ubuntu"platform-independent Python checks" job, and the
AGENTS.mdtexture filter andpure-Python list.
The check:
stated in
tools/bc7_tiles.py,y0 y1 x0 x1 y2 x2 y3 x3(not from thetool's precomputed tables), and confirms the oracle is a bijection over the
256 blocks of a tile;
multiples of four, exact tile edges, and surfaces that cross tile columns and
rows (up to 3x5 tiles);
bytes,bytearrayandmemoryviewpayloads give the same result;ValueErrorfor non-positive dimensions (including an empty payload,which matches the zero tiles such sizes would need) and for payloads that are
16 bytes or one tile too short or too long.
No tool behavior changes. The check pins the existing order; it does not
re-derive it from the AMD swizzle tables linked in
docs/experiments.md.Independent problem; it does not touch a shared interface.
Verification
Windows 11, Python 3.12, isolated venv, on top of
318d9c3(after #348):The new check sits right after
bc7_blocks_check.pyin the Ubuntu job and in theAGENTS.mdpure-Python list (the two lists stay identical, as #348 left them), andbc7_tile_swizzleis registered right afterbc7_block_referencein CTest.Negative controls:
columns of a payload exchanged, and one altered block in the second tile row
(reported at block
(1, 16)) are all detected.linearize_4k_smade thecheck fail, and it passed again after restoring the original: tile pitch
rounded down, tile row ignoring the pitch, x and y swapped inside a tile, size
check accepting an extra tile, dimension check removed, row stride computed
from the pixel width, y2/y3 exchanged in
_Y_BITS, one wrong_X_BITSentry.The dimension-check mutant initially survived (a zero-tile size check still
rejected a one-tile payload), which is why the empty-payload cases are included.
CTest and the CI jobs were not run locally; the CMake entry mirrors
bcpack_prefix_and_mip_tail.AI-assisted: prepared and submitted with the support of Roan System (AI-assisted development), reviewed before posting.