Fix BC1 transparency and BC2/BC3 preview palettes #35
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/holdmysocks--SixNG!35
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/35/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@ifBars on GitHub · 2026-11-23 04:21 UTC · original
ifBars:fix/preview-bc1-bc2-bc3→master· +227 −3 · 1 files · 1 commits · merged 2026-11-23 04:34 UTCBC1's three-colour mode uses index 3 for transparent black.
to_rgbacalled the opaque decoder, so those pixels got alpha 255. BC2 and BC3 had a related palette problem: their colour decoder switched to three colours whenc0 <= c1, although both formats always use four colours. Microsoft's BC1 reference and BC2/BC3 reference describe the rules.This selects
decode_bc1afor BC1 and repairs only the affected BC2/BC3 RGB values after decoding. Alpha interpolation and output packing stay the same. The six synthetic tests cover transparency, ascending and equal palettes, both BC3 alpha modes, and BC2/BC3 images clipped at the right and bottom edges. The initial reproduction failed for BC1, BC2 and BC3; all six final regression tests pass with the fix.Validated on Windows x64: 109 core tests pass, one ignored (
--no-default-features), and the CLI check passes. The final six colour tests also pass after expanding the edge-coverage case. Full release builds/tests run in CI.AI-assisted with Codex and DeepSeek. No game data is included.