formats: bound thick 3D mip tail by depth #1493

Closed
nino-exe wants to merge 1 commit from upstream-pr/1494 into main
nino-exe commented 2026-11-24 18:26:49 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by nino-exe on 2026-11-24T18:26:49Z.


Fixes VIC-BT-014 (P1) from #1242: the thick 3D mip-tail predicate checked width/height/remaining-mips but omitted mip_depth(i) <= fixed[2], so a base mip whose width/height fit the tail bounds was wrongly folded into the tail even when its depth exceeded fixed[2].

Adds the missing depth check to crates/victory-formats/src/texture.rs:408 and a unit test (thick_3d_mip_tail_respects_depth_bound) that fails on main.

Verified:

  • cargo test --workspace --locked — all green
  • cargo clippy --workspace --all-targets --locked -- -D warnings — clean
  • cargo clippy --workspace --all-targets --all-features --locked -- -D warnings — clean
  • cargo xtask policy — passes

No game data used; synthetic numbers only.

<!-- greyfinch-sync:Marvisak/VIctory:issue:6588638415 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1494). Originally posted by [nino-exe](https://github.com/nino-exe) on 2026-11-24T18:26:49Z. --- Fixes VIC-BT-014 (P1) from #1242: the thick 3D mip-tail predicate checked width/height/remaining-mips but omitted mip_depth(i) <= fixed[2], so a base mip whose width/height fit the tail bounds was wrongly folded into the tail even when its depth exceeded fixed[2]. Adds the missing depth check to crates/victory-formats/src/texture.rs:408 and a unit test (thick_3d_mip_tail_respects_depth_bound) that fails on main. Verified: - cargo test --workspace --locked — all green - cargo clippy --workspace --all-targets --locked -- -D warnings — clean - cargo clippy --workspace --all-targets --all-features --locked -- -D warnings — clean - cargo xtask policy — passes No game data used; synthetic numbers only.
tdogghockey commented 2026-11-24 19:03:40 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by tdogghockey on 2026-11-24T18:52:56Z.

Review: COMMENTED


I independently verified this patch locally on aarch64 Linux (worktree at the PR head, 929e35b):

  • cargo test -p victory-formats --locked thick_3d_mip_tail_respects_depth_bound — 1 passed
  • cargo test -p victory-formats --locked — 24 passed, 0 failed, 4 ignored
  • cargo clippy -p victory-formats --all-targets --locked -- -D warnings — clean
  • git diff origin/main --check — clean

The change is the correct one-line predicate from backlog item VIC-BT-014: mip_depth(i) <= fixed[2] must be required for thick 3D tail mips. The regression test exercises the reported deep 3D case.

One coordination note: PR #1450 fixes the same defect and adds a broader boundary matrix (exact/odd depth boundaries, absent tails, slab offsets, thin-layout regressions). I ran its texture tests too: 12 passed, 0 failed. Both patches are green here; maintainers may prefer #1450's coverage, but this PR is valid on its own.

<!-- greyfinch-sync:Marvisak/VIctory:review:6045383386 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1494#pullrequestreview-6045383386). Originally posted by [tdogghockey](https://github.com/tdogghockey) on 2026-11-24T18:52:56Z. **Review:** COMMENTED --- I independently verified this patch locally on aarch64 Linux (worktree at the PR head, `929e35b`): - `cargo test -p victory-formats --locked thick_3d_mip_tail_respects_depth_bound` — 1 passed - `cargo test -p victory-formats --locked` — 24 passed, 0 failed, 4 ignored - `cargo clippy -p victory-formats --all-targets --locked -- -D warnings` — clean - `git diff origin/main --check` — clean The change is the correct one-line predicate from backlog item VIC-BT-014: `mip_depth(i) <= fixed[2]` must be required for thick 3D tail mips. The regression test exercises the reported deep 3D case. One coordination note: PR #1450 fixes the same defect and adds a broader boundary matrix (exact/odd depth boundaries, absent tails, slab offsets, thin-layout regressions). I ran its texture tests too: 12 passed, 0 failed. Both patches are green here; maintainers may prefer #1450's coverage, but this PR is valid on its own.
catminou4 commented 2026-11-24 20:02:20 +00:00 (Migrated from github.com)

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

Review: COMMENTED


Correct fix, but it duplicates #1450: both add the mip_depth(i) <= fixed[2] condition to the thick-tail test in texture.rs. #1450 covers the same change with four tests (first-tail selection matrix, exact slab offsets, thin-tail regression) vs. one here. The test passes on macOS (cargo test -p victory-formats --locked: 24 passed, 0 failed, +1) — I'd land #1450 and close this one, or rebase this onto it if you prefer the smaller diff.

<!-- greyfinch-sync:Marvisak/VIctory:review:6045877388 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1494#pullrequestreview-6045877388). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-24T19:25:05Z. **Review:** COMMENTED --- Correct fix, but it duplicates #1450: both add the `mip_depth(i) <= fixed[2]` condition to the thick-tail test in `texture.rs`. #1450 covers the same change with four tests (first-tail selection matrix, exact slab offsets, thin-tail regression) vs. one here. The test passes on macOS (`cargo test -p victory-formats --locked`: 24 passed, 0 failed, +1) — I'd land #1450 and close this one, or rebase this onto it if you prefer the smaller diff.
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:18Z.


I independently verified the existing implementation against AMD addrlib v10.9 and documented the results on #1450.

PR #1549 also independently confirms the reference-layout mismatch introduced by the proposed depth predicate, with substantially broader differential testing.

I recommend reviewing both investigations before merging this change.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7141727805 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1494#issuecomment-7141727805). Originally posted by [ArnabSaga](https://github.com/ArnabSaga) on 2026-11-24T19:11:18Z. --- I independently verified the existing implementation against AMD addrlib v10.9 and documented the results on #1450. PR #1549 also independently confirms the reference-layout mismatch introduced by the proposed depth predicate, with substantially broader differential testing. I recommend reviewing both investigations before merging this change.
tdogghockey commented 2026-11-24 20:03:13 +00:00 (Migrated from github.com)

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


Quick correction from me: when I reviewed this earlier, I only checked the code and local tests, and I called the depth-bound change correct. The addrlib v10.9 cross-check linked from #1450/#1549 contradicts that conclusion, so I no longer think the predicate change should be merged as-is.

My local verification still stands: the patch applies cleanly and its synthetic test passes here. But that test only proves the new predicate matches the new expectation; it doesn't prove the expectation matches addrlib. Sorry for the misleading earlier note.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7142289996 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1494#issuecomment-7142289996). Originally posted by [tdogghockey](https://github.com/tdogghockey) on 2026-11-24T19:34:23Z. --- Quick correction from me: when I reviewed this earlier, I only checked the code and local tests, and I called the depth-bound change correct. The addrlib v10.9 cross-check linked from #1450/#1549 contradicts that conclusion, so I no longer think the predicate change should be merged as-is. My local verification still stands: the patch applies cleanly and its synthetic test passes here. But that test only proves the new predicate matches the new expectation; it doesn't prove the expectation matches addrlib. Sorry for the misleading earlier note.
upstream-sync closed this pull request 2026-11-25 01:06:43 +00:00
Marvisak commented 2026-11-25 01:08:14 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T00:41:25Z.


Automated triage for the maintainers. Closing because by our reading the change is incorrect or would break something that works today.

Adds a depth test to the thick-3D mip-tail condition. The GFX10 address library the module follows tests only width, height and mips left (the depth test belongs to the older GFX9 code), and main's 3D layouts match the console library; this would move mip 0 of deep narrow volumes out of the tail and change their sizes.

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.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7148774475 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1494#issuecomment-7148774475). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T00:41:25Z. --- Automated triage for the maintainers. Closing because by our reading the change is incorrect or would break something that works today. Adds a depth test to the thick-3D mip-tail condition. The GFX10 address library the module follows tests only width, height and mips left (the depth test belongs to the older GFX9 code), and main's 3D layouts match the console library; this would move mip 0 of deep narrow volumes out of the tail and change their sizes. 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

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!1493
No description provided.