Formats texture: add thick-3D mip-tail regression tests matching AMD addrlib #1450
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!1450
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1450/head"
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?
@geiyiliyabumo on GitHub · 2026-11-24 18:06 UTC · original
geiyiliyabumo:fix/formats-thick-3d-miptail-depth→main· +86 −0 · 1 files · 2 commits · closed without mergingSummary
Fixes \VIC-BT-014\ (P1, tracked in #1242) in \crates/victory-formats/src/texture.rs:
Verification
AI-assisted; synthetic tests only, no game files.
@ArnabSaga on GitHub · 2026-11-24 19:06 UTC · original
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.
@geiyiliyabumo on GitHub · 2026-11-24 20:18 UTC · original
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.
@fiestorra on GitHub · 2026-11-24 21:06 UTC · original
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.
@Marvisak on GitHub · 2026-11-25 00:40 UTC · original
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