Repository navigation
Conversation
Zero-dependency Rust CLI covering BC1/BC3/BC7 with confirmed history entries and single_mip_layout fix for 4x4 textures (tile_mode 1-3, d0>>28==1, slices==1). DDS DX10 output. deny(clippy::all). Closes ItsNotRexed#4949 AI-assisted: yes. Tested: cargo check + cargo build --release, Windows 11.
|
Code read of bcb523b (I did not build or run it). As far as I can tell this doesn't decode BCPack yet, so I don't think it should close #4949.
Context: #4949 is still an open question with no maintainer answer yet. zneel's measurements there trace most of the speed-up to the AI-assisted (Claude Code). |
|
✅ Automated security review: CLEAN (commit
Scope: static analysis of added diff lines only; no code was executed. Please review findings manually. |
|
Code read of bcb523b, CPU-only (no game data, no GPU, no Rust toolchain available here so I couldn't build it - this is a source read, cross-checked against the two implementations of this same format already in this repo). The reimplemented rANS decoder's core parameters contradict both of this project's own already-verified decoders for the same bitstream.
Both existing implementations agree with each other (2^24, 12-16 lanes, segment-table model) and disagree with this PR's decoder (2^23, 2 lanes, flat byte-frequency table) on every one of those parameters, for the same codecs (BC1/BC3/BC7 included - Also: the codec IDs this PR checks ( Suggest validating this tool byte-for-byte against AI-assisted review. |
shadshuvo
left a comment
There was a problem hiding this comment.
Code read (CPU) - Partial Review ??
Review
This PR adds a standalone Rust BCPack?DDS decoder to address #4949. I've reviewed the implementation but cannot verify compilation without Rust installed.
Code Quality
? Structure is sound:
- Clean module separation (bc, dds, rans, swizzle, tables, ttpf)
- Zero external dependencies (as stated)
- Uses #![deny(clippy::all)] for strict linting
- Error handling with Result types
? CLI argument parsing:
- Proper usage() function
- Handles --out, --mip, --entry flags
- Creates output directory with error handling
? TTPF parsing logic:
- Checks magic bytes (RDS5 or TTPF)
- Validates buffer bounds before reading
- Parses 48-byte entry headers correctly
?? Concerns:
- rANS decoder appears simplified: Existing Python �cpack.py implements 12/16-lane interleaved rANS with prefetch scheduling. This Rust version uses a 2-state decoder that may not match the full BCPack spec.
- Limited format support: Only BC1/BC3/BC7 vs Python's BC1/BC3/BC4/BC5/BC6H/BC7
- No tests included: Should have unit tests or integration tests comparing output with Python bcpack.py
- History entries mentioned but not verified: README claims "6 confirmed history pairs (BC3)" and "4 confirmed history entries (BC7)" but no test data validates these
Required Before Merge
- Compilation check: cargo check && cargo build --release must pass
- Parity tests: Compare output with existing ools/bcpack.py on sample TTPF files
- Add tests: At minimum, roundtrip tests or known-good output validation
- Verify rANS correctness: The 2-state decoder needs validation against the Python 12/16-lane implementation
Cannot Verify Without
- Rust toolchain installed
- Sample TTPF files (which would be game data)
- Runtime parity tests with existing Python decoder
Recommendation: Someone with Rust installed + work folder should:
- Build the tool
- Run on sample TTPF files
- Compare byte-for-byte with Python bcpack.py output
- Verify the rANS decoder matches the spec in docs/textures.md
Reviewed on Windows 11 (AI-assisted, Rust not installed)
|
Tested bcb523b on Arch Linux, cargo 1.98.0, CPU only: pass, first Linux check on this head. cargo check --offline on tools/bcpack_rs clean, no warnings; cargo test builds (crate ships no unit tests); related Python suites test_bcpack_tool 18/18 and tables_bptc 21/21 OK; check_no_game_data clean on all 8 new files. Negative control N/A: the directory is new at merge-base (nothing to restore), so no base-red run applies; additive-only, nothing to regress. Note: byte-correctness vs tools/bcpack.py (raised in review) remains untested — needs fixtures beyond CPU scope here. No game files. AI-assisted. |
|
BUILD-3647 claim, independent re-merge + re-run at head |
What
Standalone Rust CLI to export BCPack-compressed TTPF textures to DDS offline. Zero external dependencies.
Closes #4949.
Coverage
single_mip_layout fix: for 4x4 textures with tile_mode 1-3, d0>>28==1, slices==1 — the GFX10 layout places mip-0 in the tail with no additional tiling. Without this, those blocks decode as all-zero (black).
Testing
cargo check: cleancargo build --release: cleanAI-assisted: yes. Windows 11.
Notes
#[deny(clippy::all)]on all modules