DirectStorage: unpack BCPack requests (BC1, BC3-BC7) instead of refusing them #950

Closed
github-bot wants to merge 4 commits from gh-pr/950/head into gh-pr/950/base
Owner

@⁠Yeetbot159 on GitHub · 2026-11-24 09:24 UTC · original
Yeetbot159:dstorage-bcpack-4-wire → main · +4963 −26 · 6 files · 4 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.

Stacked on #949; only the top commit belongs here.

Stacked on PR 3; only the top commit belongs here. Open as a draft.

dstorage.rs refused every BCPack request (E_DECOMPRESSION). Now Request::check accepts BC1 and
BC3-BC7, and execute unpacks them after the optional zlib stage, into the destination (a part block
at the end is handled by unpacking whole blocks and keeping the destination size). BC2 and modes 8-15
are still refused, counted and filled as before, so the XCL_DSTORAGE_BCPACK_FILL stopgap and the
report counters keep working for those. Semantics follow VIctory's handling of a retail title:
intermediate_size is the size of the BCPack stream for zlib + BCPack.

Behaviour changes to check: zlib + BCPack with intermediate_size == 0 now returns E_DESTINATION_SIZE
(it was E_DECOMPRESSION; the stream size is not knowable); a bad stream returns E_DECOMPRESSION
and logs once under "BCPack".

What is in it: hle/dstorage.rs (check, execute, tables cache, module docs, tests)
Statements that are now out of date: HANDOFF.md ~line 656 ("BCPack … refused"); not edited, per AGENTS.md.

Tested: not run yet (draft until it is). Author-side: dstorage.rs is Windows-only and was NOT compiled or run; only a
syntax parse was done (no syntax errors). Treat as untested until you have built it.
Regression run: not run yet (draft until it is) (required)
Not tested: the success path through execute (the tests cover the validation matrix and a bad
stream; a valid stream needs real data); AMD / NVIDIA; the retail title.
AI use: Claude (Sonnet 5.5): wrote the change and tests, not compiled.

**@⁠Yeetbot159** on GitHub · 2026-11-24 09:24 UTC · [original](https://github.com/xcl-dev/xcl/pull/950) `Yeetbot159:dstorage-bcpack-4-wire` → `main` · +4963 −26 · 6 files · 4 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. Stacked on #949; only the top commit belongs here. Stacked on PR 3; only the top commit belongs here. **Open as a draft.** `dstorage.rs` refused every BCPack request (E_DECOMPRESSION). Now `Request::check` accepts BC1 and BC3-BC7, and `execute` unpacks them after the optional zlib stage, into the destination (a part block at the end is handled by unpacking whole blocks and keeping the destination size). BC2 and modes 8-15 are still refused, counted and filled as before, so the `XCL_DSTORAGE_BCPACK_FILL` stopgap and the report counters keep working for those. Semantics follow VIctory's handling of a retail title: `intermediate_size` is the size of the BCPack stream for zlib + BCPack. Behaviour changes to check: zlib + BCPack with `intermediate_size == 0` now returns E_DESTINATION_SIZE (it was E_DECOMPRESSION; the stream size is not knowable); a bad stream returns E_DECOMPRESSION and logs once under "BCPack". **What is in it:** `hle/dstorage.rs` (check, execute, tables cache, module docs, tests) **Statements that are now out of date:** `HANDOFF.md` ~line 656 ("BCPack … refused"); not edited, per AGENTS.md. **Tested:** **not run yet** (draft until it is). Author-side: `dstorage.rs` is Windows-only and was NOT compiled or run; only a syntax parse was done (no syntax errors). Treat as untested until you have built it. **Regression run:** **not run yet** (draft until it is) (required) **Not tested:** the success path through `execute` (the tests cover the validation matrix and a bad stream; a valid stream needs real data); AMD / NVIDIA; the retail title. **AI use:** Claude (Sonnet 5.5): wrote the change and tests, not compiled.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:38:07 +00:00
github-bot closed this pull request 2026-11-26 04:38:07 +00:00
Author
Owner

@⁠ettehn on GitHub · 2026-11-24 09:29 UTC · original

BC7 byte-parity issue on 4bada6b (in the decoder this PR wires into DirectStorage). A minimal synthetic input is 1,024 bytes of 0x01, BC7, 16 output bytes: both decoders succeed but XCL differs from the VIctory reference. Across fills 0–63 and output lengths of 1, 4 and 16 blocks, 85 of the 156 accepted BC7 cases differed.

In the BC7 dictionary reader, offsets 52–53 are being consumed as the first signed index. Skipping that u16, reading 31 indices into the flattened 32 slots, and leaving the last slot zero fixed all 85 differences locally. With that change all 1,056 accepted cases across the six supported formats matched byte-for-byte, with 96 jointly rejected. The same table layout is covered in #856 and already used in #905. No retail input required.

Verification assisted by OpenAI Codex (GPT-6.2 Astra).

**@⁠ettehn** on GitHub · 2026-11-24 09:29 UTC · [original](https://github.com/xcl-dev/xcl/pull/950#issuecomment-7127495398) BC7 byte-parity issue on `4bada6b` (in the decoder this PR wires into DirectStorage). A minimal synthetic input is 1,024 bytes of `0x01`, BC7, 16 output bytes: both decoders succeed but XCL differs from the VIctory reference. Across fills 0–63 and output lengths of 1, 4 and 16 blocks, 85 of the 156 accepted BC7 cases differed. In the BC7 dictionary reader, offsets 52–53 are being consumed as the first signed index. Skipping that u16, reading 31 indices into the flattened 32 slots, and leaving the last slot zero fixed all 85 differences locally. With that change all 1,056 accepted cases across the six supported formats matched byte-for-byte, with 96 jointly rejected. The same table layout is covered in #856 and already used in #905. No retail input required. Verification assisted by OpenAI Codex (GPT-6.2 Astra).
Author
Owner

@⁠ettehn on GitHub · 2026-11-24 09:33 UTC · original

One separate build blocker surfaced when moving the BC7 control into the actual DirectStorage request path. At 4bada6b, xcl inherits workspace edition 2021, but bcpack/mod.rs uses two && let Some(...) chains (self.latch.take() and lane.out.take()). Cargo rejects both before the Windows tests run. My earlier standalone codec comparison used edition 2024.

Rewriting those two expressions as nested if/if let preserved short-circuiting and built under the existing workspace edition. With that and the dictionary offset correction, all 15 targeted DirectStorage tests passed on Windows, including a local memory-request test checking the 16 output bytes against the reference and both adjacent sentinel bytes.

Verification assisted by OpenAI Codex (GPT-6.2 Astra).

**@⁠ettehn** on GitHub · 2026-11-24 09:33 UTC · [original](https://github.com/xcl-dev/xcl/pull/950#issuecomment-7127573998) One separate build blocker surfaced when moving the BC7 control into the actual DirectStorage request path. At `4bada6b`, `xcl` inherits workspace edition 2021, but `bcpack/mod.rs` uses two `&& let Some(...)` chains (`self.latch.take()` and `lane.out.take()`). Cargo rejects both before the Windows tests run. My earlier standalone codec comparison used edition 2024. Rewriting those two expressions as nested `if`/`if let` preserved short-circuiting and built under the existing workspace edition. With that and the dictionary offset correction, all 15 targeted DirectStorage tests passed on Windows, including a local memory-request test checking the 16 output bytes against the reference and both adjacent sentinel bytes. Verification assisted by OpenAI Codex (GPT-6.2 Astra).
Author
Owner

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

Compile-blocked in rebuild: this PR merges the same && let chains into crates/xcl/src/hle/bcpack/mod.rs (errors at lines 353/451 after merge onto 9aec53d) while the workspace is edition = "2021", so the lane fails to build before any test runs. Full detail in my comment on #947 (same failure across the whole #947-#950 stack).

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:38 UTC · [original](https://github.com/xcl-dev/xcl/pull/950#issuecomment-7129041142) Compile-blocked in rebuild: this PR merges the same `&& let` chains into `crates/xcl/src/hle/bcpack/mod.rs` (errors at lines 353/451 after merge onto `9aec53d`) while the workspace is `edition = "2021"`, so the lane fails to build before any test runs. Full detail in my comment on #947 (same failure across the whole #947-#950 stack). **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.

**@⁠ivall** on GitHub · 2026-11-24 10:39 UTC · [original](https://github.com/xcl-dev/xcl/pull/950#issuecomment-7129079256) #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.

Pull request closed

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