Skip to content

fix: PAA mipmaps of 2^24 bytes - #48

Merged
TheWillard merged 1 commit into
mainfrom
fix/paa-mipmap-size-wrap
Nov 6, 2026
Merged

TheWillard merged 1 commit into
mainfrom
fix/paa-mipmap-size-wrap

Conversation

@TheWillard

@TheWillard TheWillard commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

The mipmap size in a PAA has 24 bits. An uncompressed 4096x4096 DXT5 mipmap is 2^24 bytes and stores 0, so its data was read as the next mipmap header. Found in two terrain textures of the @rhspkl mod (rhspkl_art.pbo: blud_elvebunn_nopx.paa, blud_elvebunn_malingsvei_nohq.paa), one of which panicked before #47.

Uncompressed DXT1 and DXT5 blocks always fill the mipmap, so their size now follows from the dimensions when it matches the stored size mod 2^24. Only mipmaps of 2^24 bytes or more change.

  • Both textures load all 11 mipmaps, at the positions listed in their OFFS tag.
  • Arma 3's 20,817 textures read the same as before.
  • Test: a synthetic DXT5 texture with an uncompressed 4096x4096 mipmap (fails without the fix).

Based on #47 for its DXT block size.

Base automatically changed from fix/p3d-garbage-input to main November 6, 2026 20:55
The mipmap size has 24 bits, an uncompressed 4096x4096 DXT5 mipmap
(2^24 bytes) stores 0. Its data was read as the next mipmap header.
Uncompressed DXT1 and DXT5 blocks always fill the mipmap, so their size
follows from the dimensions when it matches the stored size mod 2^24.
@TheWillard
TheWillard force-pushed the fix/paa-mipmap-size-wrap branch from cd6daca to 6d36ea7 Compare November 6, 2026 21:04
@codecov

codecov Bot commented Nov 6, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.83333% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...rma-file-formats/src/real_virtuality/paa/mipmap.rs 95.65% 1 Missing ⚠️
Files with missing lines Coverage Δ
arma-file-formats/src/real_virtuality/paa/paa.rs 97.60% <100.00%> (ø)
...rma-file-formats/src/real_virtuality/paa/mipmap.rs 88.31% <95.65%> (+1.38%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@TheWillard
TheWillard merged commit 82e137a into main Nov 6, 2026
2 checks passed
@TheWillard
TheWillard deleted the fix/paa-mipmap-size-wrap branch November 6, 2026 23:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant