Formats texture: add thick-3D mip-tail regression tests matching AMD addrlib #1449
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1450"
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 Marvisak/VIctory. Originally posted by geiyiliyabumo on 2026-11-24T18:06:03Z.
Summary
Fixes \VIC-BT-014\ (P1, tracked in #1242) in \crates/victory-formats/src/texture.rs:
Verification
AI-assisted; synthetic tests only, no game files.
Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-24T19:25:04Z.
Review: APPROVED
Thick 3D mip tails now also require the padded depth to fit the first depth slab (
depth <= fixed[2]) — without it a base mip with depth > fixed[2] was wrongly folded into the tail. Four new tests pin first-tail selection across w/h/d/mips/swizzle combinations, exact offsets/depth slabs for a 16x16x64 volume, and that thin tails keep array/volume layouts.cargo test -p victory-formats --lockedon macOS arm64: 26 passed, 0 failed (+3).Note: #1494 is the same one-line fix with a single test — this PR subsumes it; suggest closing #1494 or rebasing it onto this.
Imported from Marvisak/VIctory. Originally posted by ArnabSaga on 2026-11-24T19:06:35Z.
Independent reference verification — VIC-BT-014
I investigated the proposed thick-3D mip-tail depth condition against an independently compiled AMD addrlib v10.9 reference implementation.
Gfx10Lib::IsInMipTail()checks width, height, and remaining mip count, but does not compare mip depth. Thick-3D depth is handled separately through slab allocation and addressing.Reference:
github.com/chaotic-cx/mesa-mirror@f8281cfa33/src/amd/addrlib/src/gfx10/gfx10addrlib.h (L529-L541)Verification results
For the reported 16×16×64, four-mip, four-byte SW_64KB_S descriptor:
Additional verification:
The proposed predicate changes not only allocation size but also mip offsets, tail coordinates, and XG-visible layout metadata.
Recommendation
Could we retain the existing tail eligibility predicate and update the additional regression tests to use reference-compatible expectations?
I've prepared a reproducible evidence package containing the independent oracle driver, Rust verification harness, exact reference outputs, checksums, and an end-to-end reproduction script. I'm happy to share these for independent verification.
This reference-compatibility concern also applies to the equivalent depth predicate proposed in #1494.
Limitations
I did not execute the PR branch directly or test physical console hardware. The proposed PR values were derived from its diff. Verification used GNU Rust and MinGW; MSVC and full CI parity remain unverified.
[PR #1450] Formats texture: check padded depth against block depth for thick 3D mip tailsto [PR #1450] Formats texture: add thick-3D mip-tail regression tests matching AMD addrlibupstream-sync referenced this pull request2026-11-24 21:02:38 +00:00
Imported from Marvisak/VIctory. Originally posted by geiyiliyabumo on 2026-11-24T20:18:44Z.
Thank you @ArnabSaga for checking \VIC-BT-014\ against a compiled AMD \ddrlib v10.9\ reference!
You're right — \Gfx10Lib::IsInMipTail()\ intentionally checks only padded width, height, and remaining mip count, while thick-3D depth is handled through depth slab chains (\16x16x64\ 4-mip \SW_64KB_S\ starts the mip tail at mip 0 with 4 depth slabs = 262,144 bytes).
Pushed $sha1450\ to:
AI-assisted; synthetic tests only, no game files.
Imported from Marvisak/VIctory. Originally posted by fiestorra on 2026-11-24T21:06:27Z.
Measured against addrlib, this change doubles or triples four 3D layouts — including the case it fixes
I took the addrlib reference data that #1549 added (
layouts_match_addrlib, 21 descriptions pinned to Mesasrc/amd/addrlibated09d38, Navi 21 settings), ran it on a tree with this pull request merged, and printed every description that disagrees instead of stopping at the first. Four do, and all four areTex3d:Tex3d 4x4x16, 5 mips, 4 B,SW_4KB_STex3d 1x1x17, 2 mips, 1 B,SW_4KB_STex3d 16x16x64, 4 mips, 4 B,SW_64KB_STex3d 8x8x128, 4 mips, 1 B,SW_64KB_SThe other 17 descriptions, 2D and 1D and the wide 3D ones, still match, so the padded-depth condition only moves the deep narrow volumes — which is exactly the set the change targets.
The third row is the case this pull request describes:
16x16x64, 4 mips, where "the mip-tail entry predicate allowed it to enter the 1-block mip tail at mip 0 despite having 64 slices > block depth", and the change makes it enter at mip 2. addrlib puts the whole chain in the tail at mip 0 and totals 4 × 64 KiB = 262,144 bytes; #1549's other test spells out what that means element by element: each 16-slice slab has its own 64 KiB tail block, mip 0 at +32 KiB, mip 1 at +16 KiB, mip 2 at +4 KiB, mip 3 at +2.5 KiB, with mip 1's 32 slices spanning two slabs. That is a different structure, not a different threshold.So the overlap problem the change fixes (VIC-BT-014, #1242) is real, but this is not the shape of its fix: at runtime a deep narrow volume would be allotted two to three times the memory addrlib gives it and off-tiled from different offsets, so the bytes the title uploads and the bytes
Layout::offsetsays are the same element stop corresponding.What I would suggest, since #1549 is tests only and its numbers come from addrlib rather than from our own tests:
Reproduction, on a tree with both pull requests in it (
forge/main, where #1450 isc3b045fand #1549 is78bcd64): replace the assertion inlayouts_match_addrlibwith a print of(l.size, l.first_tail_mip, h)againstexpectedand runcargo test -p victory-formats --locked layouts_match_addrlib -- --nocapture. Reverting the merge (git revert -m 1 c3b045f) makes all 21 match again.No game data is involved: layout sizes and offsets only.
Written with an AI assistant.
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T00:40:26Z.
Automated triage for the maintainers. Closing because another open pull request covers the same change.
See #1549. Despite its description (which says it adds a depth check), the diff only adds a comment and tests that pin main's thick-3D mip-tail behaviour; #1549 covers the same case with addresses taken from AMD's addrlib.
If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.
Pull request closed