feat(cli): decode and export BC3, BC4, BC5 and BC7 textures #12
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/Ahmet-Dedeler--bcpack-rs!12
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/12/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?
@brainbudt on GitHub · 2026-11-26 05:46 UTC · original
brainbudt:feat/bc3-bc4-bc5-bc7-cli→master· +455 −86 · 12 files · 1 commits · merged 2026-11-26 06:02 UTCProblem
The Rust library can rebuild BC3, BC4, BC5 and BC7 blocks, but the CLI and whole-texture exporter only expose BC1. The synthetic stream generator also lacks fixtures that exercise the other four formats end to end.
Change
decode-bc3,decode-bc4,decode-bc5anddecode-bc7subcommands, plus--formatforsymbolsandbench(BC1 remains the default).ttpf-exportto detile mip 0 and write DDS for all four formats, using a DX10 header that preserves the source DXGI type (including signed and sRGB variants). BC1 retains its legacy DXT1 output.src/encode.rsfor the new formats and exercise them through block reconstruction, the CLI and DDS export intests/modes.rs.Scope
PNG export, store scanning and the Python reference remain BC1-only. BC6H block reconstruction remains open pending verified format semantics. All fixtures are synthetic; no dependencies or game data are added.
Verification
cargo test --release(28 tests each) andcargo clippy --all-targets -- -D warnings.cargo test(28 tests) andcargo test --no-default-features(23 tests).Reviewed with mistral-loop: APPROVE (1 round,
mistral-large-4-0+deepseek-v4-1-flash-1017).Created with gpt-6.2-astra in Codex (orchestrated with Gemini 4 Neon in T3 Code).
Summary by CodeRabbit
@coderabbitai[bot] on GitHub · 2026-11-26 05:47 UTC · original · edited 2026-11-26 05:55 UTC
No actionable comments were generated in the recent review.
Walkthrough
The change adds mode-based chunk decoding and synthetic encoding, extends CLI commands to BC1, BC3, BC4, BC5, and BC7, and generalizes texture mip processing and DDS export for those formats. Tests cover stream round trips, texture handling, DDS output, and CLI behavior.
Changes
Multi-format support
src/format.rs,src/encode.rs,src/bc1.rs,src/bc7.rs,src/bcn.rsadd_linesuses wrapping addition.src/lib.rsdecode_chunkfunction returns rebuilt blocks and decode diagnostics. It uses format-specific tables and rejects BC6H.src/main.rs,README.mdsymbolsandbench. README status information and examples describe the supported formats and commands.src/ttpf.rs,src/texture.rs,src/main.rstests/modes.rs,docs/findings/bc345-bc7.mdEstimated code review effort: 4 (Complex) | ~45 minutes
Change: Feature
Sequence Diagram(s)
Suggested reviewers:
ahmet-dedelerMerge Risk:
Minimal · up to
1675fThe change adds BC3, BC4, BC5 and BC7 decoding and DDS export alongside the existing BC1 behavior. BC1 output and defaults are preserved. Retail-texture parity for the new formats is not yet verified, which the PR documents. No concrete merge-blocking risk was found.
Pre-merge checks:
4
Full details: Title check
Explanation
The title "feat(cli): decode and export BC3, BC4, BC5 and BC7 textures" matches the main change. The raw summary and objectives show CLI decoding for BC3, BC4, BC5, and BC7, a --format option for symbols and bench, and DDS export of those formats. The title is specific and short. It does not mention the BC1 window-overflow fix, the synthetic test encoder, or the new decode_chunk API, which is expected for a title.
Finishing Touches
Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Share
512df6e2-c555-4b18-ba0a-a7fdcdfde47cReviewing files that changed from the base of the PR and between
577bf3d852and1675fb676b.README.mddocs/findings/bc345-bc7.mdsrc/bc1.rssrc/bc7.rssrc/bcn.rssrc/encode.rssrc/format.rssrc/lib.rssrc/main.rssrc/texture.rssrc/ttpf.rstests/modes.rsIncluded review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.
@Ahmet-Dedeler on GitHub · 2026-11-26 06:02 UTC · original
Thanks, this is a nice one. Merged into current master and ran it on an M5 Max (macOS 27.3, Rust 1.100):
cargo test --release,cargo testand--no-default-featuresall pass, and the BC1 goldens didn't move.One note:
cargo clippy --all-targets -- -D warningsfails on clippy 0.1.100, but on threeneedless_range_loops intests/roundtrip.rsthat were already on master before this PR (mine, from #11). Fixing those separately.