Formats: reject texture mip counts beyond the full chain #1792

Open
github-bot wants to merge 2 commits from github-bot/gh-1792 into main AGit
Owner

@⁠VlREX on GitHub · 2026-11-24 22:40 UTC · original
VlREX:fix/texture-mip-count → main · +79 −2 · 1 files · 2 commits · open

No description provided.

**@⁠VlREX** on GitHub · 2026-11-24 22:40 UTC · [original](https://github.com/Marvisak/VIctory/pull/1792) `VlREX:fix/texture-mip-count` → `main` · +79 −2 · 1 files · 2 commits · open *No description provided.*
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:44:45 +00:00
Author
Owner

@⁠dcastell1 on GitHub · 2026-11-24 22:41 UTC · original

Verified on native Windows (no Wine): NVIDIA GeForce RTX 5090 (driver 621.24), Windows 11 10.0.26300, Rust 1.98.1, MSVC 14.44.35207, debug build. main@ffe310e baseline on this box: 342 passed, 0 failed, 6 ignored.

patch -p1 < this PR            # clean, no fuzz
cargo test --workspace
343 passed; 0 failed; 6 ignored   (exit 0)

One more passing test than the baseline; rejecting mip counts beyond the full pyramid is exercised and green.

Tree restored afterwards; no game data. AI-assisted (opencode).

**@⁠dcastell1** on GitHub · 2026-11-24 22:41 UTC · [original](https://github.com/Marvisak/VIctory/pull/1792#issuecomment-7146533170) Verified on native Windows (no Wine): NVIDIA GeForce RTX 5090 (driver 621.24), Windows 11 10.0.26300, Rust 1.98.1, MSVC 14.44.35207, debug build. `main@ffe310e` baseline on this box: **342 passed, 0 failed, 6 ignored**. ``` patch -p1 < this PR # clean, no fuzz cargo test --workspace 343 passed; 0 failed; 6 ignored (exit 0) ``` One more passing test than the baseline; rejecting mip counts beyond the full pyramid is exercised and green. Tree restored afterwards; no game data. AI-assisted (opencode).
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 06:23 UTC · original · edited 2026-11-25 16:46 UTC

Automated triage for the maintainers.

Needs work: evidence needed. Texture::new in crates/victory-formats/src/texture.rs returns Error::Invalid when mips is larger than the full chain. On main it lays out the extra 1×1 levels instead. This is shared layout code: victory-hle's xg.rs (the layout the title asks the console library for) and victory-gpu's resource.rs both call it. So for such a description the XG call would now fail where it used to return a layout.

Since the last review, a second commit (ea9ada0) adds a test for a 7×5 BC7 chain and for oversized counts up to u32::MAX. The test is correct: it gives 3 levels, and the cap uses the texel extent, not the block extent. But a test does not answer the two open points:

  • Evidence of what the console library does with such a description: whether it refuses it or what it returns. Its observed behaviour, the title's own code, or public documentation would do. PC D3D12 refusing MipLevels beyond the chain is a hint, not the console's library.
  • A case where it matters. No title call or failure is named. If the title never passes such a count, this guards a case that does not occur.

CI: passing.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 06:23 UTC · [original](https://github.com/Marvisak/VIctory/pull/1792#issuecomment-7154745055) · edited 2026-11-25 16:46 UTC <!-- victory-triage v1 head=ea9ada0cad93d0dd37cb35e307d5fa24d1d0e971 verdict=needs-work at=2026-11-25T16:45:09Z --> Automated triage for the maintainers. **Needs work: evidence needed.** `Texture::new` in `crates/victory-formats/src/texture.rs` returns `Error::Invalid` when `mips` is larger than the full chain. On `main` it lays out the extra 1×1 levels instead. This is shared layout code: `victory-hle`'s `xg.rs` (the layout the title asks the console library for) and `victory-gpu`'s `resource.rs` both call it. So for such a description the XG call would now fail where it used to return a layout. Since the last review, a second commit (`ea9ada0`) adds a test for a 7×5 BC7 chain and for oversized counts up to `u32::MAX`. The test is correct: it gives 3 levels, and the cap uses the texel extent, not the block extent. But a test does not answer the two open points: - **Evidence** of what the console library does with such a description: whether it refuses it or what it returns. Its observed behaviour, the title's own code, or public documentation would do. PC D3D12 refusing `MipLevels` beyond the chain is a hint, not the console's library. - **A case where it matters.** No title call or failure is named. If the title never passes such a count, this guards a case that does not occur. CI: passing. --- _Generated by [Claude Code](https://claude.ai/code)_
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1792/head:github-bot/gh-1792'
git switch 'github-bot/gh-1792'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1792'
git switch 'github-bot/gh-1792'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1792'
git switch 'github-bot/gh-1792'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1792'
git switch 'main'
git merge --squash 'github-bot/gh-1792'
git switch 'main'
git merge --ff-only 'github-bot/gh-1792'
git switch 'main'
git merge 'github-bot/gh-1792'
git push origin 'main'
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!1792
No description provided.