BCPack rejects valid BC1/BC4 streams and lacks BC2 decoding #2085

Closed
opened 2026-11-29 09:17:38 +00:00 by github-bot · 1 comment
Owner

@⁠wish131400 on GitHub · 2026-11-29 09:16 UTC · original

At 829188e969ffd2907e5867c5d9aca29bd91cb1b6, victory-formats/src/bcpack.rs rejects valid BC1/BC4 streams and explicitly excludes BC2. DirectStorage forwards the BC format option to this decoder, so these failures reach ordinary storage requests.

I am working on the fix and have verified it locally against independent synthetic cases. No game files, extracted textures, screenshots, SDK binaries or private headers are attached.

Reproduction and expected behaviour

Use Tables::builtin() and call bcpack::decode(bc, packed, dst, &tables) with the synthetic packed inputs and exact target lengths in Mandy's independent fixture. These inputs contain generated BC blocks only. The accompanying expected bytes were obtained independently with BCPackDecompress, including synthetic compressor roundtrips.

Every supported stream should reconstruct exactly the expected BC block bytes without an installed developer SDK. Current main returns an error for 99 of the 1,076 cases:

Format Exact matches Rejected
BC1 24 25
BC2 0 49
BC3 49 0
BC4 24 25
BC5 49 0
BC6H 497 0
BC7 334 0
Total 977 99

The local fix reconstructs all 1,076 byte for byte. It adds BC2's fifteen lanes, explicit-alpha prediction and fixed dictionary/rank constants, and fixes lane output budgets, output backpressure, terminal draining and omitted flush zeros. It preserves current main's packed reconstruction and 256-block strips.

BC7 and test coverage

Production BC7 table parsing is already fixed by f9de61c5. This issue does not claim that fix is missing from current main. However, the scalar test oracle still skips an index word; three existing format tests fail on the base revision. The proposed patch updates that oracle and adds SDK-free synthetic input/output-hash regressions.

Overlap and scope

I searched the open issues/PRs for BCPack, BC2 and BC7. #623 overlaps the lane scheduler for performance and should be reconciled with this correctness work. #614 and #1633 mention BCPack but their changes concern other CPU/memory paths. The standalone implementation is adapted from Mandy #2567, with the public MIT BC2 constants from Xbox2Windows #3293; provenance and notices are included in the patch.

This is a CPU format-decoding report. GPU/profile settings do not affect the reproducer. It does not establish a frame-rate gain or a fix for all the different storage/loading errors in #1272.

**@⁠wish131400** on GitHub · 2026-11-29 09:16 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/issues/2085) At `829188e969ffd2907e5867c5d9aca29bd91cb1b6`, `victory-formats/src/bcpack.rs` rejects valid BC1/BC4 streams and explicitly excludes BC2. DirectStorage forwards the BC format option to this decoder, so these failures reach ordinary storage requests. I am working on the fix and have verified it locally against independent synthetic cases. No game files, extracted textures, screenshots, SDK binaries or private headers are attached. ### Reproduction and expected behaviour Use `Tables::builtin()` and call `bcpack::decode(bc, packed, dst, &tables)` with the synthetic packed inputs and exact target lengths in [Mandy's independent fixture](https://github.com/ProjectLeonida/mandy/blob/cb947eac0d1b46ac8a5938d06a17fe7bd95cfe12/tests/fixtures/bcpack-standalone.txt). These inputs contain generated BC blocks only. The accompanying expected bytes were obtained independently with `BCPackDecompress`, including synthetic compressor roundtrips. Every supported stream should reconstruct exactly the expected BC block bytes without an installed developer SDK. Current main returns an error for 99 of the 1,076 cases: | Format | Exact matches | Rejected | | --- | ---: | ---: | | BC1 | 24 | 25 | | BC2 | 0 | 49 | | BC3 | 49 | 0 | | BC4 | 24 | 25 | | BC5 | 49 | 0 | | BC6H | 497 | 0 | | BC7 | 334 | 0 | | Total | 977 | 99 | The local fix reconstructs all 1,076 byte for byte. It adds BC2's fifteen lanes, explicit-alpha prediction and fixed dictionary/rank constants, and fixes lane output budgets, output backpressure, terminal draining and omitted flush zeros. It preserves current main's packed reconstruction and 256-block strips. ### BC7 and test coverage Production BC7 table parsing is already fixed by `f9de61c5`. This issue does **not** claim that fix is missing from current main. However, the scalar test oracle still skips an index word; three existing format tests fail on the base revision. The proposed patch updates that oracle and adds SDK-free synthetic input/output-hash regressions. ### Overlap and scope I searched the open issues/PRs for BCPack, BC2 and BC7. #623 overlaps the lane scheduler for performance and should be reconciled with this correctness work. #614 and #1633 mention BCPack but their changes concern other CPU/memory paths. The standalone implementation is adapted from [Mandy #2567](https://github.com/ProjectLeonida/mandy/pull/2567), with the public MIT BC2 constants from [Xbox2Windows #3293](https://github.com/R0Y00/Xbox2Windows/pull/3293); provenance and notices are included in the patch. This is a CPU format-decoding report. GPU/profile settings do not affect the reproducer. It does not establish a frame-rate gain or a fix for all the different storage/loading errors in #1272.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-29 09:17:38 +00:00
Author
Owner

@⁠github-actions[bot] on GitHub · 2026-11-29 09:16 UTC · original

Please attach both logs from the run that went wrong. Without them we can only guess. Paste %LOCALAPPDATA% into the address bar of File Explorer to get there.

  1. The play log, in %LOCALAPPDATA%\victory\logs\: the newest victory-nvidia-play-<date>-<time>-<number>.log (from victory.exe) or victory-nvidia-<date>-<time>.log (from the script launcher). The window shows its path at the start, on the line Log: ....
  2. The crash log: %LOCALAPPDATA%\VIctory\data\7952987A\crashes.log, and, if there is one from that run, the newest victory-<date>-<time>-<number>.crash.log in %LOCALAPPDATA%\VIctory\data\7952987A\temp\.

Also say which GPU, Windows version (10 or 11)

**@⁠github-actions[bot]** on GitHub · 2026-11-29 09:16 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/issues/2085#issuecomment-7253653348) Please attach both logs from the run that went wrong. Without them we can only guess. Paste `%LOCALAPPDATA%` into the address bar of File Explorer to get there. 1. The play log, in `%LOCALAPPDATA%\victory\logs\`: the newest `victory-nvidia-play-<date>-<time>-<number>.log` (from `victory.exe`) or `victory-nvidia-<date>-<time>.log` (from the script launcher). The window shows its path at the start, on the line `Log: ...`. 2. The crash log: `%LOCALAPPDATA%\VIctory\data\7952987A\crashes.log`, and, if there is one from that run, the newest `victory-<date>-<time>-<number>.crash.log` in `%LOCALAPPDATA%\VIctory\data\7952987A\temp\`. Also say which GPU, Windows version (10 or 11)
This discussion has been locked. Commenting is limited to contributors.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/trustno1-coder--VIctory-NVIDIA#2085
No description provided.