DirectStorage: BCPack decoder tables, lanes and BC1/BC3/BC4/BC5 #947

Closed
github-bot wants to merge 1 commit from gh-pr/947/head into gh-pr/947/base
Owner

@⁠Yeetbot159 on GitHub · 2026-11-24 09:24 UTC · original
Yeetbot159:dstorage-bcpack-1-core → main · +4345 −0 · 5 files · 1 commits · closed without merging

Overlap: #905 covers the same ground (all BCPack modes plus the dstorage.rs wiring, in the same hle/bcpack module). This is an alternative split of the same VIctory code into small stacked PRs, opened as drafts so the two can be compared. If #905 is preferred, please close these.

Adds a BCPack decoder module, hle::bcpack, that nothing calls yet: the constant tables, the rANS
lane reader and the BC1/BC3/BC4/BC5 record decoders. BC6H, BC7 and the wiring follow in the next PRs.
Ported from VIctory (crates/victory-formats/src/bcpack.rs), used with the author's permission
(confirmation from the VIctory author to be linked in a comment); header note and THIRD_PARTY.md row added.

What is in it

  • hle/bcpack/mod.rs: Tables, lanes, decode for BC1, 3, 4, 5 (6 and 7 return an error), tests
  • hle/bcpack/tables.rs: the 77,982-byte table file as a generated Rust array (binary files are not
    accepted outside tests/data/); scripts/gen_bcpack_tables.py regenerates it
  • hle/mod.rs, THIRD_PARTY.md: module and origin

Size: about 1,090 changed lines without tables.rs (3,255 generated), about 400 of them tests. It is
over 800 because the tables, the lane reader and the first formats only make sense together (the lane
tests need the tables, the formats need the lanes). It can be split at the lane reader if you prefer.

Tested

  • Windows / GPU suite: not run yet (draft until it is)
  • Also run on Linux x86-64, rustc 1.97, with the module in a scratch crate (xcl does not build there):
    8 passed, 0 failed, 2 ignored (a benchmark, and reference_chunks, which needs real data)

Regression run: not needed (no runtime change; nothing calls the module)

Not tested: reference_chunks against real BCPack data (set VICTORY_BCPACK_TABLES /
VICTORY_BCPACK_CASES); nothing on Windows yet.

AI use: Claude (Sonnet 5.5): selected and split the code, generated the tables file, wrote this text.

**@⁠Yeetbot159** on GitHub · 2026-11-24 09:24 UTC · [original](https://github.com/xcl-dev/xcl/pull/947) `Yeetbot159:dstorage-bcpack-1-core` → `main` · +4345 −0 · 5 files · 1 commits · closed without merging > **Overlap:** #905 covers the same ground (all BCPack modes plus the `dstorage.rs` wiring, in the same `hle/bcpack` module). This is an alternative split of the same VIctory code into small stacked PRs, opened as drafts so the two can be compared. If #905 is preferred, please close these. Adds a BCPack decoder module, `hle::bcpack`, that nothing calls yet: the constant tables, the rANS lane reader and the BC1/BC3/BC4/BC5 record decoders. BC6H, BC7 and the wiring follow in the next PRs. Ported from VIctory (`crates/victory-formats/src/bcpack.rs`), used with the author's permission (confirmation from the VIctory author to be linked in a comment); header note and `THIRD_PARTY.md` row added. **What is in it** - `hle/bcpack/mod.rs`: `Tables`, lanes, `decode` for BC1, 3, 4, 5 (6 and 7 return an error), tests - `hle/bcpack/tables.rs`: the 77,982-byte table file as a generated Rust array (binary files are not accepted outside tests/data/); `scripts/gen_bcpack_tables.py` regenerates it - `hle/mod.rs`, `THIRD_PARTY.md`: module and origin **Size:** about 1,090 changed lines without `tables.rs` (3,255 generated), about 400 of them tests. It is over 800 because the tables, the lane reader and the first formats only make sense together (the lane tests need the tables, the formats need the lanes). It can be split at the lane reader if you prefer. **Tested** - Windows / GPU suite: **not run yet** (draft until it is) - Also run on Linux x86-64, rustc 1.97, with the module in a scratch crate (xcl does not build there): 8 passed, 0 failed, 2 ignored (a benchmark, and `reference_chunks`, which needs real data) **Regression run:** not needed (no runtime change; nothing calls the module) **Not tested:** `reference_chunks` against real BCPack data (set `VICTORY_BCPACK_TABLES` / `VICTORY_BCPACK_CASES`); nothing on Windows yet. **AI use:** Claude (Sonnet 5.5): selected and split the code, generated the tables file, wrote this text.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:37:56 +00:00
github-bot closed this pull request 2026-11-26 04:37:56 +00:00
Author
Owner

@⁠SlopTart on GitHub · 2026-11-24 10:37 UTC · original

Heads-up: this stack does not compile as-is.

Lane rebuild today: head 5a19347 onto main 9aec53d, merge clean, but the build fails:

error: let chains are only allowed in Rust 2024 or later
   --> crates/xcl/src/hle/bcpack/mod.rs:353:16
error: let chains are only allowed in Rust 2024 or later
   --> crates/xcl/src/hle/bcpack/mod.rs:451:20

The workspace is edition = "2021" and none of #947/#948/#949/#950 bumps it, so every PR in the stack fails to build on any toolchain. Same failure in all four lanes. Fix is either an edition bump or rewriting the two && let chains.

Not tested: retail titles (none here), Windows, RDNA4.
Counts only, no game data.

Machine: RX 7900 XT (RADV NAVI31), Mesa 26.2.5, kernel 7.2 (Arch), Proton Experimental (wine-11.0), patched vkd3d-proton v3.1, Rust cross x86_64-pc-windows-gnu, XCL_NETWORK=0, release profile, --test-threads=4. My Linux rows: #42 / #718.

AI use: Hermes agent (local Qwen-class) ran the suite and drafted this; I checked it before posting.

**@⁠SlopTart** on GitHub · 2026-11-24 10:37 UTC · [original](https://github.com/xcl-dev/xcl/pull/947#issuecomment-7129039101) Heads-up: this stack does not compile as-is. Lane rebuild today: head `5a19347` onto main `9aec53d`, merge clean, but the build fails: ``` error: let chains are only allowed in Rust 2024 or later --> crates/xcl/src/hle/bcpack/mod.rs:353:16 error: let chains are only allowed in Rust 2024 or later --> crates/xcl/src/hle/bcpack/mod.rs:451:20 ``` The workspace is `edition = "2021"` and none of #947/#948/#949/#950 bumps it, so every PR in the stack fails to build on any toolchain. Same failure in all four lanes. Fix is either an edition bump or rewriting the two `&& let` chains. **Not tested:** retail titles (none here), Windows, RDNA4. Counts only, no game data. **Machine:** RX 7900 XT (RADV NAVI31), Mesa 26.2.5, kernel 7.2 (Arch), Proton Experimental (wine-11.0), patched vkd3d-proton v3.1, Rust cross `x86_64-pc-windows-gnu`, `XCL_NETWORK=0`, release profile, `--test-threads=4`. My Linux rows: #42 / #718. AI use: Hermes agent (local Qwen-class) ran the suite and drafted this; I checked it before posting.
Author
Owner

@⁠ivall on GitHub · 2026-11-24 10:39 UTC · original

#905 is merged (67a3735): DirectStorage now unpacks BCPack BC1, BC3, BC4, BC5, BC6H and BC7 with the format's exact tables, so this PR is superseded. Thanks – this stack ported the same code; #905 already had the BC7 dictionary fix and builds on edition 2021.

**@⁠ivall** on GitHub · 2026-11-24 10:39 UTC · [original](https://github.com/xcl-dev/xcl/pull/947#issuecomment-7129076770) #905 is merged (67a3735): DirectStorage now unpacks BCPack BC1, BC3, BC4, BC5, BC6H and BC7 with the format's exact tables, so this PR is superseded. Thanks – this stack ported the same code; #905 already had the BC7 dictionary fix and builds on edition 2021.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.