Preserve A8 mask alpha in texture previews #28

Manually merged
github merged 1 commit from gh-pr/28/head into gh-pr/28/base 2026-11-26 20:04:06 +00:00
Owner

@⁠ifBars on GitHub · 2026-11-23 03:29 UTC · original
ifBars:fix/a8-preview-alpha → master · +25 −4 · 1 files · 1 commits · merged 2026-11-23 04:01 UTC

A8 masks currently go through Fmt::R8, which turns the stored alpha into opaque grayscale. An input alpha of zero becomes [0, 0, 0, 255], so a PNG export loses its transparency. DXGI defines format 65 as alpha-only.

This gives A8 its own format variant and preserves the input byte in alpha, with white RGB for displaying the mask. R8 keeps its existing grayscale preview. Element size and DDS source bytes stay the same.

The synthetic alpha test fails before the fix; both A8 and R8 tests pass afterward. cargo test --locked -p sixng-core --no-default-features --lib passes 98 tests with one existing test ignored. I also checked all eight mips of a real A8 texture against a separate reader; all match. No game data is included.

**@⁠ifBars** on GitHub · 2026-11-23 03:29 UTC · [original](https://github.com/holdmysocks/SixNG/pull/28) `ifBars:fix/a8-preview-alpha` → `master` · +25 −4 · 1 files · 1 commits · merged 2026-11-23 04:01 UTC A8 masks currently go through `Fmt::R8`, which turns the stored alpha into opaque grayscale. An input alpha of zero becomes `[0, 0, 0, 255]`, so a PNG export loses its transparency. [DXGI defines format 65 as alpha-only](https://learn.microsoft.com/en-us/windows/win32/api/dxgiformat/ne-dxgiformat-dxgi_format). This gives A8 its own format variant and preserves the input byte in alpha, with white RGB for displaying the mask. R8 keeps its existing grayscale preview. Element size and DDS source bytes stay the same. The synthetic alpha test fails before the fix; both A8 and R8 tests pass afterward. `cargo test --locked -p sixng-core --no-default-features --lib` passes 98 tests with one existing test ignored. I also checked all eight mips of a real A8 texture against a separate reader; all match. No game data is included.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 20:04:05 +00:00
github manually merged commit 2b732e50a6 into gh-pr/28/base 2026-11-26 20:04:06 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.