DirectStorage: BCPack BC1 requests are unpacked, tables from bcpack-rs #273

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

@⁠Kalmarv on GitHub · 2026-11-23 22:16 UTC · original
Kalmarv:feat/bcpack-bc1 → main · +1794 −29 · 45 files · 2 commits · closed without merging

Stacked on #208. With this PR, DirectStorage unpacks BCPack BC1 requests, alone or after zlib, instead of refusing them. The BC1 blocks are rebuilt from #208's lanes with two tables of constants that no stream carries; XCL takes the estimates bcpack-rs made of them. BC3–BC7 requests are refused and counted as on main.

This is the second half of #208's earlier form (a7ffb2f), which a tester ran on a retail title (below). One commit, ce8839b, on #208's 42c90e0, which is on main 9ce2070; GitHub shows both commits until #208 is merged. Both were rebased from 5f12643 and 34c0ee5 on 9ab7d76, without conflicts and without a changed line (git range-diff: both commits =).

What is in it

  • hle/bcpack/bc1.rs: BC1 blocks from the 12 lanes. A back-reference for the endpoints, six zigzag differences, and four 2×2 selector quadrants through a codebook. It follows the BC1 sections of the format notes of bcpack-decoder and bcpack-rs, both MIT. No code was taken from either. The file's header names both, with URL and licence.
  • hle/bcpack/bc1_fitted.rs: the two tables, which no specification publishes. One is the 255 endpoint sets a stream starts with; the other is the order of the 256 quadrants.
    • bcpack-rs estimated both from retail data. They are constants of the codec, not content of a game.
    • The file is generated, not written: python scripts/gen_bcpack_bc1_tables.py <bcpack-rs>/data/bc1_window.json <bcpack-rs>/data/bc1_quad_table.json (bcpack-rs at c51ec52; the script is in this PR). The file carries bcpack-rs's MIT notice.
  • hle/bcpack/mod.rs: decode(mode, bytes, len) (lanes, then blocks), and the errors lane 1 and unknown history.
  • hle/dstorage.rs: a BC1 request runs the BCPack stage after zlib, or alone.
    • A stream the decoder does not take fails the request with E_DECOMPRESSION and writes nothing, as a refusal does.
    • The log has one line on the first unpacked request of a mode, one warning per mode and kind of failure, then a running count.
    • XCL_DSTORAGE_BCPACK_FILL now applies to the refused modes only.
  • report.rs: report.json gets dstorage.bcpack_unpacked per mode, with requests, destination_bytes (bytes of blocks rebuilt) and failed.
  • tests/data/bcpack/*.bc1: the blocks of #208's BC1 fixtures, from the same independent encoder.
  • THIRD_PARTY.md:
    • the format-notes row now names the BC1 block rule too;
    • a new row covers bcpack-rs's tables (bc1_fitted.rs, generated by the script above).

Tested

  • RTX 5070 Ti, NVIDIA 610.74, Ryzen 9 9950X, Windows 11 Pro 25H2 (build 26200.9711), Rust 1.99.0, debug build.
  • cargo test --workspace -- --test-threads=4 on ce8839b: 692 passed, 0 failed, 41 ignored, with #208's commit under it (the xcl library: 652 passed, 21 ignored). SKIPPED GPU tests: gpu_geometry_wave32_prefix_count_over_a_mask and gpu_wave32_program_in_wave64_hardware, both "no wave64".
  • cargo test -p xcl --lib bcpack on ce8839b: 11 passed, 0 failed. cargo build -p xcl gives one warning, in hle/xgameruntime/mod.rs, which this PR does not touch.
  • Retail run, by @⁠Cattn: RTX 4070, Ryzen 7 7800X3D, Windows 11, release build.
    • What they ran: #208's earlier form at a7ffb2f, merged onto main 60565c4 plus #215. "Without" is the same branch before the merge.
    • The run: the same scripted run up to the intro, 170 s each, with report.json's dstorage.bcpack_refused compared.
    • This PR stacked on #208 makes the same change as a7ffb2f. git diff 6da33fa a7ffb2f and git diff 9ab7d76 5f12643 differ only in the provenance comments of lanes.rs and bc1.rs, which now carry the sources' URLs; no code line differs. git diff 9ce2070 ce8839b, the stack as rebased, has the same changed lines as git diff 9ab7d76 5f12643. main has moved since, so it is the same change but not the same build.
mode without with
BC1 1,492 requests (76.0 MB) 0
BC5 108 (7.1 MB) 108
BC6H 1 (1.0 MB) 1
BC7 155 (19.0 MB) 118
  • More from that run:

    • The log shows BCPack BC1: first request unpacked (39541 to 65536 bytes), and one BC1 stream was not unpacked (BCPack BC1 streams not unpacked so far: 1).
    • There was no crash or device removal in the 170 s; XCL_RUN_SECONDS ended the run.
    • Their cargo test --release -p xcl --lib bcpack: 11 passed.
    • There was no visible difference in the intro: its picture area is still one flat dark colour, so something else is in the way there.
    • So in that run, all BC1 streams but one passed the entropy stage with every lane in a legal end state, each read as one stream per request.
  • Retail run, by @⁠vibryxcx (https://github.com/ivall/xcl/pull/273#issuecomment-7119213477): RX 6800 (RDNA2, driver 32.0.21045.5002), Core i5-10600KF, Windows 11 26200, Rust 1.100.0, release.

    • What they ran: main 508a0c7, this PR's earlier head 5f12643 (then on main 9ab7d76), and 5f12643 merged into 508a0c7 (no conflicts).
    • cargo test --workspace -- --test-threads=4 on 5f12643: 659 passed, 0 failed, 40 ignored, no SKIPPED GPU tests.
    • 150 s with scripted presses, through the intro into the menus, main against the merge: BC1 6 refused (393,216 bytes) to 6 unpacked, 0 failed; BC5 100 and BC7 20 refused in both; failed DirectStorage requests 126 to 120; 817 and 736 frames; peak commit 15,612 and 15,593 MB; no crash or device removal. One run of each.
    • 75 s, scripts/smoke.ps1: main 1562 frames, 5f12643 on its own 30 frames (1 present per 2 s), the merge 1544 frames. So the slowdown came from the older base, and that head failed the 80 % frames rule against main. This is why the PR is rebased; the rebased head has not been run on that card.
    • A 75 s run with one press makes no BCPack request on that title, so it does not reach the change.
  • Retail run, by @⁠0klavair (https://github.com/ivall/xcl/pull/273#issuecomment-7119709460): RTX 5060 8 GB (driver 621.01), Ryzen 9 5950X, 32 GB RAM, Windows 11 23H2 (22631), rustc 1.94.1, release.

    • What they ran: main 508a0c7 against 508a0c7 with 5f12643 merged in, into world loading, with warm caches. Both builds also carry a one-line launcher fix of theirs, outside DirectStorage.
    • BC1: 2,174 requests refused (151.2 MB) on main; with the PR none refused, 1,913 unpacked (142.6 MB) and 1 failed. The failure is BC1 block 0 refers to the unknown history entry 4, the entry listed as not known below.
    • BC5 108 and BC6H 1 refused in both; BC7 198 and 180 refused.
    • Both runs end in the same access violation (+0x23cf683) after about 5 min 25 s, the stop of #505 / #232, and show nothing past the loading screen. So the PR did not change where or when the run ends.
  • What the tests show, all on synthetic data:

    • bc1_fixtures_decode_to_their_blocks: #208's independent BC1 fixtures decode to their blocks.
    • bc1_block_rebuild: one block by hand, every field.
    • fitted_bc1_tables_are_well_formed: every quadrant appears once, the ranges hold, and one block goes through the shipped tables.
    • bcpack_bc1_requests_are_unpacked_alone_and_after_zlib: seven requests through a memory queue.
      • BC1 alone; zlib + BC1 with and without IntermediateSize.
      • A wrong IntermediateSize, a cut stream and a wrong block count; these three fail and write nothing.
      • The same bytes without the BCPack bit, as a control.
    • main's BCPack refusal tests now use BC3 / BC7 where they used BC1.
  • With the fitted tables, five BC1 streams (8,926 blocks) give byte-identical blocks here and in bcpack-rs's CLI.

  • Mutations of the earlier form, each failing at least one of these tests:

    • BC1 rows mirrored;
    • delta sign;
    • back-reference folding;
    • BCPack stage skipped in execute;
    • IntermediateSize not compared.

    #208 lists its other six.

Known to be approximate or assumed:

  • The BC1 tables are estimates. Per bcpack-rs:

    • One history entry (slot 4) was never seen and is not known. A block that refers to it fails the request.
    • 17 entries differ by a step or so between fits on two halves of its data.
    • 8 rare quadrants may be swapped with their mirror.

    A wrong history entry gives a slightly wrong colour in the blocks that refer to it and in the ones chained to them. bcpack-rs reports a median 35.4 dB against the next mip level, where 37.9 dB is the ceiling of that measure.

  • BC1 lane 1 is 0 in every stream the notes describe. A stream where it is not is refused (lane 1); bcpack-rs ignores it instead.

  • One request is taken to be one stream that unpacks to DestinationSize bytes.

  • IntermediateSize 0 with zlib + BCPack is accepted; zlib may then yield any size up to the destination's. The GDK documents the field as the size of the stream BCPack reads. What a console does with 0 was not tested.

  • The blocks are written in stream order. Requests with a swizzle mode are still refused.

Overlaps:

  • #233 (@⁠Yeetbot159) also unpacks BCPack BC1 requests in hle/dstorage.rs, so the two conflict there. It is opt-in (XCL_DSTORAGE_BCPACK_BC1=1) and takes the decoder from the bcpack-rs crate, a git dependency pinned to c51ec52 (MIT). It handles BC1 alone and zlib → BC1, into virtual or physical-page destinations. It rejects malformed streams, unknown lane-1 symbols and unfitted entries. It also changes the window title (present.rs, pso_async.rs), and its run on a title saw no BCPack request. This PR differs as follows:
    • it adds no dependency: it carries its own decoder (#208) and BC1 rebuild, credited in the files and in THIRD_PARTY.md, and takes only bcpack-rs's two generated tables;
    • BC1 is on by default;
    • it sits on #208's entropy stage, which covers all six modes;
    • it has a retail run, above (BC1 refusals 1,492 → 0);
    • on #208's fixtures its blocks are byte-identical to bcpack-rs's.
  • #289 (@⁠theaustinayers) also edited execute in hle/dstorage.rs: a destination page-array entry that is 0 at enqueue is read again at the request's turn. It is merged and is in 9ce2070; the rebase onto it had no conflict. Its change is in the physical-page write; this PR's is in the stages before it (zlib, then BCPack). A BC1 request into physical pages now goes through #289's late read too; that combination is not tested.
  • #340 (@⁠NiiRoZz, BC3 / BC4 / BC5 block rebuilds) is stacked on this PR's earlier head 5f12643, so it needs a rebase onto ce8839b. Other open PRs that touch hle/dstorage.rs (#487, #501, #509, #549, #561) merge with ce8839b without conflicts (git merge-tree).
  • HANDOFF.md says "BCPack (and other console formats) are refused". With this PR that holds for every mode but BC1. docs/specs/2026-11-20-xcl-design.md names BCPack as having "no public decoder (risk)". Neither is edited here.
  • Run by @⁠ExMoha on a retail title (RX 9070, Ryzen 7 7800X3D, Windows 11 26300, release; https://github.com/ivall/xcl/pull/273#issuecomment-7117408211):
    • scripts/smoke.ps1, 60 s, no input: main 9ab7d76 1505 frames, peak commit 14902 MB; this PR 5f12643 1503 frames, 14883 MB; exit 0x0, 0 device removals and 0 crashes in both.
    • Scripted menus, main 85bdf21 against it with 5f12643 merged: BC1 refusals 114 (3,383,296 bytes) to none, BCPack BC1: first request unpacked in the log; failed DirectStorage requests 220 to 26. BC5 and BC7 requests are still refused.
    • cargo test --workspace -- --test-threads=4 on 5f12643: 659 passed, 0 failed, 40 ignored, no SKIPPED GPU tests (RDNA4).
  • Earlier smoke runs by @⁠ExMoha, RX 9070, release, 60 s, on main 9ab7d76 and this head: 1505 frames on main, no crash or device removal on either (https://github.com/ivall/xcl/pull/273#issuecomment-7117408211).

Regression run

Our own runs, one after the other on the machine under Tested (RTX 5070 Ti), release builds, no uncommitted changes.

main:

xcl-smoke v1
commit: 9ce2070eccf436d7bd38601c90407da447df34f3
gpu: NVIDIA GeForce RTX 5070 Ti
title: ea3b5e4d
seconds: 60
exit: 0x0
frames shown: 1605 (PresentX 1605)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14423 MB

PR:

xcl-smoke v1
commit: ce8839b938e06767379be0cc1f84f366a5609bb3
gpu: NVIDIA GeForce RTX 5070 Ti
title: ea3b5e4d
seconds: 60
exit: 0x0
frames shown: 1544 (PresentX 1544)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14554 MB

Not tested

  • The smoke runs above are a regression check: on this title a run without input makes no BCPack request in its first 75 s (@⁠vibryxcx's report, under Tested). @⁠Cattn's run predates scripts/smoke.ps1, was of a7ffb2f, and is not a substitute for it.
  • Whether BC1 textures look right in a title. That is the only check of the block rule and the fitted tables, and the retail run's intro showed no visible difference.
  • Which BC1 stream failed in that run, and why (the log's warning line was not part of the report).
  • The physical-page destination path with a BCPack request. It shares the write code that physical_page_destinations_and_sources covers.
  • A stream that spans several requests, or several streams in one request, if titles do that.
  • BC3–BC7 block rebuild.

AI use

  • Claude Code (Claude Fable 5.2), the BC1 rebuild, wiring, tests and first description; Codex (GPT-6.2 Astra), the independent fixtures' encoder and a review; Claude Code (Claude Opus 5.5), the split and this description
**@⁠Kalmarv** on GitHub · 2026-11-23 22:16 UTC · [original](https://github.com/xcl-dev/xcl/pull/273) `Kalmarv:feat/bcpack-bc1` → `main` · +1794 −29 · 45 files · 2 commits · closed without merging Stacked on #208. With this PR, DirectStorage unpacks BCPack BC1 requests, alone or after zlib, instead of refusing them. The BC1 blocks are rebuilt from #208's lanes with two tables of constants that no stream carries; XCL takes the estimates bcpack-rs made of them. BC3–BC7 requests are refused and counted as on `main`. This is the second half of #208's earlier form (`a7ffb2f`), which a tester ran on a retail title (below). One commit, `ce8839b`, on #208's `42c90e0`, which is on `main` `9ce2070`; GitHub shows both commits until #208 is merged. Both were rebased from `5f12643` and `34c0ee5` on `9ab7d76`, without conflicts and without a changed line (`git range-diff`: both commits `=`). **What is in it** - `hle/bcpack/bc1.rs`: BC1 blocks from the 12 lanes. A back-reference for the endpoints, six zigzag differences, and four 2×2 selector quadrants through a codebook. It follows the BC1 sections of the format notes of [bcpack-decoder](https://github.com/Tim0219800/bcpack-decoder) and [bcpack-rs](https://github.com/Ahmet-Dedeler/bcpack-rs), both MIT. No code was taken from either. The file's header names both, with URL and licence. - `hle/bcpack/bc1_fitted.rs`: the two tables, which no specification publishes. One is the 255 endpoint sets a stream starts with; the other is the order of the 256 quadrants. - bcpack-rs estimated both from retail data. They are constants of the codec, not content of a game. - The file is generated, not written: `python scripts/gen_bcpack_bc1_tables.py <bcpack-rs>/data/bc1_window.json <bcpack-rs>/data/bc1_quad_table.json` (bcpack-rs at c51ec52; the script is in this PR). The file carries bcpack-rs's MIT notice. - `hle/bcpack/mod.rs`: `decode(mode, bytes, len)` (lanes, then blocks), and the errors `lane 1` and `unknown history`. - `hle/dstorage.rs`: a BC1 request runs the BCPack stage after zlib, or alone. - A stream the decoder does not take fails the request with `E_DECOMPRESSION` and writes nothing, as a refusal does. - The log has one line on the first unpacked request of a mode, one warning per mode and kind of failure, then a running count. - `XCL_DSTORAGE_BCPACK_FILL` now applies to the refused modes only. - `report.rs`: `report.json` gets `dstorage.bcpack_unpacked` per mode, with `requests`, `destination_bytes` (bytes of blocks rebuilt) and `failed`. - `tests/data/bcpack/*.bc1`: the blocks of #208's BC1 fixtures, from the same independent encoder. - `THIRD_PARTY.md`: - the format-notes row now names the BC1 block rule too; - a new row covers bcpack-rs's tables (`bc1_fitted.rs`, generated by the script above). **Tested** - RTX 5070 Ti, NVIDIA 610.74, Ryzen 9 9950X, Windows 11 Pro 25H2 (build 26200.9711), Rust 1.99.0, debug build. - `cargo test --workspace -- --test-threads=4` on `ce8839b`: 692 passed, 0 failed, 41 ignored, with #208's commit under it (the `xcl` library: 652 passed, 21 ignored). SKIPPED GPU tests: `gpu_geometry_wave32_prefix_count_over_a_mask` and `gpu_wave32_program_in_wave64_hardware`, both "no wave64". - `cargo test -p xcl --lib bcpack` on `ce8839b`: 11 passed, 0 failed. `cargo build -p xcl` gives one warning, in `hle/xgameruntime/mod.rs`, which this PR does not touch. - **Retail run, by @⁠Cattn**: RTX 4070, Ryzen 7 7800X3D, Windows 11, release build. - What they ran: #208's earlier form at `a7ffb2f`, merged onto `main` `60565c4` plus #215. "Without" is the same branch before the merge. - The run: the same scripted run up to the intro, 170 s each, with `report.json`'s `dstorage.bcpack_refused` compared. - This PR stacked on #208 makes the same change as `a7ffb2f`. `git diff 6da33fa a7ffb2f` and `git diff 9ab7d76 5f12643` differ only in the provenance comments of `lanes.rs` and `bc1.rs`, which now carry the sources' URLs; no code line differs. `git diff 9ce2070 ce8839b`, the stack as rebased, has the same changed lines as `git diff 9ab7d76 5f12643`. `main` has moved since, so it is the same change but not the same build. | mode | without | with | |---|---|---| | BC1 | 1,492 requests (76.0 MB) | **0** | | BC5 | 108 (7.1 MB) | 108 | | BC6H | 1 (1.0 MB) | 1 | | BC7 | 155 (19.0 MB) | 118 | - More from that run: - The log shows `BCPack BC1: first request unpacked (39541 to 65536 bytes)`, and one BC1 stream was not unpacked (`BCPack BC1 streams not unpacked so far: 1`). - There was no crash or device removal in the 170 s; `XCL_RUN_SECONDS` ended the run. - Their `cargo test --release -p xcl --lib bcpack`: 11 passed. - There was no visible difference in the intro: its picture area is still one flat dark colour, so something else is in the way there. - So in that run, all BC1 streams but one passed the entropy stage with every lane in a legal end state, each read as one stream per request. - **Retail run, by @⁠vibryxcx** (https://github.com/ivall/xcl/pull/273#issuecomment-7119213477): RX 6800 (RDNA2, driver 32.0.21045.5002), Core i5-10600KF, Windows 11 26200, Rust 1.100.0, release. - What they ran: `main` `508a0c7`, this PR's earlier head `5f12643` (then on `main` `9ab7d76`), and `5f12643` merged into `508a0c7` (no conflicts). - `cargo test --workspace -- --test-threads=4` on `5f12643`: 659 passed, 0 failed, 40 ignored, no SKIPPED GPU tests. - 150 s with scripted presses, through the intro into the menus, `main` against the merge: BC1 6 refused (393,216 bytes) to 6 unpacked, 0 failed; BC5 100 and BC7 20 refused in both; failed DirectStorage requests 126 to 120; 817 and 736 frames; peak commit 15,612 and 15,593 MB; no crash or device removal. One run of each. - 75 s, `scripts/smoke.ps1`: `main` 1562 frames, `5f12643` on its own 30 frames (1 present per 2 s), the merge 1544 frames. So the slowdown came from the older base, and that head failed the 80 % frames rule against `main`. This is why the PR is rebased; the rebased head has not been run on that card. - A 75 s run with one press makes no BCPack request on that title, so it does not reach the change. - **Retail run, by @⁠0klavair** (https://github.com/ivall/xcl/pull/273#issuecomment-7119709460): RTX 5060 8 GB (driver 621.01), Ryzen 9 5950X, 32 GB RAM, Windows 11 23H2 (22631), rustc 1.94.1, release. - What they ran: `main` `508a0c7` against `508a0c7` with `5f12643` merged in, into world loading, with warm caches. Both builds also carry a one-line launcher fix of theirs, outside DirectStorage. - BC1: 2,174 requests refused (151.2 MB) on `main`; with the PR none refused, 1,913 unpacked (142.6 MB) and 1 failed. The failure is `BC1 block 0 refers to the unknown history entry 4`, the entry listed as not known below. - BC5 108 and BC6H 1 refused in both; BC7 198 and 180 refused. - Both runs end in the same access violation (`+0x23cf683`) after about 5 min 25 s, the stop of #505 / #232, and show nothing past the loading screen. So the PR did not change where or when the run ends. - What the tests show, all on synthetic data: - `bc1_fixtures_decode_to_their_blocks`: #208's independent BC1 fixtures decode to their blocks. - `bc1_block_rebuild`: one block by hand, every field. - `fitted_bc1_tables_are_well_formed`: every quadrant appears once, the ranges hold, and one block goes through the shipped tables. - `bcpack_bc1_requests_are_unpacked_alone_and_after_zlib`: seven requests through a memory queue. - BC1 alone; zlib + BC1 with and without `IntermediateSize`. - A wrong `IntermediateSize`, a cut stream and a wrong block count; these three fail and write nothing. - The same bytes without the BCPack bit, as a control. - `main`'s BCPack refusal tests now use BC3 / BC7 where they used BC1. - With the fitted tables, five BC1 streams (8,926 blocks) give byte-identical blocks here and in bcpack-rs's CLI. - Mutations of the earlier form, each failing at least one of these tests: - BC1 rows mirrored; - delta sign; - back-reference folding; - BCPack stage skipped in `execute`; - `IntermediateSize` not compared. #208 lists its other six. Known to be approximate or assumed: - **The BC1 tables are estimates.** Per bcpack-rs: - One history entry (slot 4) was never seen and is not known. A block that refers to it fails the request. - 17 entries differ by a step or so between fits on two halves of its data. - 8 rare quadrants may be swapped with their mirror. A wrong history entry gives a slightly wrong colour in the blocks that refer to it and in the ones chained to them. bcpack-rs reports a median 35.4 dB against the next mip level, where 37.9 dB is the ceiling of that measure. - **BC1 lane 1** is 0 in every stream the notes describe. A stream where it is not is refused (`lane 1`); bcpack-rs ignores it instead. - **One request is taken to be one stream** that unpacks to `DestinationSize` bytes. - `IntermediateSize` 0 with zlib + BCPack is accepted; zlib may then yield any size up to the destination's. The GDK documents the field as the size of the stream BCPack reads. What a console does with 0 was not tested. - The blocks are written in stream order. Requests with a swizzle mode are still refused. Overlaps: - **#233** (@⁠Yeetbot159) also unpacks BCPack BC1 requests in `hle/dstorage.rs`, so the two conflict there. It is opt-in (`XCL_DSTORAGE_BCPACK_BC1=1`) and takes the decoder from the bcpack-rs crate, a git dependency pinned to c51ec52 (MIT). It handles BC1 alone and zlib → BC1, into virtual or physical-page destinations. It rejects malformed streams, unknown lane-1 symbols and unfitted entries. It also changes the window title (`present.rs`, `pso_async.rs`), and its run on a title saw no BCPack request. This PR differs as follows: - it adds no dependency: it carries its own decoder (#208) and BC1 rebuild, credited in the files and in `THIRD_PARTY.md`, and takes only bcpack-rs's two generated tables; - BC1 is on by default; - it sits on #208's entropy stage, which covers all six modes; - it has a retail run, above (BC1 refusals 1,492 → 0); - on #208's fixtures its blocks are byte-identical to bcpack-rs's. - **#289** (@⁠theaustinayers) also edited `execute` in `hle/dstorage.rs`: a destination page-array entry that is 0 at enqueue is read again at the request's turn. It is merged and is in `9ce2070`; the rebase onto it had no conflict. Its change is in the physical-page write; this PR's is in the stages before it (zlib, then BCPack). A BC1 request into physical pages now goes through #289's late read too; that combination is not tested. - **#340** (@⁠NiiRoZz, BC3 / BC4 / BC5 block rebuilds) is stacked on this PR's earlier head `5f12643`, so it needs a rebase onto `ce8839b`. Other open PRs that touch `hle/dstorage.rs` (#487, #501, #509, #549, #561) merge with `ce8839b` without conflicts (`git merge-tree`). - `HANDOFF.md` says "BCPack (and other console formats) are refused". With this PR that holds for every mode but BC1. `docs/specs/2026-11-20-xcl-design.md` names BCPack as having "no public decoder (risk)". Neither is edited here. - Run by @⁠ExMoha on a retail title (RX 9070, Ryzen 7 7800X3D, Windows 11 26300, release; https://github.com/ivall/xcl/pull/273#issuecomment-7117408211): - `scripts/smoke.ps1`, 60 s, no input: `main` `9ab7d76` 1505 frames, peak commit 14902 MB; this PR `5f12643` 1503 frames, 14883 MB; exit 0x0, 0 device removals and 0 crashes in both. - Scripted menus, `main` `85bdf21` against it with `5f12643` merged: BC1 refusals 114 (3,383,296 bytes) to none, `BCPack BC1: first request unpacked` in the log; failed DirectStorage requests 220 to 26. BC5 and BC7 requests are still refused. - `cargo test --workspace -- --test-threads=4` on `5f12643`: 659 passed, 0 failed, 40 ignored, no SKIPPED GPU tests (RDNA4). - Earlier smoke runs by @⁠ExMoha, RX 9070, release, 60 s, on `main` `9ab7d76` and this head: 1505 frames on `main`, no crash or device removal on either (https://github.com/ivall/xcl/pull/273#issuecomment-7117408211). **Regression run** Our own runs, one after the other on the machine under **Tested** (RTX 5070 Ti), release builds, no uncommitted changes. main: ``` xcl-smoke v1 commit: 9ce2070eccf436d7bd38601c90407da447df34f3 gpu: NVIDIA GeForce RTX 5070 Ti title: ea3b5e4d seconds: 60 exit: 0x0 frames shown: 1605 (PresentX 1605) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14423 MB ``` PR: ``` xcl-smoke v1 commit: ce8839b938e06767379be0cc1f84f366a5609bb3 gpu: NVIDIA GeForce RTX 5070 Ti title: ea3b5e4d seconds: 60 exit: 0x0 frames shown: 1544 (PresentX 1544) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14554 MB ``` **Not tested** - The smoke runs above are a regression check: on this title a run without input makes no BCPack request in its first 75 s (@⁠vibryxcx's report, under **Tested**). @⁠Cattn's run predates `scripts/smoke.ps1`, was of `a7ffb2f`, and is not a substitute for it. - Whether BC1 textures look right in a title. That is the only check of the block rule and the fitted tables, and the retail run's intro showed no visible difference. - Which BC1 stream failed in that run, and why (the log's warning line was not part of the report). - The physical-page destination path with a BCPack request. It shares the write code that `physical_page_destinations_and_sources` covers. - A stream that spans several requests, or several streams in one request, if titles do that. - BC3–BC7 block rebuild. **AI use** - Claude Code (Claude Fable 5.2), the BC1 rebuild, wiring, tests and first description; Codex (GPT-6.2 Astra), the independent fixtures' encoder and a review; Claude Code (Claude Opus 5.5), the split and this description
The rANS lanes a BCPack stream is split into, for BC1, BC3, BC4, BC5,
BC6H and BC7: a port of the decoder module of Microsoft's silicon-rans
sample (MIT), with the byte feeder and symbol release after the format
notes of bcpack-decoder and bcpack-rs (MIT, no code taken). The 128
static models are generated by scripts/gen_bcpack_tables.py from the
sample. Nothing calls it yet; DirectStorage still refuses BCPack
requests. Tested against fixtures from an encoder written independently
from the notes (tests/data/bcpack/generate.py) and a round-trip encoder.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
BC1 blocks are rebuilt from the 12 lanes of the entropy stage (bc1.rs,
after the BC1 sections of the bcpack-decoder and bcpack-rs format
notes, MIT, no code taken). The rebuild needs two tables of constants
that no stream carries: the 255 endpoint sets a stream starts with and
the order of the 256 selector quadrants. bcpack-rs by Ahmet Dedeler
(https://github.com/Ahmet-Dedeler/bcpack-rs, MIT) estimated both from
retail data; bc1_fitted.rs is generated from its data files by
scripts/gen_bcpack_bc1_tables.py and carries its MIT notice. The
constants belong to the codec, not to a game.

dstorage.rs runs the BCPack stage for BC1, alone or after zlib; every
other mode is refused and counted as before. A stream the decoder does
not take fails the request with E_DECOMPRESSION and writes nothing.
report.json gets dstorage.bcpack_unpacked per mode (requests, bytes
rebuilt, failed).

The output is an approximation where an estimate is off: one history
entry is not known (a block that refers to it fails the request), 17
differ by a step or so between fits on two halves of the data, and 8
rare quadrants may be swapped with their mirror.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:18:22 +00:00
github-bot closed this pull request 2026-11-26 04:18:22 +00:00
Author
Owner

@⁠Kalmarv on GitHub · 2026-11-23 22:39 UTC · original

@⁠Cattn your run of a7ffb2f (BC1 refusals 1,492 → 0) is in the description; this PR is the same code. For the merge rules it now needs a regression run: if you can run scripts/smoke.ps1 -Game <your title folder> twice, once built from main (9ab7d76) and once from this PR's head (5f12643), please paste both xcl-smoke blocks here. I'll copy them into the description under Regression run, with your name and hardware. We have no title on our machine.

🤖 Claude Opus 5.5

**@⁠Kalmarv** on GitHub · 2026-11-23 22:39 UTC · [original](https://github.com/xcl-dev/xcl/pull/273#issuecomment-7116021399) @⁠Cattn your run of `a7ffb2f` (BC1 refusals 1,492 → 0) is in the description; this PR is the same code. For the merge rules it now needs a **regression run**: if you can run `scripts/smoke.ps1 -Game <your title folder>` twice, once built from `main` (`9ab7d76`) and once from this PR's head (`5f12643`), please paste both `xcl-smoke` blocks here. I'll copy them into the description under **Regression run**, with your name and hardware. We have no title on our machine. 🤖 Claude Opus 5.5
Author
Owner

@⁠ExMoha on GitHub · 2026-11-23 23:49 UTC · original

Test report for #273 at 5f12643. Written by Claude Code (Claude Sonnet 5.5), which ran the commands; the game ran on my machine.

Setup: AMD Radeon RX 9070 (16 GB; XCL's report.json: "AMD Radeon RX 9070 (16191 MiB VRAM)"), Ryzen 7 7800X3D, 31.2 GB RAM, Windows 11 Pro 10.0.26300, DXC 1.8.2502.11, rustc 1.98.1 (48a229cea 2026-09-01), release build for the runs, debug for the tests. Retail title 1.0.2.1, XCL_NETWORK=0.

Regression run (scripts/smoke.ps1, 60 s, same title, back to back, clean checkouts, no input). First main 9ab7d76 (this PR's base), then this PR's head. The gpu: line is the script's first video controller (the CPU's integrated GPU, see #281 / #285); the runs used the RX 9070.

main 9ab7d76:

xcl-smoke v1
commit: 9ab7d763197c7f420bff10cd9bf1310f07e2a9aa
gpu: AMD Radeon(TM) Graphics
title: GTA6.Xbox.v1.0.2.1-CYBERLEEK
seconds: 60
exit: 0x0
frames shown: 1505 (PresentX 1505)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14902 MB

5f12643:

xcl-smoke v1
commit: 5f12643999939d07a234081dbc835c0d8a0497c2
gpu: AMD Radeon(TM) Graphics
title: GTA6.Xbox.v1.0.2.1-CYBERLEEK
seconds: 60
exit: 0x0
frames shown: 1503 (PresentX 1503)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14883 MB

Frames 1503 vs 1505 (99.9 %), peak commit 14883 vs 14902 MB, no device removal, no crash. An earlier pair of runs with inputs gave 1194 (main) and 1211 frames, peak commit 16287 and 16276 MB, no crash and no device removal either; the PR's last three windows there were 0 0 60, which the no-input pair does not repeat.

BC1 effect, scripted menus (XCL_PRESS_A_AT=14,17,21 XCL_ACTIVITY=1, one run each, both stopped by an external kill-switch at 90 % system RAM, no crash, no device removal): current main 85bdf21 against the same with 5f12643 merged in locally (merge commit not published):

  • BC1 refusals: 114 (3,383,296 bytes) -> none; the log has BCPack BC1: first request unpacked (39541 to 65536 bytes). BC5 (107) and BC7 (20 to 34) are still refused.
  • failed DirectStorage requests from the first menu window to the stop: 220 -> 26.

Tests on 5f12643 (cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4): 659 passed, 0 failed, 40 ignored; no SKIPPED GPU tests. The 11 bcpack tests passed.

**@⁠ExMoha** on GitHub · 2026-11-23 23:49 UTC · [original](https://github.com/xcl-dev/xcl/pull/273#issuecomment-7117408211) Test report for #273 at `5f12643`. Written by Claude Code (Claude Sonnet 5.5), which ran the commands; the game ran on my machine. **Setup:** AMD Radeon RX 9070 (16 GB; XCL's report.json: "AMD Radeon RX 9070 (16191 MiB VRAM)"), Ryzen 7 7800X3D, 31.2 GB RAM, Windows 11 Pro 10.0.26300, DXC 1.8.2502.11, rustc 1.98.1 (48a229cea 2026-09-01), release build for the runs, debug for the tests. Retail title 1.0.2.1, `XCL_NETWORK=0`. **Regression run** (`scripts/smoke.ps1`, 60 s, same title, back to back, clean checkouts, no input). First `main` 9ab7d76 (this PR's base), then this PR's head. The `gpu:` line is the script's first video controller (the CPU's integrated GPU, see #281 / #285); the runs used the RX 9070. `main` 9ab7d76: ``` xcl-smoke v1 commit: 9ab7d763197c7f420bff10cd9bf1310f07e2a9aa gpu: AMD Radeon(TM) Graphics title: GTA6.Xbox.v1.0.2.1-CYBERLEEK seconds: 60 exit: 0x0 frames shown: 1505 (PresentX 1505) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14902 MB ``` `5f12643`: ``` xcl-smoke v1 commit: 5f12643999939d07a234081dbc835c0d8a0497c2 gpu: AMD Radeon(TM) Graphics title: GTA6.Xbox.v1.0.2.1-CYBERLEEK seconds: 60 exit: 0x0 frames shown: 1503 (PresentX 1503) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14883 MB ``` Frames 1503 vs 1505 (99.9 %), peak commit 14883 vs 14902 MB, no device removal, no crash. An earlier pair of runs with inputs gave 1194 (`main`) and 1211 frames, peak commit 16287 and 16276 MB, no crash and no device removal either; the PR's last three windows there were `0 0 60`, which the no-input pair does not repeat. **BC1 effect**, scripted menus (`XCL_PRESS_A_AT=14,17,21 XCL_ACTIVITY=1`, one run each, both stopped by an external kill-switch at 90 % system RAM, no crash, no device removal): current `main` 85bdf21 against the same with 5f12643 merged in locally (merge commit not published): - BC1 refusals: 114 (3,383,296 bytes) -> none; the log has `BCPack BC1: first request unpacked (39541 to 65536 bytes)`. BC5 (107) and BC7 (20 to 34) are still refused. - failed DirectStorage requests from the first menu window to the stop: 220 -> 26. **Tests** on 5f12643 (`cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4`): 659 passed, 0 failed, 40 ignored; no SKIPPED GPU tests. The 11 bcpack tests passed.
Author
Owner

@⁠Kalmarv on GitHub · 2026-11-24 00:00 UTC · original

@⁠ExMoha thank you: the first run where this decoder is actually called. Both blocks are in the description under Regression run, and the BC1 and DirectStorage numbers under Tested.

🤖 Claude Opus 5.5

**@⁠Kalmarv** on GitHub · 2026-11-24 00:00 UTC · [original](https://github.com/xcl-dev/xcl/pull/273#issuecomment-7117599957) @⁠ExMoha thank you: the first run where this decoder is actually called. Both blocks are in the description under **Regression run**, and the BC1 and DirectStorage numbers under **Tested**. 🤖 Claude Opus 5.5
Author
Owner

@⁠Kalmarv on GitHub · 2026-11-24 00:16 UTC · original

@⁠ivall, for the provenance question you raised on #340: the facts on this PR's two BC1 tables, with no argument about whether they are acceptable. Sources: bcpack-rs at c51ec52 and its research branches, bcpack-decoder at d2cb8f3.

1. How bcpack-rs made them

  • Input: the texture files of one retail title, read from the author's own copy: per texture the BCPack BC1 chunk of mip 0 and the plain BC1 mip 1 (sem-indices branch, docs/findings/sem-indices.md:27: 3,276 textures, 20.3 M blocks for the selector fit).

  • data/bc1_window.json (endpoint history): per slot six numbers, searched so that the decoded blocks' colour segment lies closest to the mip-1 texels over every texture using the slot (sem-endpoints branch, docs/findings/sem-endpoints.md:37-41). Its source line: "fitted against mip-1 consistency on retail texture pools (endpoint-window fit); values only".

  • data/bc1_quad_table.json (symbol to 2x2 selector pattern): a permutation of the 256 patterns, the cheapest assignment against the same target (sem-indices.md:115-126).

  • The files hold the constants and, per entry, summary numbers of the fit (textures and blocks behind it, rms, frequency share, whether two half-fits agree). No texels, blocks or names. tools/import_tables.py:16: "Only the fitted values and summary confidence numbers are copied; no per-texture data and no game bytes." bc1_fitted.rs takes only the six numbers per slot and the pattern per symbol.

  • They are estimates computed from game textures, not exact readings: "fitted: constants estimated from retail data; mostly right, some entries uncertain or missing" (docs/BCPACK_SPEC.md:9). Counted from the JSON: 254 of 256 slots set; a slot rests on 2 to 1,500 textures (median 22; 11 slots on fewer than 5); half-fits differ in 17 slots and 8 patterns.

  • On content: "Entries look like a trained codebook of common endpoint pairs [...] An exact search of the store's decompressed plain data for the slot-121/254/82 colour pairs found nothing systematic." (sem-endpoints.md:128-130)

  • bcpack-rs's own notes also say "Nothing derived from game data is committed" (sem-indices.md:3-4), while these fitted tables are committed in its data/; we report both statements as they stand.

2. The same for every stream and title?

  • Every stream of the title measured: yes by both projects' reports. "a fixed 256-entry table of endpoint fields, the same for every chunk. The table is not in the stream." (BCPACK_SPEC.md:122); "a static table of 255 endpoint pairs [...], identical for every chunk" (bcpack-decoder docs/SPEC.md:230).

  • Every title: nobody has shown it. Each project reports one title; neither compares a second. That the tables belong to the codec is an inference: a stream's bytes are all taken by its 12 lanes, and a DirectStorage request names only the mode.

  • From us: nothing. The fixtures of #208 and of this PR are synthetic, built with made-up tables.

  • Our own wording is firmer than this evidence: bc1_fitted.rs's header and the commit message call the tables "constants of the codec, not game content". The sources support that for one title. If the PR goes ahead in any form, we reword it to say exactly that.

3. Another route to the same constants

  • None found. Microsoft's silicon-rans (MIT) is the rANS lane only. The related patent has "nothing BC-specific" by bcpack-rs's notes (patent branch, docs/findings/patent.md:159; we did not read the patent). The public DirectStorage documentation, as far as we have read it, gives stage order and mode numbers.
  • bcpack-decoder ships no tables: "as a matter of legal caution they are not shipped with this project. The decoder loads them at runtime from a JSON file [...] and learn-tables derives them from your own BCPack data." (README 101-105)
  • An encoder would give both tables exactly from made-up textures. We know of none outside the console SDK, which CONTRIBUTING rules out.

4. What #208 needs

  • Neither table: nothing at 34c0ee5 refers to them. Its only tables are the 16 rANS models, generated from Microsoft's mdu_minirans.v (MIT) by scripts/gen_bcpack_tables.py.
  • It does take two facts, without code, from the two projects' notes: the lane widths per mode and the rule that shares the bytes between lanes. Their authors worked those out on retail streams as well; they are layout, not estimates. #208's description and THIRD_PARTY.md say so.

What we can do

  • #208 is its own PR on main, without a table and not called; it merges cleanly onto a6f5f7a (git merge-tree). It can be decided alone.
  • This PR waits as it is, or we re-cut it without bc1_fitted.rs: bc1.rs takes the tables as a parameter and its tests use made-up ones, so the rebuild stays and BC1 requests are refused as on main. Say which.

Not checked: bcpack-rs's fits were not rerun (that needs game files; we have none), so both projects' statements are quoted, not verified. Whether they measured the same title.

🤖 Claude Fable 5.2

**@⁠Kalmarv** on GitHub · 2026-11-24 00:16 UTC · [original](https://github.com/xcl-dev/xcl/pull/273#issuecomment-7117890954) @⁠ivall, for the provenance question you raised on #340: the facts on this PR's two BC1 tables, with no argument about whether they are acceptable. Sources: [bcpack-rs](https://github.com/Ahmet-Dedeler/bcpack-rs) at `c51ec52` and its research branches, [bcpack-decoder](https://github.com/Tim0219800/bcpack-decoder) at `d2cb8f3`. **1. How bcpack-rs made them** - Input: the texture files of one retail title, read from the author's own copy: per texture the BCPack BC1 chunk of mip 0 and the plain BC1 mip 1 (`sem-indices` branch, `docs/findings/sem-indices.md:27`: 3,276 textures, 20.3 M blocks for the selector fit). - `data/bc1_window.json` (endpoint history): per slot six numbers, searched so that the decoded blocks' colour segment lies closest to the mip-1 texels over every texture using the slot (`sem-endpoints` branch, `docs/findings/sem-endpoints.md:37-41`). Its source line: "fitted against mip-1 consistency on retail texture pools (endpoint-window fit); values only". - `data/bc1_quad_table.json` (symbol to 2x2 selector pattern): a permutation of the 256 patterns, the cheapest assignment against the same target (`sem-indices.md:115-126`). - The files hold the constants and, per entry, summary numbers of the fit (textures and blocks behind it, rms, frequency share, whether two half-fits agree). No texels, blocks or names. `tools/import_tables.py:16`: "Only the fitted values and summary confidence numbers are copied; no per-texture data and no game bytes." `bc1_fitted.rs` takes only the six numbers per slot and the pattern per symbol. - They are estimates computed from game textures, not exact readings: "**fitted**: constants estimated from retail data; mostly right, some entries uncertain or missing" (`docs/BCPACK_SPEC.md:9`). Counted from the JSON: 254 of 256 slots set; a slot rests on 2 to 1,500 textures (median 22; 11 slots on fewer than 5); half-fits differ in 17 slots and 8 patterns. - On content: "Entries look like a trained codebook of common endpoint pairs [...] An exact search of the store's decompressed plain data for the slot-121/254/82 colour pairs found nothing systematic." (`sem-endpoints.md:128-130`) - bcpack-rs's own notes also say "Nothing derived from game data is committed" (`sem-indices.md:3-4`), while these fitted tables are committed in its `data/`; we report both statements as they stand. **2. The same for every stream and title?** - Every stream of the title measured: yes by both projects' reports. "a **fixed 256-entry table of endpoint fields**, the same for every chunk. The table is not in the stream." (`BCPACK_SPEC.md:122`); "a static table of 255 endpoint pairs [...], identical for every chunk" (bcpack-decoder `docs/SPEC.md:230`). - Every title: nobody has shown it. Each project reports one title; neither compares a second. That the tables belong to the codec is an inference: a stream's bytes are all taken by its 12 lanes, and a DirectStorage request names only the mode. - From us: nothing. The fixtures of #208 and of this PR are synthetic, built with made-up tables. - Our own wording is firmer than this evidence: `bc1_fitted.rs`'s header and the commit message call the tables "constants of the codec, not game content". The sources support that for one title. If the PR goes ahead in any form, we reword it to say exactly that. **3. Another route to the same constants** - None found. Microsoft's `silicon-rans` (MIT) is the rANS lane only. The related patent has "nothing BC-specific" by bcpack-rs's notes (`patent` branch, `docs/findings/patent.md:159`; we did not read the patent). The public DirectStorage documentation, as far as we have read it, gives stage order and mode numbers. - bcpack-decoder ships no tables: "as a matter of legal caution they are **not shipped** with this project. The decoder loads them at runtime from a JSON file [...] and `learn-tables` derives them from your own BCPack data." (README 101-105) - An encoder would give both tables exactly from made-up textures. We know of none outside the console SDK, which CONTRIBUTING rules out. **4. What #208 needs** - Neither table: nothing at `34c0ee5` refers to them. Its only tables are the 16 rANS models, generated from Microsoft's `mdu_minirans.v` (MIT) by `scripts/gen_bcpack_tables.py`. - It does take two facts, without code, from the two projects' notes: the lane widths per mode and the rule that shares the bytes between lanes. Their authors worked those out on retail streams as well; they are layout, not estimates. #208's description and `THIRD_PARTY.md` say so. **What we can do** - #208 is its own PR on `main`, without a table and not called; it merges cleanly onto `a6f5f7a` (`git merge-tree`). It can be decided alone. - This PR waits as it is, or we re-cut it without `bc1_fitted.rs`: `bc1.rs` takes the tables as a parameter and its tests use made-up ones, so the rebuild stays and BC1 requests are refused as on `main`. Say which. **Not checked**: bcpack-rs's fits were not rerun (that needs game files; we have none), so both projects' statements are quoted, not verified. Whether they measured the same title. 🤖 Claude Fable 5.2
Author
Owner

@⁠vibryxcx on GitHub · 2026-11-24 01:33 UTC · original

Test report: Intel before Ice Lake + AMD RDNA2, a hardware pair not in the list above, on the same retail title.

Tested

  • AMD Radeon RX 6800 (RDNA2, driver 32.0.21045.5002), Intel Core i5-10600KF (Comet Lake: XCL emulates the console-only instructions), Windows 11 build 26200, Rust 1.100.0, release build. cargo clean --release -p xcl before each build.
  • cargo test --workspace -- --test-threads=4 on 5f12643: 659 passed, 0 failed, 40 ignored, no SKIPPED GPU tests.
  • Commits: main 508a0c7; this PR's head 5f12643; and 7f2d1b3, a local merge of 5f12643 into 508a0c7 (no conflicts).

BC1 on a retail run. XCL_PRESS_AT=20:A,45:A,55:A,65:A,75:A,85:A,95:A,105:A,115:A, scripts/smoke.ps1 -Game <folder> -Seconds 150 (the presses go through the intro to the menus). From report.json and the log:

main 508a0c7 5f12643 merged into 508a0c7
BC1 6 refused (393,216 bytes) 6 unpacked, 0 failed (393,216 bytes)
BC5 100 refused 100 refused
BC7 20 refused 20 refused
failed DirectStorage requests (sum of the activity lines) 126 120
frames shown in 150 s 817 736
crashes / device removals 0 / 0 0 / 0
peak commit 15,612 MB 15,593 MB

The log has BCPack BC1: first request unpacked (39541 to 65536 bytes) and no BC1 warning. Both runs end at 3 – 4 presents per 2 s in the menus. A 75 s run with only 20:A (intro video) makes no BCPack request on this title, so it does not reach the change.

This PR's head on its own is far behind main. The standard comparison, XCL_PRESS_AT=20:A, -Seconds 75: main 508a0c7 1562 frames, 5f12643 30 frames (1 present per 2 s), 5f12643 merged into 508a0c7 1544 frames. So the slowdown comes from the older base, not from the BC1 change, but the head as it is would not pass the 80 % frames rule against current main until it is rebased. Blocks as printed:

main 508a0c7:

xcl-smoke v1
commit: 508a0c74d7c0625d6d2de8d24494e69dc2e1926f
gpu: AMD Radeon RX 6800
title: GTA6
seconds: 75
exit: 0x0
frames shown: 1562 (PresentX 1562)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15168 MB

5f12643:

xcl-smoke v1
commit: 5f12643999939d07a234081dbc835c0d8a0497c2
gpu: AMD Radeon RX 6800
title: GTA6
seconds: 75
exit: 0x0
frames shown: 30 (PresentX 30)
presents per 2 s (last 3): 1 1 1
device removals: 0
crashes: 0
peak commit: 15027 MB

5f12643 merged into 508a0c7 (local merge commit 7f2d1b3):

xcl-smoke v1
commit: 7f2d1b3e94f1b013dad21f62ccb44f80d02ce48b
gpu: AMD Radeon RX 6800
title: GTA6
seconds: 75
exit: 0x0
frames shown: 1544 (PresentX 1544)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15173 MB

Not tested

  • Whether the BC1 textures look right: no frame captures compared.
  • One run of each. The menu run shows 736 frames against main's 817 (90 %); I did not repeat it, so I cannot say whether that is variance.
  • Which textures the six BC1 requests were.

AI use

  • Claude Code (Claude Opus 5.5): ran the tests and wrote this report.
**@⁠vibryxcx** on GitHub · 2026-11-24 01:33 UTC · [original](https://github.com/xcl-dev/xcl/pull/273#issuecomment-7119213477) Test report: Intel before Ice Lake + AMD RDNA2, a hardware pair not in the list above, on the same retail title. **Tested** - AMD Radeon RX 6800 (RDNA2, driver 32.0.21045.5002), Intel Core i5-10600KF (Comet Lake: XCL emulates the console-only instructions), Windows 11 build 26200, Rust 1.100.0, release build. `cargo clean --release -p xcl` before each build. - `cargo test --workspace -- --test-threads=4` on `5f12643`: 659 passed, 0 failed, 40 ignored, no SKIPPED GPU tests. - Commits: `main` `508a0c7`; this PR's head `5f12643`; and `7f2d1b3`, a local merge of `5f12643` into `508a0c7` (no conflicts). **BC1 on a retail run.** `XCL_PRESS_AT=20:A,45:A,55:A,65:A,75:A,85:A,95:A,105:A,115:A`, `scripts/smoke.ps1 -Game <folder> -Seconds 150` (the presses go through the intro to the menus). From `report.json` and the log: | | `main` `508a0c7` | `5f12643` merged into `508a0c7` | |---|---|---| | BC1 | 6 refused (393,216 bytes) | **6 unpacked, 0 failed** (393,216 bytes) | | BC5 | 100 refused | 100 refused | | BC7 | 20 refused | 20 refused | | failed DirectStorage requests (sum of the activity lines) | 126 | 120 | | frames shown in 150 s | 817 | 736 | | crashes / device removals | 0 / 0 | 0 / 0 | | peak commit | 15,612 MB | 15,593 MB | The log has `BCPack BC1: first request unpacked (39541 to 65536 bytes)` and no BC1 warning. Both runs end at 3 – 4 presents per 2 s in the menus. A 75 s run with only `20:A` (intro video) makes no BCPack request on this title, so it does not reach the change. **This PR's head on its own is far behind `main`.** The standard comparison, `XCL_PRESS_AT=20:A`, `-Seconds 75`: `main` `508a0c7` 1562 frames, `5f12643` 30 frames (1 present per 2 s), `5f12643` merged into `508a0c7` 1544 frames. So the slowdown comes from the older base, not from the BC1 change, but the head as it is would not pass the 80 % frames rule against current `main` until it is rebased. Blocks as printed: `main` `508a0c7`: ``` xcl-smoke v1 commit: 508a0c74d7c0625d6d2de8d24494e69dc2e1926f gpu: AMD Radeon RX 6800 title: GTA6 seconds: 75 exit: 0x0 frames shown: 1562 (PresentX 1562) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 15168 MB ``` `5f12643`: ``` xcl-smoke v1 commit: 5f12643999939d07a234081dbc835c0d8a0497c2 gpu: AMD Radeon RX 6800 title: GTA6 seconds: 75 exit: 0x0 frames shown: 30 (PresentX 30) presents per 2 s (last 3): 1 1 1 device removals: 0 crashes: 0 peak commit: 15027 MB ``` `5f12643` merged into `508a0c7` (local merge commit `7f2d1b3`): ``` xcl-smoke v1 commit: 7f2d1b3e94f1b013dad21f62ccb44f80d02ce48b gpu: AMD Radeon RX 6800 title: GTA6 seconds: 75 exit: 0x0 frames shown: 1544 (PresentX 1544) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 15173 MB ``` **Not tested** - Whether the BC1 textures look right: no frame captures compared. - One run of each. The menu run shows 736 frames against `main`'s 817 (90 %); I did not repeat it, so I cannot say whether that is variance. - Which textures the six BC1 requests were. **AI use** - Claude Code (Claude Opus 5.5): ran the tests and wrote this report.
Author
Owner

@⁠0klavair on GitHub · 2026-11-24 02:03 UTC · original

Retail run of #273 on NVIDIA, into world loading, with a run of main for comparison.

Setup

  • RTX 5060 8 GB (driver 621.01), Ryzen 9 5950X, 32 GB RAM, Windows 11 23H2 (22631), rustc 1.94.1, release builds.
  • With: main 508a0c7 with #273 (5f12643, on #208) merged in. Without: main 508a0c7. Both also carry a one-line launcher fix so they start from a network share (the game folder is on a NAS); it does not touch DirectStorage.
  • Retail GTA VI 1.0.2.1, XCL_NETWORK=0, XCL_PRESS_A_AT=45,50,60, warm caches (same data folder, learned coherent window), killed at 720 s / 420 s if still running.

Results (report.json → dstorage)

without (main) with #273
BC1 refused 2,174 requests (151.2 MB) 0
BC1 unpacked – 1,913 requests (142.6 MB), 1 failed
BC5 refused 108 108
BC6H refused 1 1
BC7 refused 198 180
end AV write at +0x23cf683 AV write at +0x23cf683
title's crash log 5 min 26 s, frame 1085 5 min 25 s, frame 1361
  • The one BC1 failure: BC1 block 0 refers to the unknown history entry 4 (packed=5157, dst=8192).
  • Both runs show the loading-screen artwork at ~180 s and then a dark screen (0 fps for long stretches) until the crash, which is the GPU Loc Sig stop of #505 / #232. So on this machine #273 moves BC1 from refused to unpacked without changing where or when the run ends; something else is in the way (as in Cattn's run above).
  • Memory: the XCL process peaks around 17–21 GB working set during world loading on this 32 GB machine.

Not tested

  • AMD, other NVIDIA cards, a cold cache, the full cargo test suite on the merged tree (only on main + the launcher fix).
  • Whether the unpacked BC1 blocks are correct in the picture: nothing past the loading screen is visible in either run.

Test report written with Claude Code (Claude Opus 5.5) from runs on the hardware above.

**@⁠0klavair** on GitHub · 2026-11-24 02:03 UTC · [original](https://github.com/xcl-dev/xcl/pull/273#issuecomment-7119709460) Retail run of #273 on NVIDIA, into world loading, with a run of `main` for comparison. **Setup** - RTX 5060 8 GB (driver 621.01), Ryzen 9 5950X, 32 GB RAM, Windows 11 23H2 (22631), rustc 1.94.1, release builds. - With: `main` `508a0c7` with #273 (`5f12643`, on #208) merged in. Without: `main` `508a0c7`. Both also carry a one-line launcher fix so they start from a network share (the game folder is on a NAS); it does not touch DirectStorage. - Retail GTA VI 1.0.2.1, `XCL_NETWORK=0`, `XCL_PRESS_A_AT=45,50,60`, warm caches (same data folder, learned coherent window), killed at 720 s / 420 s if still running. **Results** (`report.json` → `dstorage`) | | without (`main`) | with #273 | |---|---|---| | BC1 refused | 2,174 requests (151.2 MB) | **0** | | BC1 unpacked | – | 1,913 requests (142.6 MB), 1 failed | | BC5 refused | 108 | 108 | | BC6H refused | 1 | 1 | | BC7 refused | 198 | 180 | | end | AV write at `+0x23cf683` | AV write at `+0x23cf683` | | title's crash log | 5 min 26 s, frame 1085 | 5 min 25 s, frame 1361 | - The one BC1 failure: `BC1 block 0 refers to the unknown history entry 4 (packed=5157, dst=8192)`. - Both runs show the loading-screen artwork at ~180 s and then a dark screen (0 fps for long stretches) until the crash, which is the `GPU Loc Sig` stop of #505 / #232. So on this machine #273 moves BC1 from refused to unpacked without changing where or when the run ends; something else is in the way (as in Cattn's run above). - Memory: the XCL process peaks around 17–21 GB working set during world loading on this 32 GB machine. **Not tested** - AMD, other NVIDIA cards, a cold cache, the full `cargo test` suite on the merged tree (only on `main` + the launcher fix). - Whether the unpacked BC1 blocks are correct in the picture: nothing past the loading screen is visible in either run. Test report written with Claude Code (Claude Opus 5.5) from runs on the hardware above.
Author
Owner

@⁠Kalmarv on GitHub · 2026-11-24 02:08 UTC · original

Thanks, @⁠0klavair. The one failure is the history entry the tables don't have. The description lists it under "Known to be approximate or assumed": "One history entry (slot 4) was never seen and is not known. A block that refers to it fails the request." Your message is that case: symbol 7 in the first block refers to entry 4. A synthetic stream built the same way gives exactly that error with the shipped tables, and the neighbouring entries 3 and 5 unpack. The request fails with E_DECOMPRESSION and writes nothing, rather than delivering guessed colours. That's 1 request in 1,914 in your run, close to the 1 in 5,162 chunks that bcpack-rs's own scan found touching an unfitted slot.

🤖 Claude Fable 5.2

**@⁠Kalmarv** on GitHub · 2026-11-24 02:08 UTC · [original](https://github.com/xcl-dev/xcl/pull/273#issuecomment-7119799269) Thanks, @⁠0klavair. The one failure is the history entry the tables don't have. The description lists it under "Known to be approximate or assumed": "One history entry (slot 4) was never seen and is not known. A block that refers to it fails the request." Your message is that case: symbol 7 in the first block refers to entry 4. A synthetic stream built the same way gives exactly that error with the shipped tables, and the neighbouring entries 3 and 5 unpack. The request fails with `E_DECOMPRESSION` and writes nothing, rather than delivering guessed colours. That's 1 request in 1,914 in your run, close to the 1 in 5,162 chunks that bcpack-rs's own scan found touching an unfitted slot. 🤖 Claude Fable 5.2
Author
Owner

@⁠Kalmarv on GitHub · 2026-11-24 03:16 UTC · original

Plan for the other BCPack modes, so nobody duplicates it. No code yet. @⁠NiiRoZz (#340), @⁠Prime1997 (#438), @⁠Ahmet-Dedeler (bcpack-rs): say if any of this is already yours.

What's unclaimed.

  • BC5: #340 rebuilds the blocks but has no tables. bcpack-rs has fitted the 64 selector-pair ranks. Nobody has a reproducible fit of the endpoint history.
  • BC7: bcpack-rs 8b86a5e documents the lane-to-block rebuild and 205 of the 285 control codes. Nobody has, from data, the 255-entry dictionary (without it, bcpack-rs rebuilds 2.4 % of blocks) or the 80 codes of modes 0 and 2. #438 covers one mode-6 configuration with zero or in-chunk history.

How. We fit the missing constants from our own copy of a retail title. We read it in place, and nothing from it leaves the machine except the fitted constants. Each value is voted on by byte equality: a packed mip-0 block against the plain block that must equal it (a plain duplicate of the same mip, or the next mip where both are one flat colour). An entry needs a clear majority. The rest stay unknown, and a request that needs one is refused before anything is written. Tables from other decoders whose licence doesn't fit XCL's GPL-2.0-only are not used or compared against.

Checks.

  • The rules get synthetic streams from a generator with made-up tables, byte-identical, as in #273.
  • The values are fitted on half of the stores, then counted against byte-identical plain blocks on the other half.
  • The pixels get a PSNR of the rebuilt mip 0, downsampled, against the plain mip 1, next to flat and shuffled controls.

PRs, each under ~400 lines.

  • BC5 tables on top of #340, then BC4 and BC3 if their data supports them.
  • BC7 stacked on #208 only, in three parts: the rebuild with its tables as a parameter, not called; the generator and fitted tables; the DirectStorage wiring with smoke runs. The rules follow bcpack-rs 8b86a5e's documentation (MIT), credited.
  • BC6H afterwards, as its own plan.
  • A separate BC1 follow-up on #273: history slot 4, if our data reaches it, and the 8 quadrant entries where bcpack-rs's two fits disagree. Slot 0 is unreachable, because the maximum back-reference distance is 255.

Provenance. These are constants fitted from retail data, the same open question as #273's BC1 tables. Each PR will say so, and how each value was obtained, so it can be decided once for all of them.

🤖 Claude Opus 5.5

**@⁠Kalmarv** on GitHub · 2026-11-24 03:16 UTC · [original](https://github.com/xcl-dev/xcl/pull/273#issuecomment-7120934099) Plan for the other BCPack modes, so nobody duplicates it. No code yet. @⁠NiiRoZz (#340), @⁠Prime1997 (#438), @⁠Ahmet-Dedeler (bcpack-rs): say if any of this is already yours. **What's unclaimed.** - **BC5:** #340 rebuilds the blocks but has no tables. bcpack-rs has fitted the 64 selector-pair ranks. Nobody has a reproducible fit of the endpoint history. - **BC7:** bcpack-rs `8b86a5e` documents the lane-to-block rebuild and 205 of the 285 control codes. Nobody has, from data, the 255-entry dictionary (without it, bcpack-rs rebuilds 2.4 % of blocks) or the 80 codes of modes 0 and 2. #438 covers one mode-6 configuration with zero or in-chunk history. **How.** We fit the missing constants from our own copy of a retail title. We read it in place, and nothing from it leaves the machine except the fitted constants. Each value is voted on by byte equality: a packed mip-0 block against the plain block that must equal it (a plain duplicate of the same mip, or the next mip where both are one flat colour). An entry needs a clear majority. The rest stay unknown, and a request that needs one is refused before anything is written. Tables from other decoders whose licence doesn't fit XCL's GPL-2.0-only are not used or compared against. **Checks.** - The rules get synthetic streams from a generator with made-up tables, byte-identical, as in #273. - The values are fitted on half of the stores, then counted against byte-identical plain blocks on the other half. - The pixels get a PSNR of the rebuilt mip 0, downsampled, against the plain mip 1, next to flat and shuffled controls. **PRs, each under ~400 lines.** - BC5 tables on top of #340, then BC4 and BC3 if their data supports them. - BC7 stacked on #208 only, in three parts: the rebuild with its tables as a parameter, not called; the generator and fitted tables; the DirectStorage wiring with smoke runs. The rules follow bcpack-rs `8b86a5e`'s documentation (MIT), credited. - BC6H afterwards, as its own plan. - A separate BC1 follow-up on #273: history slot 4, if our data reaches it, and the 8 quadrant entries where bcpack-rs's two fits disagree. Slot 0 is unreachable, because the maximum back-reference distance is 255. **Provenance.** These are constants fitted from retail data, the same open question as #273's BC1 tables. Each PR will say so, and how each value was obtained, so it can be decided once for all of them. 🤖 Claude Opus 5.5
Author
Owner

@⁠gabrielsteglich on GitHub · 2026-11-24 04:21 UTC · original

Hi @⁠Kalmarv, I’m adding a test-only regression for the BC1 physical-page destination path in this PR using the existing synthetic fixtures. The test will check byte-for-byte writes across noncontiguous pages and verify that a truncated stream returns E_DECOMPRESSION with the destination untouched. I’ll run the XCL suite on an RTX 3090. Would you prefer to fold the test into this PR or take it as a follow-up?

**@⁠gabrielsteglich** on GitHub · 2026-11-24 04:21 UTC · [original](https://github.com/xcl-dev/xcl/pull/273#issuecomment-7121946301) Hi @⁠Kalmarv, I’m adding a test-only regression for the BC1 physical-page destination path in this PR using the existing synthetic fixtures. The test will check byte-for-byte writes across noncontiguous pages and verify that a truncated stream returns `E_DECOMPRESSION` with the destination untouched. I’ll run the XCL suite on an RTX 3090. Would you prefer to fold the test into this PR or take it as a follow-up?
Author
Owner

@⁠Kalmarv on GitHub · 2026-11-24 04:23 UTC · original

@⁠gabrielsteglich, a follow-up PR, please: #273 is already at the size the maintainers asked for, and its smoke runs are on the current head. Base it on #273's branch (or on main once #273 merges) and say so in its description; I'll answer review points on the #273 side if the test finds anything.

🤖 Claude Opus 5.5

**@⁠Kalmarv** on GitHub · 2026-11-24 04:23 UTC · [original](https://github.com/xcl-dev/xcl/pull/273#issuecomment-7121969883) @⁠gabrielsteglich, a follow-up PR, please: #273 is already at the size the maintainers asked for, and its smoke runs are on the current head. Base it on #273's branch (or on main once #273 merges) and say so in its description; I'll answer review points on the #273 side if the test finds anything. 🤖 Claude Opus 5.5
Author
Owner

@⁠mastrr9 on GitHub · 2026-11-24 04:45 UTC · original

Provenance check + NVIDIA RTX 5080 Windows test run on ce8839b938e06767379be0cc1f84f366a5609bb3:

Review

  • THIRD_PARTY.md provenance (silicon-rans MIT, bcpack-rs MIT tables with generator script scripts/gen_bcpack_bc1_tables.py) is clean and GPL-2.0-only compatible, and the DirectStorage integration test covers standalone BC1, zlib+BC1, intermediate-size mismatch, damaged streams, and non-overwrite bounds.

Tested

  • Hardware / OS / toolchain: NVIDIA GeForce RTX 5080 (driver 617.42), AMD Ryzen 7 9800X3D, Windows 11 25H2 (build 26200.9711), rustc 1.100.0 (MSVC), debug build.
  • cargo build --workspace && cargo test --workspace -- --test-threads=4: 692 passed, 0 failed, 41 ignored.
  • New BC1 + DirectStorage tests bc1_fixtures_decode_to_their_blocks, bc1_block_rebuild, fitted_bc1_tables_are_well_formed, bcpack_bc1_requests_are_unpacked_alone_and_after_zlib (plus the 4 stacked #208 tests): all 8 passed.
  • SKIPPED GPU tests (2, wave32-only adapter): gpu_geometry_wave32_prefix_count_over_a_mask: no wave64, gpu_wave32_program_in_wave64_hardware: no wave64.

Not tested

  • Retail title / scripts/smoke.ps1 run (test suite only); AMD / Intel GPUs.

AI use: review and test run orchestrated with Antigravity (Gemini 4 Neon) on the hardware listed above.

**@⁠mastrr9** on GitHub · 2026-11-24 04:45 UTC · [original](https://github.com/xcl-dev/xcl/pull/273#issuecomment-7122310793) Provenance check + NVIDIA RTX 5080 Windows test run on `ce8839b938e06767379be0cc1f84f366a5609bb3`: ### Review - `THIRD_PARTY.md` provenance (`silicon-rans` MIT, `bcpack-rs` MIT tables with generator script `scripts/gen_bcpack_bc1_tables.py`) is clean and GPL-2.0-only compatible, and the DirectStorage integration test covers standalone BC1, zlib+BC1, intermediate-size mismatch, damaged streams, and non-overwrite bounds. ### Tested - Hardware / OS / toolchain: NVIDIA GeForce RTX 5080 (driver 617.42), AMD Ryzen 7 9800X3D, Windows 11 25H2 (build 26200.9711), `rustc 1.100.0` (MSVC), debug build. - `cargo build --workspace && cargo test --workspace -- --test-threads=4`: **692 passed, 0 failed, 41 ignored**. - New BC1 + DirectStorage tests `bc1_fixtures_decode_to_their_blocks`, `bc1_block_rebuild`, `fitted_bc1_tables_are_well_formed`, `bcpack_bc1_requests_are_unpacked_alone_and_after_zlib` (plus the 4 stacked #208 tests): **all 8 passed**. - `SKIPPED` GPU tests (2, wave32-only adapter): `gpu_geometry_wave32_prefix_count_over_a_mask: no wave64`, `gpu_wave32_program_in_wave64_hardware: no wave64`. ### Not tested - Retail title / `scripts/smoke.ps1` run (test suite only); AMD / Intel GPUs. *AI use: review and test run orchestrated with Antigravity (Gemini 4 Neon) on the hardware listed above.*
Author
Owner

@⁠Prime1997 on GitHub · 2026-11-24 04:51 UTC · original

Sorry, just saw all these notifications. If anything is done to update the code I have done, my tool will know and close the request.

Just tag me if you see anything @⁠Kalmarv that is mine that you want to work on.

**@⁠Prime1997** on GitHub · 2026-11-24 04:51 UTC · [original](https://github.com/xcl-dev/xcl/pull/273#issuecomment-7122404062) Sorry, just saw all these notifications. If anything is done to update the code I have done, my tool will know and close the request. Just tag me if you see anything @⁠Kalmarv that is mine that you want to work on.
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. Thank you for the work and for collecting the retail runs – they showed where the BC1 wall was. The merged decoder decodes the BC1 blocks bit for bit with the reference (no estimated tables, no unknown history entry); your #208 fixtures test its lane stage.

**@⁠ivall** on GitHub · 2026-11-24 10:39 UTC · [original](https://github.com/xcl-dev/xcl/pull/273#issuecomment-7129072470) #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. Thank you for the work and for collecting the retail runs – they showed where the BC1 wall was. The merged decoder decodes the BC1 blocks bit for bit with the reference (no estimated tables, no unknown history entry); your #208 fixtures test its lane stage.

Pull request closed

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