BC1 BCPack: replace nine preset window slots #126

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

@⁠holdmysocks on GitHub · 2026-11-24 05:31 UTC · original
holdmysocks:claude/bcpack-bc1-window → master · +75 −1 · 4 files · 1 commits · merged 2026-11-24 05:54 UTC

BC1 chunks are decoded by the public bcpack crate with its default preset window. Some slots of that window are wrong: every block chained to such a slot gets shifted colour endpoints, and blocks that flip into three-colour mode show black holes where they use index 3.

How the wrong slots were found. A block in three-colour mode (c0 <= c1) should not use index 3. Textures with real cut-out alpha break this, so it is not exact, but on chains that start at the default prediction only 0.018 % of blocks do (1,705 of 9.4 million in a 5 % sample of chunks). On chains that start at preset slots it is 0.14 %, concentrated in a few slots (one at 24 %).

What changes. A new module bc1pack returns the crate's window with nine slots replaced; ttpf.rs calls it instead of Window::default_table() (one line). A slot is replaced only where a refit

  • lowered the violations on held-out chunks, and
  • did not raise the error against plain child mips (at least 30 reference blocks).

On those nine slots, in the 5 % sample: violations 28,387 to 907, reference cost down 11.6 %.

Not changed. 31 further slots moved in the fit but are left at the crate default: either they have no plain reference to confirm the move, or the reference error rose, which points to real cut-out textures. Three of them have violation rates of 31 to 55 % and stay open.

Tests: cargo test --release -p sixng-core bc, 20 pass (two new).

**@⁠holdmysocks** on GitHub · 2026-11-24 05:31 UTC · [original](https://github.com/holdmysocks/SixNG/pull/126) `holdmysocks:claude/bcpack-bc1-window` → `master` · +75 −1 · 4 files · 1 commits · merged 2026-11-24 05:54 UTC BC1 chunks are decoded by the public `bcpack` crate with its default preset window. Some slots of that window are wrong: every block chained to such a slot gets shifted colour endpoints, and blocks that flip into three-colour mode show black holes where they use index 3. **How the wrong slots were found.** A block in three-colour mode (c0 <= c1) should not use index 3. Textures with real cut-out alpha break this, so it is not exact, but on chains that start at the default prediction only 0.018 % of blocks do (1,705 of 9.4 million in a 5 % sample of chunks). On chains that start at preset slots it is 0.14 %, concentrated in a few slots (one at 24 %). **What changes.** A new module `bc1pack` returns the crate's window with nine slots replaced; `ttpf.rs` calls it instead of `Window::default_table()` (one line). A slot is replaced only where a refit - lowered the violations on held-out chunks, and - did not raise the error against plain child mips (at least 30 reference blocks). On those nine slots, in the 5 % sample: violations 28,387 to 907, reference cost down 11.6 %. **Not changed.** 31 further slots moved in the fit but are left at the crate default: either they have no plain reference to confirm the move, or the reference error rose, which points to real cut-out textures. Three of them have violation rates of 31 to 55 % and stay open. Tests: `cargo test --release -p sixng-core bc`, 20 pass (two new).
A block in three-colour mode (c0 <= c1) should not use index 3. On chains
that start at the default prediction 0.018 % of blocks break that; on chains
that start at some preset slots of the default window up to 24 % did, and
decoded with black holes. Nine slots are replaced where a refit lowered the
violations on held-out chunks and did not raise the error against plain
child mips: violations in a 5 % sample of chunks 28,387 to 907, reference
cost on those slots down 11.6 %. The window stays the crate default
everywhere else.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 20:11:45 +00:00
github manually merged commit 67c84abfdf into gh-pr/126/base 2026-11-26 20:11:46 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.