Skip to content

DirectStorage: unpack BCPack BC1, BC3, BC4, BC5, BC6H and BC7 streams - #905

Closed
brandostrong wants to merge 1 commit into
xcl-dev:mainfrom
brandostrong:bcpack-full
Closed

brandostrong wants to merge 1 commit into
xcl-dev:mainfrom
brandostrong:bcpack-full

Conversation

@brandostrong

@brandostrong brandostrong commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

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.bin and its bcpack.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's bcpack.rs
  • crates/xcl/src/hle/bcpack/tables.rs: format constant tables, generated from VIctory's bcpack-tables.bin by scripts/gen_bcpack_victory_tables.py
  • crates/xcl/src/hle/dstorage.rs: BCPack runs between zlib and swizzle; stats in report.json; failures return E_DECOMPRESSION
  • crates/xcl/tests/bcpack_parity.rs: compares XCL against a reference decoder over retail chunks from XCL_SAMPLE_BCPACK, passes without it
  • THIRD_PARTY.md: VIctory

The 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

  • Windows 11, RTX 4090, on cd03bd9: 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)
  • Parity: 126 retail BCPack chunks from six modes (BC1, BC3, BC4, BC5, BC6H, BC7), 22.3 MB decoded, byte-identical to the reference decoder, 0 differing bytes
  • Retail title, 90 s, release: 1754 DirectStorage requests, 178 MB, 0 failed on the last sample; no BCPack refusal logged

Regression run
main:

xcl-smoke v1
commit: 077ce40c3e371cf3df8c57985b1cc6b1db39e75a
gpu: NVIDIA GeForce RTX 4090
title: 419239bf
seconds: 90
exit: 0x0
frames shown: 2287 (PresentX 2287)
presents per 2 s (last 3): 44 8 4
device removals: 0
crashes: 0
peak commit: 25031 MB

PR:

xcl-smoke v1
commit: cd03bd9ddde22b3edceb61933ba8e829336a3270
gpu: NVIDIA GeForce RTX 4090
title: 419239bf
seconds: 90
exit: 0x0
frames shown: 1881 (PresentX 1881)
presents per 2 s (last 3): 14 27 32
device removals: 0
crashes: 0
peak commit: 29683 MB

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

  • AMD; the retail title past the intro UI and world load

AI use

  • Claude Code (Anthropic) wrote the code and the tests

@ettehn

ettehn commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Resolved on 290f43a. On a clean checkout of this head on native Windows, all 14 DirectStorage unit tests passed, including the two BC6H cases below. The single-block synthetic BC7 parity check also passed (16 of 16 bytes identical). This retest covered those two test targets.

Windows retest at d19a3d3. The corrected tables match the regenerated output, the synthetic BC7 reference passes, and deliberately mismatched references now fail the parity test. Both earlier findings are resolved.

Two DirectStorage tests still expect BC6H requests to be rejected. To reproduce, run cargo test -p xcl --lib hle::dstorage::tests:: -- --test-threads=1 on Windows (12 passed, 2 failed). In requests_are_checked_like_the_console and multi_stage_intermediate_size_validation_and_zlib, valid BC6H requests now return Ok(()). I changed those expectations locally and kept explicit BC2 rejection checks for both single-stage and zlib + BCPack requests. Invalid intermediate sizes still expect E_DESTINATION_SIZE. The same command then passed all 14 tests with no production changes. The unmodified head also had four D3D12 test failures in my workspace run. I haven't established their cause.


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 decode(7, &[0x01; 256], 16). The checked-in table produces 80 37 a8 a0 02 05 1c 50 c0 01 05 04 c4 80 f3 20. With the corrected generator and regenerated table it produces 80 37 a8 a0 02 05 1c 50 c0 01 05 04 c0 b0 cc 3c, byte-identical to VIctory's corrected reference. For fill bytes 1 through 63 all streams decoded, the first block changed in 32, and all 63 corrected blocks matched the reference. The table is unchanged at c8e1005.

OpenAI Codex (GPT-6.2 Astra) assisted with verification.

@vladbondarenko97

Copy link
Copy Markdown
Contributor

First retail-title validation: BC1, BC5 and BC7 requests unpack

Built this PR at c8e10056 on an RTX 3080 Ti against the retail 1.0.2.1 package and ran it in session 1. The title now reaches the point where it streams its texture tables, and the decoder produces output:

xcl: DirectStorage: BCPack BC7: first request unpacked (51012 to 65536 bytes)
xcl: DirectStorage: BCPack BC5: first request unpacked (19515 to 65536 bytes)
xcl: DirectStorage: BCPack BC1: first request unpacked (39541 to 65536 bytes)

That BC1 source size, 39541, is the exact request that fails with E_DECOMPRESSION on main (xcl#878's example), so the change is doing what it says on the title that matters.

Context of the run, and the parts that are ours rather than yours:

  • We also carry a local, env-gated skip for the title's packet-stream capacity assert (0x8000_0003 at title+0x4dcbc9d, page-offset test, lands on the enqueue's "packet dropped" path — written up in Retail 1.0.2.1: queue-capacity assert at title+0x4dcbc9d on a complete package (VIctory reproduces it identically) #723); without it the title ends about a minute in and never gets far enough to request BCPack.
  • We added a local XCL_KEYS="<sec>:<key>,..." scripted pad overlay (mirroring VIctory's VICTORY_KEYS) because host-level input injection is blocked here (UIPI), and the frontend needs input to progress.
  • With those, xcl runs 11,000+ frames at 30.0 fps and walks the first-run flow: title screen → Legal Notices / Photosensitivity Health Warning, rendered with its purple background artwork and full text. Before this PR that screen's textures came from refused BCPack requests.

I could not yet check the end-of-run dstorage.bcpack_unpacked counters (the report is written at exit; this run was still going when I looked), and the world load is next on the list now that the frontend advances.

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 swizzle=0 on these requests)?

AI-assisted investigation (Claude Code); all values are from our own retail run, and the title package is unmodified.

@dcastell1

Copy link
Copy Markdown

Two tests fail on this tree on Windows, both from the same change of expectation:

cargo test --workspace -- --test-threads=4
test result: FAILED. 675 passed; 2 failed; 21 ignored   (exit 101)

hle::dstorage::tests::requests_are_checked_like_the_console
  crates\xcl\src\hle\dstorage.rs:1525: assertion `left == right` failed: BCPack BC6H
  left: Ok(()), right: Err(-1994129360)          # 0x89240030
hle::dstorage::tests::multi_stage_intermediate_size_validation_and_zlib
  crates\xcl\src\hle\dstorage.rs:1751: assertion `left == right` failed
  left: Ok(()), right: Err(-1994129360)

Both still expect the BCPack refusal (E_DECOMPRESSION) that this PR removes, so they need the same update the other BCPack rows got — the decoder returns Ok now. The rest of the change is green here: 20 tests that main ignores now run (21 ignored against 41 on main), and nothing else in the workspace changes verdict.

Environment: Windows 11 10.0.26300, NVIDIA GeForce RTX 5090 (driver 621.24), Rust 1.100.0 MSVC 14.44.35207, debug build, main@beaa245 plus this PR applied with patch -p1 (clean, no fuzz). Tree restored afterwards; no game data — the fixtures are synthetic.

AI-assisted (opencode): applied the patch to a built tree, ran the suite, reverted it.

@ryosen0

ryosen0 commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

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 1c87b1d:

xcl-smoke v1
commit: 1c87b1d3d007cb480d0b68e28bcd6da2eb0b5d2e
gpu: NVIDIA GeForce RTX 3060 Ti
title: ScarlettGame
seconds: 90
exit: 0x0
frames shown: 2447 (PresentX 2447)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14483 MB

this PR d19a3d3:

xcl-smoke v1
commit: d19a3d3a727d7b3b63aa9e7487392355d55aa639
gpu: NVIDIA GeForce RTX 3060 Ti
title: ScarlettGame
seconds: 90
exit: 0x0
frames shown: 2444 (PresentX 2444)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14488 MB

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, XCL_NETWORK=0 XCL_ACTIVITY=1), the phase where main logs 128 BCPack refusals (BC1 8 / BC5 100 / BC7 20) every run:

  • with this head: 0 refusals; the log instead shows BCPack BC7: first request unpacked (51012 to 65536 bytes), BC5 … (19515 to 65536), BC1 … (39541 to 65536) at t≈48 s — the exact requests main refuses, now decoded
  • clean exit at the 150 s cap, 4197 frames, steady 60 presents / 2 s to the end, 0 removals, 0 crashes

Tests on this head: cargo test --release -p xcl --lib bcpack -- --test-threads=4 → 8 passed / 0 failed.

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.

@brandostrong

Copy link
Copy Markdown
Contributor Author

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 bcpack-tables.bin with VIctory PR #658: the two repeated width bytes are skipped, then 16 + 15 signed indices with the last Rust slot zero. A unit test checks every entry (a 0-bit set holds no indices, pixel 0 is an anchor). The parity references were re-decoded with the #658 decoder, and all 126 chunks still match byte-for-byte.

Parity verdict. The test now asserts identical == cases and fails on any mismatch. Reproduced your case with two BC1 streams paired with deliberately wrong references: it passed at 0 matches before, and fails 0 vs 1 after the change.

Regression run is still open: an xcl-smoke block on main 1c87b1d and one on the head, plus an A/B of decode on/off, since the earlier launch showed a frame-rate drop once textures decode.

@brandostrong
brandostrong force-pushed the bcpack-full branch 2 times, most recently from b61e162 to 290f43a Compare November 24, 2026 08:38
mastrr9 added a commit to mastrr9/xcl that referenced this pull request Nov 24, 2026
@brandostrong

Copy link
Copy Markdown
Contributor Author

Confirmed - both expectations predate the decoder and our bcpack filter skipped them. Fixed in 290f43a: BC6H single-stage and zlib + BCPack now expect Ok(()); BC2 keeps an explicit E_DECOMPRESSION check in both paths; invalid intermediate sizes still E_DESTINATION_SIZE. cargo test -p xcl --lib hle::dstorage::tests:: is 14/14, and the full --lib run is 680 passed, 0 failed, 21 ignored.

@brandostrong

Copy link
Copy Markdown
Contributor Author

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 bcpack-tables.bin and the decoder is VIctory's, not an approximation. The parity harness decodes 126 retail chunks across BC1/3/4/5/6H/7 and compares byte-for-byte with VIctory's output; it reads streams and references from XCL_SAMPLE_BCPACK (a directory of .bcN + .vicN), so no game data is in the tree.

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 swizzle=0, so the buffer holds what the title asked for.

@brandostrong

Copy link
Copy Markdown
Contributor Author

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 xcl-smoke blocks to name the current head, so they need remaking at 290f43a; the main block can stay at 1c87b1d or move to 077ce40.

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.

@milas6669

Copy link
Copy Markdown
Contributor

Test report on d19a3d3 (PR head) merged onto main 077ce40 (clean merge, release build).

Tested

  • NVIDIA GeForce RTX 3070 (8 GB, 32-lane waves), Intel i9-10900KF, 31.9 GB RAM, Windows 11 Pro 10.0.26200, rustc 1.100.0; retail title, XCL_NETWORK=0, XCL_FRAME_DUMP=120, 4095 MB coherent window, warm caches.
  • cargo test -p xcl --lib bcpack -- --test-threads=4: 8 passed, 0 failed. I did not run the whole suite or tests/bcpack_parity.rs (it needs sample data I do not have).
  • Game run of 150 s on this build: the log shows BCPack BC1, BC5, BC7 and BC6H: first request unpacked, and 0 BCPack ... unsupported / EnqueueRequest: refused lines.
  • The same title on main 1ec4c98 without the PR (130 s run, same machine): 4 BCPack ... mode N unsupported lines (BC1 mode 1, BC5 mode 5, BC7 mode 7 and one more) and 1 refused request.
  • Both builds present a correct picture on the loading screen: I looked at the dumped frames, and frame 2300 of the build without the PR and frames 1100 and 2300 of this build show the same loading-screen artwork, undamaged. So this run does not show a visible difference from the PR; the textures this PR unpacks are not on that screen.

Not tested

AI use

  • Claude Code, Claude Sonnet 5.5, ran the commands and wrote this report.

@brandostrong

Copy link
Copy Markdown
Contributor Author

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.

@AlexLopezDevelop

Copy link
Copy Markdown

Tested d19a3d3 on NVIDIA RTX 2080 Ti (Turing, driver 621.24, 32-wide waves) + Intel i9-9900K, Windows 11, 32 GB, own retail 1.0.2.1 package, cargo build --release -p xcl, walked through the first-run menus by hand: pass for BCPack.

report.json → dstorage after the run:

Format Requests Destination bytes Failed
BC1 2,104 149,319,680 0
BC5 107 7,077,888 0
BC6H 1 1,048,576 0
BC7 193 25,182,208 0

bcpack_refused is empty. On main (09940bb) the same walk logged BCPack BC7/BC5/BC1: mode N unsupported … E_DECOMPRESSION and failed DirectStorage requests (0x89240030); with this PR the log has the three "first request unpacked" lines and no DirectStorage refusal or failure.

The run ended at about 454 s in the title's own fatal-error routine (+0x23cf683, write at 0, right after the first-run setup), the stop in #846. So that stop happens with every BCPack request served too.

Regression run of main on the same machine (unattended, so it stays before the menus and makes no BCPack request):

xcl-smoke v1
commit: 09940bb87fa11bc394fd9e5de570c2b7cfd16323
gpu: NVIDIA GeForce RTX 2080 Ti
title: GTA6.Xbox exported
seconds: 300
exit: 0x0
frames shown: 925 (PresentX 925)
presents per 2 s (last 3): 7 6 7
device removals: 0
crashes: 0
peak commit: 15509 MB

Not tested: the full cargo test suite on this branch; image correctness of the unpacked textures (the frame rate on this card while shaders compile, about 2-3 fps, kept me from looking closely).

AI-assisted (Claude Code, Claude Opus 5.5).

@Xeltax

Xeltax commented Nov 24, 2026 •

Copy link
Copy Markdown

NVIDIA test report for 290f43a (the current head): two world-loading runs merged onto main 077ce40, and a smoke pair at the head itself.

Tested

BCPack. Every BCPack request is now unpacked: report.json's bcpack_refused is empty and bcpack_unpacked has failed: 0. BC7, BC5 and BC1 were first unpacked at ~23.5 s, BC6H at ~58.8 s. The figures below are from report.json dstorage:

main 077ce40 run 1 (290f43a on 077ce40) run 2 (same, plus a local counter)
BC1 / BC5 / BC6H / BC7 requests 2086 / 110 / 1 / 191 refused 2099 / 109 / 1 / 194 unpacked 2081 / 108 / 1 / 195 unpacked
DirectStorage requests failed (whole run) 2388 (= the refusals) 1994 1
abort +0x23cf683 (#505) 109.4 s 111.4 s 108.4 s
peak commit 30 378 MB 35 553 MB 33 418 MB

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 0x89240009 (E_ACCESS_VIOLATION), e.g. 65536 bytes from G:\.\data\ttdb\maps\ttdb_maps_4_7.ttpf and …\weapons\ttdb_weapons.ttpf.

  • bcpack_unpacked.failed only counts decode failures, so these requests may well have unpacked fine and then failed afterwards.
  • Run 2 adds a local counter on each return Err(E_ACCESS_VIOLATION) in dstorage.rs (not pushed anywhere). It had a single failure (32768 bytes of ttdb_terrain_4_7.ttpf, 71.95 s), and it came from the write_physical_pages(...) branch of the destination-physical-pages path.
  • So on this machine the failure is intermittent (1994 vs 1). The one I could place is the write into the title's physical pages, which BCPack requests only reach now that they are unpacked.
  • I can't tell whether run 1's burst comes from the same place: that run had no counter.

Regression run (60 s at the menus, no input, so no BCPack requests are made):

main:

xcl-smoke v1
commit: 077ce40c3e371cf3df8c57985b1cc6b1db39e75a
gpu: NVIDIA GeForce RTX 4080
title: RetailTitle
seconds: 60
exit: 0x0
frames shown: 1657 (PresentX 1657)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 16607 MB

PR:

xcl-smoke v1
commit: 290f43a111f1c89d3f76b254ce914db8291731df
gpu: NVIDIA GeForce RTX 4080
title: RetailTitle
seconds: 60
exit: 0x0
frames shown: 1657 (PresentX 1657)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15984 MB

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 main, 0–54 with the PR. I saw no frame-rate drop from this PR.

Not tested

AI use

  • Claude Code (Claude Opus 5.5) ran the builds and the title on my machine, added the local counter, read the logs and report.json, and wrote this report.

Update: the burst in run 1 matches the race that #549 fixes: a title fills a destination page-array entry after EnqueueRequest, and the worker reaches the request first. It is not something this PR introduces; BCPack requests only reach that path now that they are unpacked.

@brandostrong

Copy link
Copy Markdown
Contributor Author

@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 -Seconds 90 and title.

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.
@ClosetPie107

Copy link
Copy Markdown

First AMD / Linux run, on the current head 44953c2: every BCPack request unpacks, and the loading-screen artwork draws instead of a black screen.

Tested

077ce40 44953c2
BCPack requests refused (E_DECOMPRESSION) 2,048 by 86 s (BC1 1,754, BC5 108, BC7 185, BC6H 1) 0
first request unpacked – BC7, BC5, BC1 at 58.7–59.0 s, BC6H at 85.3 s
loading screen black the artwork, at 30 fps
first ListX #101 / the title's stop at +0x23cf683 92.1 s / 124.7 s 88.2 s / 132.8 s

The stop after loading is the "GPU Loc Sig" one from #505 (30–45 s after the first #101), on both trees. This PR doesn't affect it, and Windows has the same stop. No device removal, no XCL fault.

Not tested: the unit tests or the whole suite under Wine on this head, more than one run per tree, the xcl-smoke pair, Windows.

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.

wondercrash added a commit to wondercrash/xcl that referenced this pull request Nov 24, 2026
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)
@dcastell1

Copy link
Copy Markdown

Follow-up on the current head: the two failures are gone.

On main@077ce40 (baseline 716 passed, 0 failed, 41 ignored on this box) with this PR at cd03bd9dd applied clean:

cargo test --workspace -- --test-threads=4
722 passed; 0 failed; 41 ignored   (exit 0)

requests_are_checked_like_the_console and multi_stage_intermediate_size_validation_and_zlib now expect the Ok the decoder returns, so nothing to chase. Six more passing tests than main here, and still 20 tests that main ignores now run.

Environment unchanged (Windows 11 10.0.26300, RTX 5090, driver 621.24, Rust 1.100.0 MSVC, debug). AI-assisted (opencode).

@brandostrong

Copy link
Copy Markdown
Contributor Author

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?

@SlopTart

Copy link
Copy Markdown

Linux / AMD RDNA3 datapoint.

Merged state: head cd03bd9 onto main 09940bb, clean merge.

Full suite, cargo test --workspace --release --no-fail-fast --target x86_64-pc-windows-gnu -- --test-threads=4: 710 passed, 12 failed, 41 ignored; failures are the known Wine-lane set from my #42 rows plus this rig's title-textures flake family (see #718). BCPack unpack tests green. One caveat: in this lane the threads=4 harness hung once with no output for 21+ minutes and had to be killed; a full threads=1 rerun completes clean (676 passed, 4 failed) and the two dstorage tests that failed in the hung run pass in isolation. Single hang incident, flagging rather than blaming.

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.

@m335671

m335671 commented Nov 24, 2026

Copy link
Copy Markdown

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 (+0x23cf683, "GPU Loc Sig") is unchanged, which is out of this PR's scope.

Tested

  • NVIDIA GeForce RTX 4070 12 GB (driver 32.0.16.2124, 32-lane waves), Ryzen 9 7900, 32 GB RAM, Windows 11 Pro 26300, Rust 1.97.1 MSVC, SDK DXC 1.8.2502.11, release build of cd03bd9 (head, on main 077ce40).
  • cargo test --workspace --no-fail-fast -- --test-threads=4: 722 passed, 0 failed, 41 ignored; SKIPPED (no wave64): gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware.
  • Own retail 1.0.2.1 package, XCL_NETWORK=0, A pressed by XCL_PRESS_A_AT every 4 s from 20 s, XCL_FRAME_DUMP=90, first-run setup already done in earlier runs.

report.json → dstorage: bcpack_refused empty.

Format Requests Destination bytes Failed
BC1 2,074 148,631,552 0
BC5 109 7,208,960 0
BC6H 1 1,048,576 0
BC7 212 32,550,912 0

The frame dumps show the loading-screen character artwork drawn with correct colours; on main 077ce40 the same title logged 256 BCPack refusals (BC1 115, BC5 107, BC7 33, BC6H 1). The title's own crash log reports Game State: Game Running at 1m05 with 561 streaming requests in flight. Then the null write at +0x23cf683 at ~101 s, 1420 frames presented; a main run on this machine (menus walked by hand, no script) hit the same crash at ~104 s with 1391 frames.

Not tested

  • No scripts/smoke.ps1 pair: the two runs above were not made under the same conditions, so they are not a regression check.
  • Parity test (XCL_SAMPLE_BCPACK not set); AMD; anything past the watchdog crash.

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.

@zohaiblazuli

Copy link
Copy Markdown
Contributor

Improvement: on cd03bd9 merged onto today's main 9aec53d, every BCPack request unpacks (178, 0 failed, 0 refused) on an RTX 3060, and the world load keeps reading after the point where main stops. The load does not finish within 300 s on either build, so this run cannot say whether it completes.

Tested

  • NVIDIA GeForce RTX 3060 12 GB (driver 32.0.16.1742, 32-lane waves), Intel Core i5-14600K, Windows 11 build 26300, rustc 1.94.0 MSVC; debug for the tests, release for the runs.
  • Tree: main 9aec53d with this PR's head cd03bd9 merged (2e2de39, clean merge).
  • cargo test --workspace -- --test-threads=4: 730 passed, 0 failed, 41 ignored (for comparison, 9aec53d plus a one-assertion change with no new tests: 724 passed, 0 failed, 41 ignored). SKIPPED: gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware (no wave64).
  • Retail title, own package, first-run setup already done, warm caches. Both builds run the same way: XCL_NETWORK=0 XCL_RUN_SECONDS=300 XCL_ACTIVITY=1 XCL_FRAME_DUMP=300, XCL_PRESS_A_AT every 10 s from 15 s to 295 s.
main 9aec53d 9aec53d + cd03bd9
Exit, device removals, crashes 0x0, 0, 0 0x0, 0, 0
Frames shown in 300 s 8606 8578
Peak commit 16 439 MB 17 732 MB
BCPack 128 refused (BC1 8, BC5 100, BC7 20) 178 unpacked, 0 failed: BC1 51 (946 176 B), BC5 104 (6 971 392 B), BC7 23 (3 117 056 B)
First BCPack request t = 127 s t = 160 s
DirectStorage after the first BCPack request none after t ≈ 140 s keeps reading: 1049 requests / 33 MB at t ≈ 160 s, 270 requests / 39 MB at t ≈ 280 s
Screen at 300 s (frame dump) loading-screen artwork loading-screen artwork
  • The first BCPack requests are the same streams as in other reports (51012 → 65536 BC7, 19515 → 65536 BC5, 39541 → 65536 BC1).
  • On this build the whole run is about 33 s later than on main: intro artwork at t ≈ 103 s instead of ≈ 70 s, first BCPack request at 160 s instead of 127 s. I did not look into why; it was one run of each.

Not tested

  • Whether the world load finishes (both runs end on the loading screen at 300 s), and so the correctness of the unpacked textures in game.
  • tests/bcpack_parity.rs with XCL_SAMPLE_BCPACK (I have no reference samples).
  • More than one run per build; AMD; the PR head on its own (only merged onto 9aec53d).

AI use: Claude Code (Claude Opus 5.5) built the trees, ran the tests and both runs, read the logs, report.json and frame dumps, and wrote this report. The numbers come from those runs.

@upipibi upipibi mentioned this pull request Nov 24, 2026
ivall added a commit that referenced this pull request Nov 24, 2026
@ivall

ivall commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator

Merged in 67a3735 – thanks, and thanks to everyone who reviewed and ran it. Your commit went in as it is, except its HANDOFF.md edit (that file is the maintainer's notes). Two commits on top:

  • 8add9a3 – provenance: VIctory's author allowed its use in XCL under GPL-2.0-only; THIRD_PARTY.md and the decoder's header say so, with the project's URL. Request::check is the enqueue check again instead of a test-only wrapper of check_with_bc1. A README row for DirectStorage / BCPack; scripts/test.ps1 lists XCL_SAMPLE_BCPACK.
  • 10915eb – a test that a stream decodes without game data: the 14 synthetic fixtures of DirectStorage: BCPack entropy stage for all modes, not yet called #208 (made by an encoder written from the format notes, all six modes, up to 64 KiB) go through the lane stage and give their symbols; with 7 bytes per schedule round instead of 8 it fails. The 8-bit model 11 is checked against the table printed in US 11,234,023.

Also checked: the 128 rANS models of bcpack-tables.bin are number for number those of Microsoft's silicon-rans sample (MIT); 72,000 random streams in all six modes (release and debug) decode or fail without a panic.

Tested on the merged tree: cargo test --workspace --no-fail-fast -- --test-threads=4: 735 passed, 0 failed, 41 ignored, no SKIPPED. Retail title, 90 s with scripted presses, against main the same way: BCPack refusals BC1 2115 / BC5 108 / BC6H 1 / BC7 189 → none; unpacked BC1 2096, BC5 111, BC6H 1, BC7 187, 0 failed; no crash, no device removal; peak process commit 29.0 GB on main, 29.7 GB with the PR.

@ivall ivall closed this Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.