Formats: test texture layouts against addrlib's own sizes and addresses #1548

Merged
venglov merged 1 commit from upstream-pr/1549 into main 2026-11-25 00:18:01 +00:00
venglov commented 2026-11-24 19:03:09 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by venglov on 2026-11-24T19:03:09Z.


What

victory-formats::texture follows AMD's addrlib, but its tests only check the layouts against themselves (each element at its own address, copies that round-trip) and a few offsets worked out by hand. This adds two tests that pin the layouts to addrlib's own output (Mesa src/amd/addrlib at ed09d38, Navi 21 settings):

  • layouts_match_addrlib: 21 descriptions covering every mode Layout::offset addresses (linear, 256 B, 4 KiB and 64 KiB S/D; 1–16-byte elements, BC, arrays, mip tails, 1D/2D/3D). Each has addrlib's surfSize, its first tail mip and an FNV-1a hash of the address of every element of every mip and slice.
  • deep_volumes_keep_their_chain_in_each_slabs_tail: 16x16x64, 4 mips, 4-byte elements, SW_64KB_S, with explicit addresses. addrlib puts the whole chain in the tail (mipChainInTail). Each 16-slice slab has its own 64 KiB tail block holding that slab's slices of every mip (mip 0 at +32 KiB, mip 1 at +16 KiB, mip 2 at +4 KiB, mip 3 at +2.5 KiB), and mip 1's 32 slices span two slabs. Size: 4 x 64 KiB.

Tests only; no code changes. main passes both.

Why now: two open PRs would break 3D layouts

#1450 and #1494 (and #1499, since closed as their duplicate) implement VIC-BT-014 from #1242 ("Thick 3D mip-tail predicate omits mip_depth(i) <= fixed[2]"). They add a depth check to the tail-entry condition. addrlib has no such check, and main already matches it:

tree 3D thick layouts (SW_4KB_S/SW_64KB_S, 1–16 B, every mip count, depth up to 256) that differ from addrlib
main (ffe310e) 0 of 14,780 (all ~93 M compared addresses identical)
main + #1450 5,456 of 14,780
main + #1494 5,456 of 14,780
main + #1499 (closed) 5,456 of 14,780

With either of them, 5,087 of those layouts grow, by up to 5x (the audit's own 16x16x64/4-mip example goes from 256 KiB to 768 KiB). The other 369 keep their size but their addresses move, and about 30 M of the 93 M compared addresses move in all. Both new tests fail with that change.

This matters beyond detiling. resource.rs notes that the title keeps these sizes in its texture tables, and that its streaming asserts when they disagree with the streamed layout.

The audit's falsification claim, that main gives overlapping offsets for 16x16x64/4 mips, does not hold either. With #1450's extra case added to addresses_are_a_bijection_and_copies_round_trip and main's layout code, that test passes. Only the tests asserting the new tail position fail.

How the reference values were made

addrlib builds standalone with clang (it's MIT-licensed, the same code texture.rs cites). A small driver calls Addr2ComputeSurfaceInfo and Addr2ComputeSurfaceAddrFromCoord for each description. The same pinned values come out with four different GB_ADDR_CONFIG values (0x444, 0x0, 0x342, 0x4c4), so they don't depend on the console's pipe configuration (no XOR modes are pinned).

Driver source and build (no game data involved)
git clone --depth 1 --filter=blob:none --sparse https://gitlab.freedesktop.org/mesa/mesa.git
cd mesa && git sparse-checkout set src/amd/addrlib && cd ..
A=mesa/src/amd/addrlib
clang++ -std=c++17 -O1 -w -DHAVE_TSERVER -DADDR_FASTCALL= -DLITTLEENDIAN_CPU -DDEBUG=0 -DADDR_ALLOW_SIMD=0 \
  -I$A/inc -I$A/src -I$A/src/core -I$A/src/chip/gfx9 -I$A/src/chip/gfx10 -I$A/src/chip/gfx11 \
  -I$A/src/chip/gfx12 -I$A/src/chip/r800 addrlib_layouts.cpp $A/src/addrinterface.cpp \
  $A/src/core/*.cpp $A/src/gfx9/*.cpp $A/src/gfx10/*.cpp $A/src/gfx11/*.cpp $A/src/gfx12/*.cpp \
  $A/src/r800/*.cpp -o addrlib_layouts
echo "9 2 4 1 16 16 64 4" | ./addrlib_layouts
# size 262144, first tail mip 0, hash 0x5d1aa7afc371e8e5

(-DHAVE_TSERVER only skips an Apple-only header include.)

// addrlib's size, first tail mip and FNV-1a hash of every element's address,
// for lines "mode dimension(0 1D, 1 2D, 2 3D) element_bytes block width height
// depth_or_array mips" on stdin. GFX10.3 (Navi 21), no pipe-bank XOR.
#include <cstdio>
#include <cstdlib>
#include <vector>
#include "addrinterface.h"
#include "amdgpu_asic_addr.h"

static void* ADDR_API alloc_mem(const ADDR_ALLOCSYSMEM_INPUT* in) { return malloc(in->sizeInBytes); }
static ADDR_E_RETURNCODE ADDR_API free_mem(const ADDR_FREESYSMEM_INPUT* in) { free(in->pVirtAddr); return ADDR_OK; }
static unsigned dim(unsigned t, unsigned mip, unsigned block) { t >>= mip; return ((t ? t : 1) + block - 1) / block; }

int main() {
    ADDR_CREATE_INPUT ci = {}; ADDR_CREATE_OUTPUT co = {};
    ci.size = sizeof(ci); co.size = sizeof(co);
    ci.chipEngine = 0xD; // CIASICIDGFXENGINE_ARCTICISLAND
    ci.chipFamily = FAMILY_NV;
    ci.chipRevision = 0x28; // Navi 21
    ci.callbacks.allocSysMem = alloc_mem; ci.callbacks.freeSysMem = free_mem;
    ci.regValue.gbAddrConfig = 0x444; // the non-XOR modes do not depend on it
    if (AddrCreate(&ci, &co) != ADDR_OK) return 1;
    unsigned sw, rt, bpe, block, w, h, d, mips;
    while (scanf("%u %u %u %u %u %u %u %u", &sw, &rt, &bpe, &block, &w, &h, &d, &mips) == 8) {
        unsigned ew = (w + block - 1) / block, eh = (h + block - 1) / block;
        ADDR2_COMPUTE_SURFACE_INFO_INPUT in = {}; ADDR2_COMPUTE_SURFACE_INFO_OUTPUT out = {};
        std::vector<ADDR2_MIP_INFO> mi(16);
        in.size = sizeof(in); out.size = sizeof(out); out.pMipInfo = mi.data();
        in.flags.texture = 1; in.swizzleMode = (AddrSwizzleMode)sw; in.resourceType = (AddrResourceType)rt;
        in.bpp = bpe * 8; in.width = ew; in.height = eh; in.numSlices = d; in.numMipLevels = mips;
        in.numSamples = in.numFrags = 1;
        if (Addr2ComputeSurfaceInfo(co.hLib, &in, &out) != ADDR_OK) { printf("refused\n"); continue; }
        unsigned long long hash = 0xcbf29ce484222325ull;
        for (unsigned m = 0; m < mips; m++) {
            unsigned slices = rt == 2 ? dim(d, m, 1) : d;
            for (unsigned z = 0; z < slices; z++)
                for (unsigned y = 0; y < dim(h, m, block); y++)
                    for (unsigned x = 0; x < dim(w, m, block); x++) {
                        ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT ai = {}; ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT ao = {};
                        ai.size = sizeof(ai); ao.size = sizeof(ao);
                        ai.x = x; ai.y = y; ai.slice = z; ai.mipId = m;
                        ai.swizzleMode = in.swizzleMode; ai.flags.texture = 1; ai.resourceType = in.resourceType;
                        ai.bpp = in.bpp; ai.unalignedWidth = ew; ai.unalignedHeight = eh; ai.numSlices = d;
                        ai.numMipLevels = mips; ai.numSamples = ai.numFrags = 1;
                        if (Addr2ComputeSurfaceAddrFromCoord(co.hLib, &ai, &ao) != ADDR_OK) return 1;
                        for (int b = 0; b < 8; b++) { hash ^= (ao.addr >> (8 * b)) & 0xff; hash *= 0x100000001b3ull; }
                    }
        }
        unsigned tail = sw == 0 ? mips : out.mipChainInTail ? 0 : out.firstMipIdInTail;
        printf("size %llu, first tail mip %u, hash 0x%016llx\n", (unsigned long long)out.surfSize, tail, hash);
    }
    AddrDestroy(co.hLib);
}

Wider sweep (not committed)

Besides the pinned cases I compared Layout with addrlib on about 20,000 random and exhaustive descriptions: sizes, alignment, block dimensions, first tail mip, and the addresses of sampled elements (every element along a side of 40 or fewer; edges, powers of two and spread points past that). Every 2D and 3D description in the non-XOR modes matches exactly. (Linear has no mip tail in addrlib, so there only size, alignment and addresses are compared.) The only difference I found: on GFX10, addrlib refuses tiled 1D textures (ADDR_INVALIDPARAMS; 1D must be linear), while Layout::new accepts them. texture_layout only gives 1D textures a tiled mode when the title asks for one explicitly, so I've left that alone.

Verification

  • cargo test -p victory-formats: 25 passed, 0 failed (4 ignored, as before)
  • cargo clippy -p victory-formats --all-targets --locked -- -D warnings: clean
  • cargo xtask policy: 154 files ok
  • The new lines are rustfmt-clean. (cargo fmt --check already reports older lines in this file on main; I didn't touch them.)
  • Run on macOS (the crate builds and tests on any host). Only synthetic descriptions; no game data.

AI-assisted (Claude Code): the addrlib harness, the sweeps and this write-up. The numbers come from running both implementations.

🤖 Generated with Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:issue:6589258521 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1549). Originally posted by [venglov](https://github.com/venglov) on 2026-11-24T19:03:09Z. --- ## What `victory-formats::texture` follows AMD's addrlib, but its tests only check the layouts against themselves (each element at its own address, copies that round-trip) and a few offsets worked out by hand. This adds two tests that pin the layouts to **addrlib's own output** (Mesa `src/amd/addrlib` at `ed09d38`, Navi 21 settings): - `layouts_match_addrlib`: 21 descriptions covering every mode `Layout::offset` addresses (linear, 256 B, 4 KiB and 64 KiB `S`/`D`; 1–16-byte elements, BC, arrays, mip tails, 1D/2D/3D). Each has addrlib's `surfSize`, its first tail mip and an FNV-1a hash of the address of **every** element of every mip and slice. - `deep_volumes_keep_their_chain_in_each_slabs_tail`: 16x16x64, 4 mips, 4-byte elements, `SW_64KB_S`, with explicit addresses. addrlib puts the whole chain in the tail (`mipChainInTail`). Each 16-slice slab has its own 64 KiB tail block holding that slab's slices of every mip (mip 0 at +32 KiB, mip 1 at +16 KiB, mip 2 at +4 KiB, mip 3 at +2.5 KiB), and mip 1's 32 slices span two slabs. Size: 4 x 64 KiB. Tests only; no code changes. `main` passes both. ## Why now: two open PRs would break 3D layouts #1450 and #1494 (and #1499, since closed as their duplicate) implement `VIC-BT-014` from #1242 (*"Thick 3D mip-tail predicate omits `mip_depth(i) <= fixed[2]`"*). They add a depth check to the tail-entry condition. addrlib has no such check, and `main` already matches it: | tree | 3D thick layouts (`SW_4KB_S`/`SW_64KB_S`, 1–16 B, every mip count, depth up to 256) that differ from addrlib | |---|---| | `main` (`ffe310e`) | **0 of 14,780** (all ~93 M compared addresses identical) | | `main` + #1450 | 5,456 of 14,780 | | `main` + #1494 | 5,456 of 14,780 | | `main` + #1499 (closed) | 5,456 of 14,780 | With either of them, 5,087 of those layouts grow, by up to 5x (the audit's own 16x16x64/4-mip example goes from 256 KiB to 768 KiB). The other 369 keep their size but their addresses move, and about 30 M of the 93 M compared addresses move in all. Both new tests fail with that change. This matters beyond detiling. `resource.rs` notes that the title keeps these sizes in its texture tables, and that its streaming asserts when they disagree with the streamed layout. The audit's falsification claim, that `main` gives overlapping offsets for 16x16x64/4 mips, does not hold either. With #1450's extra case added to `addresses_are_a_bijection_and_copies_round_trip` and `main`'s layout code, that test passes. Only the tests asserting the new tail position fail. ## How the reference values were made addrlib builds standalone with clang (it's MIT-licensed, the same code `texture.rs` cites). A small driver calls `Addr2ComputeSurfaceInfo` and `Addr2ComputeSurfaceAddrFromCoord` for each description. The same pinned values come out with four different `GB_ADDR_CONFIG` values (`0x444`, `0x0`, `0x342`, `0x4c4`), so they don't depend on the console's pipe configuration (no XOR modes are pinned). <details><summary>Driver source and build (no game data involved)</summary> ```sh git clone --depth 1 --filter=blob:none --sparse https://gitlab.freedesktop.org/mesa/mesa.git cd mesa && git sparse-checkout set src/amd/addrlib && cd .. A=mesa/src/amd/addrlib clang++ -std=c++17 -O1 -w -DHAVE_TSERVER -DADDR_FASTCALL= -DLITTLEENDIAN_CPU -DDEBUG=0 -DADDR_ALLOW_SIMD=0 \ -I$A/inc -I$A/src -I$A/src/core -I$A/src/chip/gfx9 -I$A/src/chip/gfx10 -I$A/src/chip/gfx11 \ -I$A/src/chip/gfx12 -I$A/src/chip/r800 addrlib_layouts.cpp $A/src/addrinterface.cpp \ $A/src/core/*.cpp $A/src/gfx9/*.cpp $A/src/gfx10/*.cpp $A/src/gfx11/*.cpp $A/src/gfx12/*.cpp \ $A/src/r800/*.cpp -o addrlib_layouts echo "9 2 4 1 16 16 64 4" | ./addrlib_layouts # size 262144, first tail mip 0, hash 0x5d1aa7afc371e8e5 ``` (`-DHAVE_TSERVER` only skips an Apple-only header include.) ```cpp // addrlib's size, first tail mip and FNV-1a hash of every element's address, // for lines "mode dimension(0 1D, 1 2D, 2 3D) element_bytes block width height // depth_or_array mips" on stdin. GFX10.3 (Navi 21), no pipe-bank XOR. #include <cstdio> #include <cstdlib> #include <vector> #include "addrinterface.h" #include "amdgpu_asic_addr.h" static void* ADDR_API alloc_mem(const ADDR_ALLOCSYSMEM_INPUT* in) { return malloc(in->sizeInBytes); } static ADDR_E_RETURNCODE ADDR_API free_mem(const ADDR_FREESYSMEM_INPUT* in) { free(in->pVirtAddr); return ADDR_OK; } static unsigned dim(unsigned t, unsigned mip, unsigned block) { t >>= mip; return ((t ? t : 1) + block - 1) / block; } int main() { ADDR_CREATE_INPUT ci = {}; ADDR_CREATE_OUTPUT co = {}; ci.size = sizeof(ci); co.size = sizeof(co); ci.chipEngine = 0xD; // CIASICIDGFXENGINE_ARCTICISLAND ci.chipFamily = FAMILY_NV; ci.chipRevision = 0x28; // Navi 21 ci.callbacks.allocSysMem = alloc_mem; ci.callbacks.freeSysMem = free_mem; ci.regValue.gbAddrConfig = 0x444; // the non-XOR modes do not depend on it if (AddrCreate(&ci, &co) != ADDR_OK) return 1; unsigned sw, rt, bpe, block, w, h, d, mips; while (scanf("%u %u %u %u %u %u %u %u", &sw, &rt, &bpe, &block, &w, &h, &d, &mips) == 8) { unsigned ew = (w + block - 1) / block, eh = (h + block - 1) / block; ADDR2_COMPUTE_SURFACE_INFO_INPUT in = {}; ADDR2_COMPUTE_SURFACE_INFO_OUTPUT out = {}; std::vector<ADDR2_MIP_INFO> mi(16); in.size = sizeof(in); out.size = sizeof(out); out.pMipInfo = mi.data(); in.flags.texture = 1; in.swizzleMode = (AddrSwizzleMode)sw; in.resourceType = (AddrResourceType)rt; in.bpp = bpe * 8; in.width = ew; in.height = eh; in.numSlices = d; in.numMipLevels = mips; in.numSamples = in.numFrags = 1; if (Addr2ComputeSurfaceInfo(co.hLib, &in, &out) != ADDR_OK) { printf("refused\n"); continue; } unsigned long long hash = 0xcbf29ce484222325ull; for (unsigned m = 0; m < mips; m++) { unsigned slices = rt == 2 ? dim(d, m, 1) : d; for (unsigned z = 0; z < slices; z++) for (unsigned y = 0; y < dim(h, m, block); y++) for (unsigned x = 0; x < dim(w, m, block); x++) { ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT ai = {}; ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT ao = {}; ai.size = sizeof(ai); ao.size = sizeof(ao); ai.x = x; ai.y = y; ai.slice = z; ai.mipId = m; ai.swizzleMode = in.swizzleMode; ai.flags.texture = 1; ai.resourceType = in.resourceType; ai.bpp = in.bpp; ai.unalignedWidth = ew; ai.unalignedHeight = eh; ai.numSlices = d; ai.numMipLevels = mips; ai.numSamples = ai.numFrags = 1; if (Addr2ComputeSurfaceAddrFromCoord(co.hLib, &ai, &ao) != ADDR_OK) return 1; for (int b = 0; b < 8; b++) { hash ^= (ao.addr >> (8 * b)) & 0xff; hash *= 0x100000001b3ull; } } } unsigned tail = sw == 0 ? mips : out.mipChainInTail ? 0 : out.firstMipIdInTail; printf("size %llu, first tail mip %u, hash 0x%016llx\n", (unsigned long long)out.surfSize, tail, hash); } AddrDestroy(co.hLib); } ``` </details> ## Wider sweep (not committed) Besides the pinned cases I compared `Layout` with addrlib on about 20,000 random and exhaustive descriptions: sizes, alignment, block dimensions, first tail mip, and the addresses of sampled elements (every element along a side of 40 or fewer; edges, powers of two and spread points past that). Every 2D and 3D description in the non-XOR modes matches exactly. (Linear has no mip tail in addrlib, so there only size, alignment and addresses are compared.) The only difference I found: on GFX10, addrlib refuses **tiled 1D** textures (`ADDR_INVALIDPARAMS`; 1D must be linear), while `Layout::new` accepts them. `texture_layout` only gives 1D textures a tiled mode when the title asks for one explicitly, so I've left that alone. ## Verification - `cargo test -p victory-formats`: 25 passed, 0 failed (4 ignored, as before) - `cargo clippy -p victory-formats --all-targets --locked -- -D warnings`: clean - `cargo xtask policy`: 154 files ok - The new lines are rustfmt-clean. (`cargo fmt --check` already reports older lines in this file on `main`; I didn't touch them.) - Run on macOS (the crate builds and tests on any host). Only synthetic descriptions; no game data. AI-assisted (Claude Code): the addrlib harness, the sweeps and this write-up. The numbers come from running both implementations. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
catminou4 commented 2026-11-24 20:02:31 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-24T19:20:56Z.

Review: APPROVED


Test-only PR, and a strong one: layouts_match_addrlib checks Layout::offset against AMD addrlib (Mesa ed09d38, Navi 21, no pipe-bank XOR) for element sizes 1-16, block compression, arrays, mip tails and deep volumes — size, first tail mip and an FNV-1a hash over every element address. deep_volumes_keep_their_chain_in_each_slabs_tail pins the per-slab tail chain with hand-computed addresses. Both pass on macOS arm64 (cargo test -p victory-formats --locked: 23 passed, 0 failed). This is exactly the reference-data coverage the texture layout code needed.

<!-- greyfinch-sync:Marvisak/VIctory:review:6045811445 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1549#pullrequestreview-6045811445). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-24T19:20:56Z. **Review:** APPROVED --- Test-only PR, and a strong one: `layouts_match_addrlib` checks `Layout::offset` against AMD addrlib (Mesa ed09d38, Navi 21, no pipe-bank XOR) for element sizes 1-16, block compression, arrays, mip tails and deep volumes — size, first tail mip and an FNV-1a hash over every element address. `deep_volumes_keep_their_chain_in_each_slabs_tail` pins the per-slab tail chain with hand-computed addresses. Both pass on macOS arm64 (`cargo test -p victory-formats --locked`: 23 passed, 0 failed). This is exactly the reference-data coverage the texture layout code needed.
ArnabSaga commented 2026-11-24 20:03:02 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by ArnabSaga on 2026-11-24T19:11:30Z.


Thanks for the comprehensive reference-based verification.

I independently investigated VIC-BT-014 using addrlib v10.9 and reached the same conclusion. My verification covered 33 descriptors, 140 mip metadata rows, and 18,720 exact element-address comparisons.

I've documented the results on #1450 and prepared a reproducible verification package.

Your broader differential testing provides valuable independent corroboration. I support preserving the existing mip-tail predicate and adding reference-compatible regression coverage.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7141732907 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1549#issuecomment-7141732907). Originally posted by [ArnabSaga](https://github.com/ArnabSaga) on 2026-11-24T19:11:30Z. --- Thanks for the comprehensive reference-based verification. I independently investigated VIC-BT-014 using addrlib v10.9 and reached the same conclusion. My verification covered 33 descriptors, 140 mip metadata rows, and 18,720 exact element-address comparisons. I've documented the results on #1450 and prepared a reproducible verification package. Your broader differential testing provides valuable independent corroboration. I support preserving the existing mip-tail predicate and adding reference-compatible regression coverage.
tdogghockey commented 2026-11-24 20:03:08 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by tdogghockey on 2026-11-24T19:23:39Z.


I independently verified this test-only PR at head f078008 on aarch64 Linux.

  • cargo test --offline -p victory-formats --locked texture::tests::layouts_match_addrlib — 1 passed
  • cargo test --offline -p victory-formats --locked deep_volumes_keep_their_chain_in_each_slabs_tail — 1 passed
  • cargo test --offline -p victory-formats --locked — 25 passed, 0 failed, 4 ignored
  • cargo clippy --offline -p victory-formats --all-targets --locked -- -D warnings — clean
  • rustfmt --edition 2024 --check crates/victory-formats/src/texture.rs reports the same 10 pre-existing diff hunks as base ffe310e; none is in the added test region.

Coordination note: one case pins 16x16x64, SW_64KB_S, 4 byte elements to first_tail_mip = 0 and size = 262144. PR #1450 states that addrlib-derived fix makes the same case enter the tail at mip 2. I could not run addrlib here, so I am not asserting which expectation is correct. If both PRs land, their expectations for this case look incompatible and should be reconciled.

Scope note: host-independent tests only; no Windows/GPU/CI verification. No approval implied.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7142032490 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1549#issuecomment-7142032490). Originally posted by [tdogghockey](https://github.com/tdogghockey) on 2026-11-24T19:23:39Z. --- I independently verified this test-only PR at head `f078008` on aarch64 Linux. - `cargo test --offline -p victory-formats --locked texture::tests::layouts_match_addrlib` — 1 passed - `cargo test --offline -p victory-formats --locked deep_volumes_keep_their_chain_in_each_slabs_tail` — 1 passed - `cargo test --offline -p victory-formats --locked` — 25 passed, 0 failed, 4 ignored - `cargo clippy --offline -p victory-formats --all-targets --locked -- -D warnings` — clean - `rustfmt --edition 2024 --check crates/victory-formats/src/texture.rs` reports the same 10 pre-existing diff hunks as base `ffe310e`; none is in the added test region. Coordination note: one case pins `16x16x64`, `SW_64KB_S`, 4 byte elements to `first_tail_mip = 0` and `size = 262144`. PR #1450 states that addrlib-derived fix makes the same case enter the tail at mip 2. I could not run addrlib here, so I am not asserting which expectation is correct. If both PRs land, their expectations for this case look incompatible and should be reconciled. Scope note: host-independent tests only; no Windows/GPU/CI verification. No approval implied.
catminou4 commented 2026-11-24 20:03:08 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-24T19:25:09Z.


Correction to my earlier review: re-ran cargo test -p victory-formats --locked on the PR head merged into main — 25 passed, 0 failed (+2 tests, deep_volumes_keep_their_chain_in_each_slabs_tail and layouts_match_addrlib both run and pass). The "23 passed" figure I quoted was from a batch run that raced with another cargo process on the same checkout; the verdict is unchanged.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7142067597 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1549#issuecomment-7142067597). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-24T19:25:09Z. --- Correction to my earlier review: re-ran `cargo test -p victory-formats --locked` on the PR head merged into main — **25 passed, 0 failed** (+2 tests, `deep_volumes_keep_their_chain_in_each_slabs_tail` and `layouts_match_addrlib` both run and pass). The "23 passed" figure I quoted was from a batch run that raced with another cargo process on the same checkout; the verdict is unchanged.
fiestorra commented 2026-11-24 21:28:27 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fiestorra on 2026-11-24T21:06:40Z.


Your prediction was right, and here is the measure of it

You wrote: "Why now: two open PRs would break 3D layouts — #1450 and #1494". On a tree with both your pull request and #1450 (forge/main: #1450 is c3b045f, this one is 78bcd64), layouts_match_addrlib and deep_volumes_keep_their_chain_in_each_slabs_tail both fail. Reverting #1450's merge makes them pass, so the two tests are doing their job.

I printed every description that disagrees rather than stopping at the first; four of your 21 do, all Tex3d:

description with #1450 your addrlib figures
Tex3d 4x4x16, 5 mips, 4 B, SW_4KB_S 16,384 / tail 1 8,192 / tail 0
Tex3d 1x1x17, 2 mips, 1 B, SW_4KB_S 16,384 / tail 1 8,192 / tail 0
Tex3d 16x16x64, 4 mips, 4 B, SW_64KB_S 786,432 / tail 2 262,144 / tail 0
Tex3d 8x8x128, 4 mips, 1 B, SW_64KB_S 786,432 / tail 2 262,144 / tail 0

The other 17 (1D, 2D, and the wide 3D cases) still match, so #1450 only moves the deep narrow volumes — which is what it says it does. The 16x16x64 row is the case it was written for, and addrlib's answer is the structure your other test spells out element by element (whole chain in the tail at mip 0, one 64 KiB tail block per 16-slice slab, mip 1 spanning two slabs).

I have put the four cases and that reading on https://github.com/Marvisak/VIctory/pull/1450#issuecomment-7144484329, since they are the regression set that decides it. What this pull request does not do — fairly, because you said "tests only; no code changes" — is say which of the two structures is authoritative for the runtime; if addrlib is, as texture.rs already follows it, the overlap fix in #1450 needs to be expressed inside the slab layout rather than by moving the tail threshold.

One thing that would make this kind of clash cheap to catch for everyone: the integration train runs cargo check, not cargo test, so two pull requests that contradict each other both land in it silently. Your tests are the reason this one did not stay silent past the merge.

No game data is involved: sizes and offsets only.

Written with an AI assistant.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7144489547 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1549#issuecomment-7144489547). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-11-24T21:06:40Z. --- **Your prediction was right, and here is the measure of it** You wrote: *"Why now: two open PRs would break 3D layouts — #1450 and #1494"*. On a tree with **both your pull request and #1450** (`forge/main`: #1450 is `c3b045f`, this one is `78bcd64`), `layouts_match_addrlib` and `deep_volumes_keep_their_chain_in_each_slabs_tail` both fail. Reverting #1450's merge makes them pass, so the two tests are doing their job. I printed every description that disagrees rather than stopping at the first; four of your 21 do, all `Tex3d`: | description | with #1450 | your addrlib figures | |---|---|---| | `Tex3d 4x4x16`, 5 mips, 4 B, `SW_4KB_S` | 16,384 / tail 1 | 8,192 / tail 0 | | `Tex3d 1x1x17`, 2 mips, 1 B, `SW_4KB_S` | 16,384 / tail 1 | 8,192 / tail 0 | | `Tex3d 16x16x64`, 4 mips, 4 B, `SW_64KB_S` | 786,432 / tail 2 | 262,144 / tail 0 | | `Tex3d 8x8x128`, 4 mips, 1 B, `SW_64KB_S` | 786,432 / tail 2 | 262,144 / tail 0 | The other 17 (1D, 2D, and the wide 3D cases) still match, so #1450 only moves the deep narrow volumes — which is what it says it does. The 16x16x64 row is the case it was written for, and addrlib's answer is the structure your other test spells out element by element (whole chain in the tail at mip 0, one 64 KiB tail block per 16-slice slab, mip 1 spanning two slabs). I have put the four cases and that reading on https://github.com/Marvisak/VIctory/pull/1450#issuecomment-7144484329, since they are the regression set that decides it. What this pull request does not do — fairly, because you said "tests only; no code changes" — is say which of the two structures is authoritative for the *runtime*; if addrlib is, as `texture.rs` already follows it, the overlap fix in #1450 needs to be expressed inside the slab layout rather than by moving the tail threshold. One thing that would make this kind of clash cheap to catch for everyone: the integration train runs `cargo check`, not `cargo test`, so two pull requests that contradict each other both land in it silently. Your tests are the reason this one did not stay silent past the merge. No game data is involved: sizes and offsets only. Written with an AI assistant.
upstream-sync closed this pull request 2026-11-25 01:06:49 +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
Marvisak/VIctory!1548
No description provided.