test: check the bc64 chain offsets and address interleave #1683
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1690"
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 ChazY11 on 2026-11-24T17:09:43Z.
What
tests/startup_bc64_supports_check.cppreferencedx2w_startup::bc64::supportsonly. TheChainarithmetic insrc/startup_stubs/bc64_chain.h—start(),slice_bytes()and the in-tile bit interleave inaddress()— had noassertion in this fixture, and the only other user (
xg_swizzle_select_check --bc64-tiling) is gated on the addrlibsource: on this checkout it reports
***Skipped, so in a build without addrlib none of that code is checked at all.This adds device-free assertions for that arithmetic. No source change and no new target.
How I found it
Removing any of the following from
bc64_chain.hleftstartup_bc64_supportsgreen, withstartup_bc64_supports_check.exerebuilt each time:
After the additions all four fail; with the source untouched the fixture passes.
Assertions added
start(3..8)=0x8000, 0x4000, 0x2000, 0x1000, 0x800, 0x600for the nine-mip shape;start(mip) == start(mip+1) + tiles_wide(mip+1) * tiles_high(mip+1) * tile_bytesfor the whole-tile mips;address(0,1,0,0) - start(0) == 64andaddress(0,0,1,0) - start(0) == 16(the low two bits of each coordinate);address(0,4,0,0) - start(0) == 512andaddress(0,0,4,0) - start(0) == 256(the bit-2 term, which the one-texelcases do not reach — this is what catches the two interleave mutants);
slice_bytes() == start(0) + tiles_wide(0) * tiles_high(0) * tile_bytes;address(0,0,0,1) == slice_bytes() + start(0).Tested
bc64 supports: 10 of 26 descriptions accepted, the rest rejectedis unchanged, and the--mutate layoutcontrol stillreports its expected single failure.
Notes
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T17:15:16Z.
Review: COMMENTED
Review of head
d81928db9ac7764dd58da93a00a330d8046cb2fc. Onlytests/startup_bc64_supports_check.cppchanges (+70/-0); no production code.Linux limits. Linux x86_64. The test was built with
x86_64-w64-mingw32-g++ -std=c++17 -Wall -Wextra -static -Isrcand run withwine, not on Windows, not through CTest, not with the project's MSVC or CMake configuration. Nativeg++ -fsyntax-onlycannot be used (nod3d12.h).What I ran
git diff --check origin/main...HEAD: clean. The diff has no non-ASCII bytes and no bidi controls;tests/bidi_controls_check.pyandtests/docs_links_check.pypass (no docs touched).bc64 supports: 10 of 26 descriptions accepted, the rest rejected, exit 0.src/startup_stubs/bc64_chain.hby hand: tail offsets 0x8000..0x600 match the table; texel (x=1) is +64 and (y=1) is +16 from(y&3)<<4 | (x&3)<<6; coordinate 4 is +512 (x, bit5+2*2) and +256 (y, bit4+2*2); slice 1 isslice_bytes()further. No assertion is weakened (additions only, the existing loop and the earlyif (failures) return 1;are untouched).git checkout -- .:start(8)).5+bit*2->6+bit*2: FAIL (+512).UINT tiles = 1->2: PASSED (not caught).tiles_wide->tiles_highinaddress: PASSED (not caught).Findings
start(mip)withstart(mip+1)plus a step, so a uniform shift of all three stays consistent. A literal expectation forstart(2)(one tile, 0x10000) would pin it.addressnever leaves tile 0; a coordinate such as (64, 0) and (0, 64) on mip 0 would covertile * tile_bytes.slice_bytes() == start(0) + tiles_wide(0)*tiles_high(0)*tile_bytes) and the step loop restate the production formula, so they cannot fail independently of it; the literal tail table, the +64/+16/+512/+256 values and the slice-1 offset are the independent parts.addresstakes 4x4 block coordinates.Verdict: sound, test-only, passes everywhere I could run it; the two gaps above are cheap to close. Not approving.
AI-assisted; commands listed were executed locally.