Repository navigation
DirectStorage: unpack BCPack BC1, BC3, BC4, BC5, BC6H and BC7 streams - #905
brandostrong wants to merge 1 commit into
Conversation
|
Resolved on Windows retest at Two DirectStorage tests still expect BC6H requests to be rejected. To reproduce, run Two reproducible findings on 4833c4b. BC7 dictionary offset. The generator starts the signed index arrays at byte 52 of the 116-byte entry. The layout in Marvisak/VIctory#658 puts two additional bytes there, then 16 signed indices at byte 54 and 15 at byte 86. In a synthetic generator test the first anchor came out as 2 instead of 1, and the last index of set 0 (7) landed in the zero-width second set. In this PR's checked-in tables, 233 of 255 entries have nonzero indices in that zero-width set. Skipping bytes 52–53, reading 31 i16 values, and appending a zero for the unused Rust array slot made all 255 synthetic entries match. The checked-in tables would need regeneration as well. The parity test can pass with zero matches. On native Windows I ran bcpack_parity with three synthetic cases: two copies of a 256-byte BC1 stream filled with 0x11, deliberately paired with different eight-byte references (all zero and all 0xff), plus one empty stream. The test printed one decode error and 15 differing bytes across the two decoded cases, then reported 1 passed (exit 0). Its final assertion checks only cases > 0. Adding assert_eq!(identical, cases) after that assertion made the same run fail as expected, 0 vs 3. This checks the test verdict; I did not rerun the 126 reported retail cases. Single-block regression (no game files). Call OpenAI Codex (GPT-6.2 Astra) assisted with verification. |
c8e1005 to
d19a3d3
Compare
|
First retail-title validation: BC1, BC5 and BC7 requests unpack Built this PR at That BC1 source size, Context of the run, and the parts that are ours rather than yours:
I could not yet check the end-of-run Two questions, if you have a moment: is there a known-good BC1 stream you compare against for the fitted tables, and should a consumer expect the unpacked BCn to be swizzled as the console wants (the log shows AI-assisted investigation (Claude Code); all values are from our own retail run, and the title package is unmodified. |
|
Two tests fail on this tree on Windows, both from the same change of expectation: Both still expect the BCPack refusal ( Environment: Windows 11 10.0.26300, NVIDIA GeForce RTX 5090 (driver 621.24), Rust 1.100.0 MSVC 14.44.35207, debug build, AI-assisted (opencode): applied the patch to a built tree, ran the suite, reverted it. |
|
Retail smoke pair for the empty Regression run section, on RTX 3060 Ti 8 GB (Ryzen 7 9800X3D, driver 32.0.16.1742, Windows 11, release) — the title whose 128 refused BCPack requests per run were the standing wall in its world load (#273): main this PR The part that matters beyond the smoke: a 150 s scripted press-walk into the loading phase (presses at 25/35/45/55/65/80/95/110/125/140 s,
Tests on this head: The world itself still does not finish loading within my 150 s window on this card — the load has other walls after the textures (this is the phase where #891's waits and the sparse-tile churn live) — but the texture-refusal wall this PR targets is measurably gone on a second host, with no pacing cost. AI use: GPT-6.2 Astra (API model selector) in DSH built both commits, ran the smokes, the walk and the tests, and drafted this comment; the human contributor reviewed the numbers before posting. |
|
Both confirmed; fixed in d19a3d3. BC7 dictionary offset. The shipped tables had the same layout as VIctory main, so the parity oracle shared the bug. Regenerated from Parity verdict. The test now asserts Regression run is still open: an |
b61e162 to
290f43a
Compare
… support (keep BC2 refusal check)
|
Confirmed - both expectations predate the decoder and our bcpack filter skipped them. Fixed in 290f43a: BC6H single-stage and zlib + BCPack now expect |
|
Thanks for the retail run - the 39541-byte BC1 request is the one the PR is for. On the BC1 reference: the tables are no longer fitted. The model frequencies, history and BC1 quadrant selectors come from VIctory's On swizzle: the decoder emits the blocks in the order the destination expects and applies no swizzle. Hardware swizzle is a separate request field - XCL refuses a non-zero mode, and the requests you see carry |
|
Thanks - this is exactly the phase the PR targets, and the refused BC1/BC5/BC7 requests are the ones a user sees as missing textures. One heads-up: the head moved to 290f43a after your run (BC7 dictionary tables corrected per VIctory #658, plus two BCPack test expectations). The description check requires the Your 60 fps result also matters: it contradicts a 4-6 fps observation on our host at the old 4833c4b head. If 290f43a also holds 60, that drop was profile/cache-specific and I will treat yours as the data point. A rerun of the 90 s pair at 290f43a would settle both. |
|
Test report on Tested
Not tested
AI use
|
|
Thanks - the BC6H unpack is useful, that mode had no retail confirmation yet. Two notes. The head moved to 290f43a: the BC7 dictionary tables were corrected against VIctory #658, so BC7 output on that build differs from d19a3d3 (BC1/3/4/5/6H are unchanged). A rerun at 290f43a would cover the mode you saw. On correctness of the unpacked blocks, that is what the parity test covers: 126 retail chunks across BC1/3/4/5/6H/7 decoded byte-for-byte against VIctory's decoder, 0 differing of 22,253,568. Your loading-screen comparison and that test ask different questions - the dump says the loading screen does not use these textures, which matches main showing refusals without a visible break there. |
|
Tested
The run ended at about 454 s in the title's own fatal-error routine ( Regression run of Not tested: the full AI-assisted (Claude Code, Claude Opus 5.5). |
|
NVIDIA test report for Tested
BCPack. Every BCPack request is now unpacked:
A second failure that the refusals used to hide. Run 1 has 1994 failed requests, 1992 of them in one 2 s window at 64 s. They fail with
Regression run (60 s at the menus, no input, so no BCPack requests are made): main: PR: The menus run at 30 fps on both builds here. During the loading, presents per 2 s stay in the same range: 0–37 on Not tested
AI use
Update: the burst in run 1 matches the race that #549 fixes: a title fills a destination page-array entry after |
290f43a to
a01d6cb
Compare
a01d6cb to
44953c2
Compare
|
@ryosen0 the head moved to 44953c2 (BC7 dictionary tables follow VIctory #658, and a BCPack destination is now size-checked against its mode's block size). Could you rerun the 90 s pair on 44953c2? Your main block at 1c87b1d still stands; it is the PR-side block that needs the current commit. Same On our host the PR-side runs sit at 7-8 fps in the menu against 60 on main, with DirectStorage idle in the steady state and the first BCPack request arriving at t=43 s, so the drop is not decode; your 60 fps at this head is the evidence that it does not generalize. |
BCPack is the console's lossless stage between zlib and swizzle. XCL refused every such request, so streamed textures never loaded. Add the 12/16-lane rANS entropy stage and the block rebuilds for every mode the format defines except BC2, whose lane layout no title data exercises. The decoder and the constant tables are VIctory's, not estimates: 126 retail chunks across all six modes decode byte-for-byte identical to it. BC7's dictionary entries follow VIctory PR ivall#658 (two repeated width bytes, then 16 + 15 indices), and a unit test holds the shipped table to it. Retail streams stay out of the tree; the queue and parity tests read them from XCL_SAMPLE_BCPACK and pass without it. The parity test fails on any case that does not match, not only when every case fails.
44953c2 to
cd03bd9
Compare
|
First AMD / Linux run, on the current head Tested
The stop after loading is the "GPU Loc Sig" one from #505 (30–45 s after the first Not tested: the unit tests or the whole suite under Wine on this head, more than one run per tree, the AI use: T3 Code (Claude Opus 5.5) built both trees, ran the game and wrote this comment from the logs. The runs are real, on the hardware above, and I checked the report before posting. |
xcl-dev#905 decodes BC6H, so the asserts that expected BC6H to be refused failed (requests_are_checked_like_the_console, multi_stage_intermediate_size_validation_and_zlib). BC2 is the mode it still refuses. Assisted-by: Claude Code (Claude Opus 5.5)
|
Follow-up on the current head: the two failures are gone. On
Environment unchanged (Windows 11 10.0.26300, RTX 5090, driver 621.24, Rust 1.100.0 MSVC, debug). AI-assisted (opencode). |
|
For the following commenters, before follow-up. In your first line, in bold. Is this an improvement, neutral, or regression. And why? Is the issue scope, is it entirely the wrong fix, or something else? |
|
Linux / AMD RDNA3 datapoint. Merged state: head Full suite, Not tested: retail titles (none here), Windows, RDNA4. 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 AI use: Hermes agent (local Qwen-class) ran the suite and drafted this; I checked it before posting. |
|
Improvement: on the final head every BCPack request unpacks and the loading-screen artwork draws on an RTX 4070. The title's watchdog crash of #846 ( Tested
The frame dumps show the loading-screen character artwork drawn with correct colours; on Not tested
AI use: Claude Code (Claude Opus 5.5) ran the build, the tests and the title on my machine, read the logs, wrote this report and posted it at my request. |
|
Improvement: on Tested
Not tested
AI use: Claude Code (Claude Opus 5.5) built the trees, ran the tests and both runs, read the logs, |
|
Merged in 67a3735 – thanks, and thanks to everyone who reviewed and ran it. Your commit went in as it is, except its
Also checked: the 128 rANS models of Tested on the merged tree: |
DirectStorage: unpack BCPack BC1, BC3, BC4, BC5, BC6H and BC7 streams
BCPack is the console's lossless stage between zlib and swizzle: 12 or 16 rANS lanes share one byte stream, each block is two references (to the last 256 blocks or a per-format dictionary) plus endpoint and index residuals, and the result is BCn blocks. XCL refused every BCPack request, so titles that stream textures through it never got those textures. This adds the entropy stage and the block rebuilds for every mode the format defines except BC2. It replaces the earlier BC1-only change, which is superseded here.
A stream carries no tables. The model frequencies, the 256 blocks a stream's history starts from, and BC1's 256 quadrant selectors are constants of the format, and the lane schedule is defined against them. The earlier BC1 attempt fitted those constants from sample chunks. It decoded most blocks and was wrong on a few - 0.017% of BC1 bytes against the reference, 5.7% for BC5, 35-75% for BC7, whose blocks almost all reference the unknown history. A wrong constant does not fail a request; it rebuilds plausible but wrong colours into whole 4x4 blocks, and the same stage feeds every mode. The fix is the format's exact tables and the decoder they belong to, not estimates: VIctory's
bcpack-tables.binand itsbcpack.rs, with XCL's hand-set lane widths replaced by the ones the model table is defined against. BC1 now decodes bit-for-bit with the reference on the chunks below. The BC7 dictionary tables follow VIctory PR #658: after the two index widths each entry repeats them and carries 16 + 15 indices, not 32. A unit test holds the shipped table to it (a 0-bit set is empty, pixel 0 is an anchor), and the parity reference was decoded with that fix applied.What is in it
crates/xcl/src/hle/bcpack/victory.rs: decoder ported from VIctory'sbcpack.rscrates/xcl/src/hle/bcpack/tables.rs: format constant tables, generated from VIctory'sbcpack-tables.binbyscripts/gen_bcpack_victory_tables.pycrates/xcl/src/hle/dstorage.rs: BCPack runs between zlib and swizzle; stats inreport.json; failures returnE_DECOMPRESSIONcrates/xcl/tests/bcpack_parity.rs: compares XCL against a reference decoder over retail chunks fromXCL_SAMPLE_BCPACK, passes without itTHIRD_PARTY.md: VIctoryThe change is one unit: the codec and the one call site that uses it. The decoder is 995 lines, the tables are generated and not counted, and the DirectStorage wiring is 92 lines added (248 with its tests); split apart, the first half would be code nothing calls. No game data is in the tree - retail streams for the queue and parity tests come from
XCL_SAMPLE_BCPACK.Tested
cargo test --workspace -- --test-threads=4(722 passed, 0 failed, 41 ignored; skipped: 2 GPU wave32 tests, no wave64 hardware)cargo test -p xcl --lib hle::dstorage::tests::(14 passed, 0 failed)Regression run
main:
PR:
Frame counts from two runs of this title measure which screen the 90 s window lands on, not pacing: the intro UI idles for arbitrary lengths (one run sat on it for 80 s at 0 presents). Inside one scene, this head holds 27-32 presents / 2 s on the last samples, with 412 BCPack requests unpacked and 0 failed; a 512 MB coherent window (fresh data root) is what made an earlier run look slow.
Not tested
AI use