Formats: keep deep 3D mips out of the thick mip tail (VIC-BT-014) #1499

Closed
github-bot wants to merge 2 commits from gh-pr/1499/head into gh-pr/1499/base
Owner

@⁠tdogghockey on GitHub · 2026-11-24 18:32 UTC · original
tdogghockey:fix/thick-3d-mip-tail-depth → main · +27 −1 · 1 files · 2 commits · closed without merging

What

Fixes backlog item VIC-BT-014: thick 3D layouts' mip-tail predicate checked width and height, but not depth. A deep 3D mip (e.g. 16x16x64, Sw64KbS) could therefore wrongly enter the one-block mip tail: its first mip had tail: Some(...) and first_tail_mip == 0.

The condition now also requires mip_depth(i) <= fixed[2] for thick layouts, matching the block's depth limit. This is a one-line behavioral change; no game data, assets or generated data are added.

TDD evidence

  • RED: cargo test -p victory-formats --locked deep_3d_mips_do_not_enter_the_mip_tail failed before the fix with mip 0 has 64 slices and cannot fit one tail block: Mip { ... tail: Some(Tail { offset: 8192, x: 16, y: 0 }) }.
  • GREEN: same test passes after the fix; full crate: cargo test -p victory-formats --locked -> 24 passed, 0 failed, 4 ignored (4 pre-existing ignored benchmark/reference tests).
  • Lint: cargo clippy -p victory-formats --all-targets --locked -- -D warnings clean.
  • Asset policy: cargo xtask policy -> 154 files ok.
  • git diff --check clean.

Duplicate check

Checked all open upstream PR titles and changed-file lists (820 open PRs at time of writing). No open PR contains this fix; among the newest PRs touching victory-formats/src/texture.rs, only #1330 appears, and its diff has no mip-tail changes. This fix is also independent of the XMA/SGD5 and Linux-build patches posted on forks.

Limitations

This machine is aarch64 Linux, and the full workspace does not compile here because of the pre-existing non-Windows host_resource cfg issue also covered by #1241; victory-pe's current_exe() tests have the same known host assumption. I verified this crate locally; upstream CI on windows-latest will check the workspace. Windows MSVC cross-check was attempted but cannot run here because ml64.exe is unavailable.

AI use: Claude Code wrote the fix and tests and ran the checks at my request.

**@⁠tdogghockey** on GitHub · 2026-11-24 18:32 UTC · [original](https://github.com/Marvisak/VIctory/pull/1499) `tdogghockey:fix/thick-3d-mip-tail-depth` → `main` · +27 −1 · 1 files · 2 commits · closed without merging ## What Fixes backlog item [VIC-BT-014](https://git.gtahub.st/github/Marvisak--VIctory/issues/1242): thick 3D layouts' mip-tail predicate checked width and height, but not depth. A deep 3D mip (e.g. 16x16x64, `Sw64KbS`) could therefore wrongly enter the one-block mip tail: its first mip had `tail: Some(...)` and `first_tail_mip == 0`. The condition now also requires `mip_depth(i) <= fixed[2]` for thick layouts, matching the block's depth limit. This is a one-line behavioral change; no game data, assets or generated data are added. ## TDD evidence - RED: `cargo test -p victory-formats --locked deep_3d_mips_do_not_enter_the_mip_tail` failed before the fix with `mip 0 has 64 slices and cannot fit one tail block: Mip { ... tail: Some(Tail { offset: 8192, x: 16, y: 0 }) }`. - GREEN: same test passes after the fix; full crate: `cargo test -p victory-formats --locked` -> 24 passed, 0 failed, 4 ignored (4 pre-existing ignored benchmark/reference tests). - Lint: `cargo clippy -p victory-formats --all-targets --locked -- -D warnings` clean. - Asset policy: `cargo xtask policy` -> 154 files ok. - `git diff --check` clean. ## Duplicate check Checked all open upstream PR titles and changed-file lists (820 open PRs at time of writing). No open PR contains this fix; among the newest PRs touching `victory-formats/src/texture.rs`, only #1330 appears, and its diff has no mip-tail changes. This fix is also independent of the XMA/SGD5 and Linux-build patches posted on forks. ## Limitations This machine is aarch64 Linux, and the full workspace does not compile here because of the pre-existing non-Windows `host_resource` cfg issue also covered by #1241; `victory-pe`'s `current_exe()` tests have the same known host assumption. I verified this crate locally; upstream CI on `windows-latest` will check the workspace. Windows MSVC cross-check was attempted but cannot run here because `ml64.exe` is unavailable. AI use: Claude Code wrote the fix and tests and ran the checks at my request.
RED: cargo test -p victory-formats --locked deep_3d_mips_do_not_enter_the_mip_tail
failed: mip 0 (16x16x64, Sw64KbS) wrongly has tail: Some(Tail { offset: 8192, ... })
and first_tail_mip == 0. Test exercises Layout::new's mip-tail predicate with
a deep 3D mip whose depth exceeds the block's depth.
GREEN: cargo test -p victory-formats --locked
24 passed, 0 failed, 4 ignored (focused reproducer: 1 passed).
cargo clippy -p victory-formats --all-targets --locked -- -D warnings: clean.
cargo xtask policy: 154 files ok.

The tail predicate now also requires mip_depth(i) <= fixed[2] for thick
3D layouts, matching the block's depth limit.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:34:03 +00:00
github-bot closed this pull request 2026-11-26 04:34:03 +00:00
Author
Owner

@⁠tdogghockey on GitHub · 2026-11-24 18:40 UTC · original

Closing in favour of the earlier PRs #1450 and #1494, which fix the same VIC-BT-014 defect with overlapping tests. My duplicate-check scan was run before those PRs appeared; thanks to the maintainers/reporters.

**@⁠tdogghockey** on GitHub · 2026-11-24 18:40 UTC · [original](https://github.com/Marvisak/VIctory/pull/1499#issuecomment-7140984474) Closing in favour of the earlier PRs #1450 and #1494, which fix the same VIC-BT-014 defect with overlapping tests. My duplicate-check scan was run before those PRs appeared; thanks to the maintainers/reporters.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!1499
No description provided.