fix(bcpack): standalone BC1-BC7 decoding across runtimes and assets #2567
Open
wish131400 wants to merge 4 commits from
upstream-pr/2567 into main
pull from: upstream-pr/2567
merge into: ProjectLeonida:main
ProjectLeonida:main
ProjectLeonida:claude/loop-total
ProjectLeonida:claude/pops-collision-seed
ProjectLeonida:claude/dstorage-hold-page-reads
ProjectLeonida:claude/host-image-copy-switch
ProjectLeonida:feat/gdk-lifecycle-window-hook
ProjectLeonida:claude/d16s8-uav-nvidia-fallback
ProjectLeonida:feat/mfplat-offline-shim
ProjectLeonida:claude/gameinput-slow-reader
ProjectLeonida:fix/rt-null-barrier-clear
ProjectLeonida:claude/depth-resolve-sample-positions
ProjectLeonida:integration/palmetto-parity
ProjectLeonida:claude/valu-literal-sext
ProjectLeonida:claude/slot74-pool-handle
ProjectLeonida:claude/rgb9e5-uint-alias-view
ProjectLeonida:claude/fssm-root-layout-tables
ProjectLeonida:feat/gdk-speech-display-lifecycle
ProjectLeonida:asset-audio-skip-current
ProjectLeonida:qemmhd/old-9940-rectangle-quad-lists
ProjectLeonida:feat/ws2-offline-shim
ProjectLeonida:qemmhd/rt-d16-unorm-uav
ProjectLeonida:feat/xs-device-stops-7-9
ProjectLeonida:qemmhd/rt-depth-same-base-shapes
ProjectLeonida:qemmhd/rt-lazy-attachment-variant
ProjectLeonida:feat/acphal-xma2-decoder
ProjectLeonida:asset-audio-skip
ProjectLeonida:codex/coord-claim-check-20261124-7e48
ProjectLeonida:feat/xs-frame-pacing-presentx
ProjectLeonida:feat/xs-device-vm-options
ProjectLeonida:old-pr/9844
ProjectLeonida:old-pr/9978
ProjectLeonida:old-pr/9815
ProjectLeonida:old-pr/10057
ProjectLeonida:old-pr/9874
ProjectLeonida:old-pr/9965
ProjectLeonida:old-pr/9863
ProjectLeonida:old-pr/10068
ProjectLeonida:old-pr/10066
ProjectLeonida:old-pr/10067
ProjectLeonida:old-pr/10007
ProjectLeonida:old-pr/10061
ProjectLeonida:old-pr/10065
ProjectLeonida:old-pr/10059
ProjectLeonida:old-pr/10063
ProjectLeonida:old-pr/10055
ProjectLeonida:old-pr/10062
ProjectLeonida:old-pr/10042
ProjectLeonida:old-pr/10041
ProjectLeonida:old-pr/10049
ProjectLeonida:old-pr/10047
ProjectLeonida:old-pr/10046
ProjectLeonida:old-pr/10045
ProjectLeonida:old-pr/10056
ProjectLeonida:old-pr/10043
ProjectLeonida:old-pr/10036
ProjectLeonida:old-pr/10034
ProjectLeonida:old-pr/9984
ProjectLeonida:old-pr/10052
ProjectLeonida:old-pr/10038
ProjectLeonida:old-pr/10033
ProjectLeonida:old-pr/10028
ProjectLeonida:old-pr/10050
ProjectLeonida:old-pr/9891
ProjectLeonida:old-pr/9889
ProjectLeonida:old-pr/10051
ProjectLeonida:old-pr/10019
ProjectLeonida:old-pr/10027
ProjectLeonida:old-pr/10029
ProjectLeonida:old-pr/10031
ProjectLeonida:old-pr/10026
ProjectLeonida:old-pr/9941
ProjectLeonida:old-pr/10030
ProjectLeonida:old-pr/10040
ProjectLeonida:old-pr/9990
ProjectLeonida:old-pr/10021
ProjectLeonida:old-pr/9962
ProjectLeonida:old-pr/10022
ProjectLeonida:old-pr/10020
ProjectLeonida:old-pr/10015
ProjectLeonida:old-pr/10025
ProjectLeonida:old-pr/9886
ProjectLeonida:old-pr/10048
ProjectLeonida:old-pr/10014
ProjectLeonida:old-pr/10011
ProjectLeonida:old-pr/9861
ProjectLeonida:old-pr/10010
ProjectLeonida:old-pr/10008
ProjectLeonida:old-pr/9860
ProjectLeonida:old-pr/10006
ProjectLeonida:old-pr/9920
ProjectLeonida:old-pr/9995
ProjectLeonida:old-pr/10000
ProjectLeonida:old-pr/10016
ProjectLeonida:old-pr/10004
ProjectLeonida:old-pr/10023
ProjectLeonida:old-pr/9982
ProjectLeonida:old-pr/9981
ProjectLeonida:old-pr/9983
ProjectLeonida:old-pr/9970
ProjectLeonida:old-pr/9969
ProjectLeonida:old-pr/9968
ProjectLeonida:old-pr/9971
ProjectLeonida:old-pr/9972
ProjectLeonida:old-pr/9942
ProjectLeonida:old-pr/9963
ProjectLeonida:old-pr/9960
ProjectLeonida:old-pr/9964
ProjectLeonida:old-pr/9985
ProjectLeonida:old-pr/9973
ProjectLeonida:old-pr/9862
ProjectLeonida:old-pr/9953
ProjectLeonida:old-pr/10017
ProjectLeonida:old-pr/9952
ProjectLeonida:old-pr/9955
ProjectLeonida:old-pr/9946
ProjectLeonida:old-pr/9954
ProjectLeonida:old-pr/9938
ProjectLeonida:old-pr/9956
ProjectLeonida:old-pr/9856
ProjectLeonida:old-pr/9947
ProjectLeonida:old-pr/9924
ProjectLeonida:old-pr/9961
ProjectLeonida:old-pr/9927
ProjectLeonida:old-pr/9979
ProjectLeonida:old-pr/10032
ProjectLeonida:old-pr/9926
ProjectLeonida:old-pr/5237
ProjectLeonida:old-pr/9951
ProjectLeonida:old-pr/9931
ProjectLeonida:old-pr/9902
ProjectLeonida:old-pr/9921
ProjectLeonida:old-pr/9994
ProjectLeonida:old-pr/9775
ProjectLeonida:old-pr/9768
ProjectLeonida:old-pr/9905
ProjectLeonida:old-pr/9936
ProjectLeonida:old-pr/9901
ProjectLeonida:old-pr/9904
ProjectLeonida:old-pr/9906
ProjectLeonida:old-pr/9988
ProjectLeonida:old-pr/9908
ProjectLeonida:old-pr/9909
ProjectLeonida:old-pr/9911
ProjectLeonida:old-pr/9912
ProjectLeonida:old-pr/9913
ProjectLeonida:old-pr/9887
ProjectLeonida:old-pr/9916
ProjectLeonida:old-pr/9919
ProjectLeonida:old-pr/9925
ProjectLeonida:old-pr/9933
ProjectLeonida:old-pr/9935
ProjectLeonida:old-pr/9918
ProjectLeonida:old-pr/9879
ProjectLeonida:old-pr/9880
ProjectLeonida:old-pr/9881
ProjectLeonida:old-pr/9996
ProjectLeonida:old-pr/9876
ProjectLeonida:old-pr/9892
ProjectLeonida:old-pr/9899
ProjectLeonida:old-pr/9915
ProjectLeonida:old-pr/9914
ProjectLeonida:old-pr/9872
ProjectLeonida:old-pr/9869
ProjectLeonida:old-pr/9866
ProjectLeonida:old-pr/9819
ProjectLeonida:old-pr/10012
ProjectLeonida:old-pr/9857
ProjectLeonida:old-pr/9893
ProjectLeonida:old-pr/9897
ProjectLeonida:old-pr/9928
ProjectLeonida:old-pr/9868
ProjectLeonida:old-pr/9917
ProjectLeonida:old-pr/9940
ProjectLeonida:old-pr/9873
ProjectLeonida:old-pr/9816
ProjectLeonida:old-pr/10009
ProjectLeonida:old-pr/9900
ProjectLeonida:old-pr/9966
ProjectLeonida:old-pr/9859
ProjectLeonida:old-pr/9843
ProjectLeonida:old-pr/9991
ProjectLeonida:old-pr/10058
ProjectLeonida:old-pr/9883
ProjectLeonida:old-pr/9838
ProjectLeonida:old-pr/9835
ProjectLeonida:old-pr/9959
ProjectLeonida:old-pr/9895
ProjectLeonida:old-pr/9837
ProjectLeonida:old-pr/9858
ProjectLeonida:old-pr/9865
ProjectLeonida:old-pr/9864
ProjectLeonida:old-pr/9840
ProjectLeonida:old-pr/9820
ProjectLeonida:old-pr/4669
ProjectLeonida:old-pr/9848
ProjectLeonida:old-pr/9850
ProjectLeonida:old-pr/9810
ProjectLeonida:old-pr/9799
ProjectLeonida:old-pr/9853
ProjectLeonida:old-pr/9875
ProjectLeonida:old-pr/9831
ProjectLeonida:old-pr/9796
ProjectLeonida:old-pr/9801
ProjectLeonida:old-pr/9813
ProjectLeonida:old-pr/9794
ProjectLeonida:old-pr/7417
ProjectLeonida:old-pr/9781
ProjectLeonida:old-pr/9806
ProjectLeonida:old-pr/9958
ProjectLeonida:old-pr/9809
ProjectLeonida:old-pr/9791
ProjectLeonida:old-pr/9792
ProjectLeonida:old-pr/10053
ProjectLeonida:old-pr/9784
ProjectLeonida:old-pr/9789
ProjectLeonida:old-pr/9849
ProjectLeonida:old-pr/9846
ProjectLeonida:old-pr/9773
ProjectLeonida:old-pr/9785
ProjectLeonida:old-pr/9803
ProjectLeonida:old-pr/9826
ProjectLeonida:old-pr/9839
ProjectLeonida:old-pr/9922
ProjectLeonida:old-pr/9948
ProjectLeonida:old-pr/7189
ProjectLeonida:old-pr/9957
ProjectLeonida:old-pr/9823
ProjectLeonida:old-pr/9807
ProjectLeonida:old-pr/9851
ProjectLeonida:old-pr/9774
ProjectLeonida:old-pr/9830
ProjectLeonida:old-pr/9836
ProjectLeonida:old-pr/9822
ProjectLeonida:old-pr/9783
ProjectLeonida:old-pr/9833
ProjectLeonida:old-pr/9890
ProjectLeonida:old-pr/9770
ProjectLeonida:old-pr/9769
ProjectLeonida:old-pr/9772
ProjectLeonida:old-pr/9787
ProjectLeonida:old-pr/9852
ProjectLeonida:old-pr/9834
ProjectLeonida:old-pr/9845
ProjectLeonida:old-pr/9871
ProjectLeonida:old-pr/9771
ProjectLeonida:old-pr/9776
ProjectLeonida:old-pr/10005
ProjectLeonida:old-pr/9949
ProjectLeonida:old-pr/9923
ProjectLeonida:old-pr/9805
ProjectLeonida:old-pr/9829
ProjectLeonida:old-pr/9790
ProjectLeonida:old-pr/9827
ProjectLeonida:old-pr/9929
ProjectLeonida:old-pr/9855
ProjectLeonida:old-pr/9934
ProjectLeonida:old-pr/9907
ProjectLeonida:old-pr/9910
ProjectLeonida:old-pr/9779
ProjectLeonida:old-pr/9780
ProjectLeonida:old-pr/9885
ProjectLeonida:old-pr/9882
ProjectLeonida:old-pr/9877
ProjectLeonida:old-pr/9998
ProjectLeonida:old-pr/4251
ProjectLeonida:old-pr/9987
ProjectLeonida:old-pr/9989
ProjectLeonida:old-pr/9950
ProjectLeonida:old-pr/9777
ProjectLeonida:old-pr/10044
ProjectLeonida:old-pr/9884
ProjectLeonida:old-pr/2906
ProjectLeonida:old-pr/5076
ProjectLeonida:old-pr/9937
ProjectLeonida:old-pr/9986
ProjectLeonida:old-pr/3014
ProjectLeonida:old-pr/9943
ProjectLeonida:old-pr/9939
ProjectLeonida:old-pr/4682
ProjectLeonida:old-pr/4765
No reviewers
Labels
Clear labels
No items
No labels
Milestone
Clear milestone
No items
No milestone
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Reference
ProjectLeonida/mandy!2567
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2567"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ubiquitarianism/leonida. Originally posted by wish131400 on 2026-11-28T08:48:16Z.
Claim: BCPACK-STANDALONE-BC1-BC7.
Depends on: no unmerged PRs. Updated by a normal merge of
mainatb053a1813c8980c4357d51bbe6e69a35dc8c476c; published decoder history is preserved.What and why
Valid BC1/BC4 streams could fail the Rust lane schedule, BC2 was missing, and the older C++/Python production paths depended on incomplete or fitted initial dictionaries. This PR supplies fixed-dictionary BC1-BC7 decoding in the Rust D3D12 runtime, C++ DirectStorage shim and Python assets exporter, without requiring a GDK installation, calibration profile or history sidecar. The original Rust BC7 dictionary-index correction is reconciled with the overlapping correction now in main and checked against independent synthetic outputs.
d049001ab9a906588f47868277b77e9a00e27053(#3293), preserving notices and scalar/CPU-checked AVX2 dispatch.bcpack_research.py; legacy quality/history arguments cannot change production output.Development included implementation inspection and synthetic GDK API queries; this is not presented as a strict clean-room implementation. No SDK binaries, private headers, disassembly, game payloads or title-derived fixtures/reports are included. GDK was a local oracle for synthetic inputs; shipped code and tests require neither GDK nor game files. The original audit of 15,402 synthetic streams per implementation and 168 synthetic compressor roundtrips is documented in
docs/bcpack-standalone.md; those historical counts are separate from this refresh's validation below.Reconciliation with current main
Other historical overlaps and their status are recorded in
docs/bcpack-standalone.md. No unmerged proposal is a prerequisite.Validation after this merge
Windows x64, MSVC 19.43, Windows SDK 10.0.22621, Python 3.14, Rust 1.98.1; CPU/synthetic tests, no game files or GPU commands used:
leonida-formats: 48 passed, 8 existing ignored, 0 failed; Clippy with--all-targets -- -D warningsand formatting passed.b053a1813fail atbc1-ep0-ix0(stream ends early/corrupt). The merged decoder passes all 1,076 goldens, including scalar/dispatched lane parity.--check, Python compilation,make_game.py --help, line-ending tests, repository game-data screening and whitespace checks passed.A separate read-only reviewer audited the full PR against current main and the conflict-resolution delta. Its legacy-stress migration finding was addressed and re-reviewed; it independently reran production/stress, multilevel fitting, runtime staging, Rust goldens and hygiene checks.
Native validation here covers the standalone BCPack CMake targets and a directly compiled DirectStorage test, not a full Windows runtime build. The review-requested 300-second in-world run remains outstanding. No game/GPU image or frame-rate result is claimed for this refresh, and finite synthetic tests do not prove every possible input bit sequence. GitHub CI status is reported separately by the checks on the pushed commit.
Earlier independent results: Windows verification, Linux/gfx906 verification. Those belong to their contributors and are not GPU/game tests of this merge.
GPUs tested: n/a; profile Z, CPU/synthetic validation only.
AI-assisted: yes, Codex (GPT-6), including a separate read-only GPT-6 reviewer agent. Exact serving variants are not exposed in this environment.
Checklist
Imported from ubiquitarianism/leonida. Originally posted by ecox982745 on 2026-11-28T09:03:00Z.
The full Windows runtime builds at
3501c5bfa729a6d807263c51074ea25a51672c91. On Windows 11 x64 with MSVC 19.44, Ninja Release and Windows SDK 10.0.26100.0, CMake linked bothgta6rt.exeanddstorage_test.exewithLEONIDA_BUILD_WINDOWS_RUNTIME=ON. Ninja’s dependency record for the runtime’s DirectStorage object confirms it compiled against the 26100 D3D12 and Windows headers.I checked the production decoder library and queue objects from that build using the PR’s committed synthetic BC1–BC7 expected outputs:
S_OKand exact output.S_OKand exact output.The queue checks covered 19 fixtures per codec, in both modes, for 1,099,776 output bytes. I selected inputs smaller than their destination, as the queue requires for compressed requests. The smaller-output examples were checked through the decoder library. A local client submitted the requests and waited for completion before comparing bytes. I built the stock DirectStorage test executable; these execution counts are from the local client. GPU rendering and game performance remain unmeasured here.
AI-assisted with OpenAI Codex (GPT-6).
Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-28T09:31:01Z.
Review: APPROVED
Reviewed the core Rust, C++, DirectStorage shim, vendored
third_party/x2w-bcpackdecoder, Python standalone integration, and license/notice files, and tested merged ontomain(493867366) with full Windows runtime enabled (MSVC 19.44, Ninja Release, Windows SDK 10.0.26100.0) and Rust 1.100.1.Code review notes
d3d12/crates/leonida-formats/src/bcpack.rs): fixing the BC7 dictionary record offset (reading all 32i16indices per entry), replacing the lane loop withStreamLaneper-lane output budgets and terminal-state checks, adding nonzero-tail rejection, and implementing 15-lane BC2 reconstruction are all clean and well-bounded.third_party/x2w-bcpack/bcpack_decoder.h,runtime/src/bcpack.cpp,runtime/shims/dstorage.cpp): runtime AVX2 dispatch checks CPUID leaf 7, POPCNT, OSXSAVE, AVX,_xgetbv(0) & 0x6, and calls_mm256_zeroupper();X2W_BCPACK_LANE_TESTSstays confined tobcpack_testso there is no ODR mismatch ingta6rt_bcpack; attribution (LICENSE-MIT,THIRD_PARTY_NOTICES.md) and provenance/overlap notes (docs/bcpack-standalone.md) are clear. (Minor non-blocking observation:Lane::targetcastsoutput_size / 8touint32_t, which is always safe for DirectStorage's 32-bitDestinationSizeand only theoretical for direct C++ calls above 32 GiB.)tools/bcpack.py,tools/bcpack_standalone.py,tools/ttpf_assets.py): fixed tables cleanly replace production fitting/calibration while keeping offline research isolated intools/bcpack_research.pyand invalidating old stamps viaDECODER_SOURCES.Tests run
cmake --build <build> --target bcpack_test dstorage_test gta6rt): built cleanly withLEONIDA_BUILD_WINDOWS_RUNTIME=ON.ctest --output-on-failure -R "^(bcpack|dstorage)$": 2/2 passed (bcpack,dstorage5.99 s).bcpack_test.exe tests/fixtures/bcpack-standalone.txt: 1076 independent goldens on every supported CPU path (reference, scalar, AVX2); all 128 models; malformed input guards passed.cargo test --manifest-path d3d12/Cargo.toml --locked -p leonida-formats: 42 passed, 0 failed, 5 ignored (5.48 s).test_bcpack.py,test_bcpack_standalone.py,test_bcpack_history_calib.py,test_bcpack_native.py,test_bcpack_tables.py,test_bcpack_tool.py,test_calibrated_texture_extra.py,test_make_game_assets_pools.py,test_ttpf_assets.py,test_ttpf_mips.py,test_docs_links.py,test_ctest_registration.py): 275 passed (14 skipped, 0 failures, 20.84 s).python -I tools/gen_bcpack_standalone_tables.py --check: verified.python -I scripts/check_no_game_data.py: clean.AI-assisted (Antigravity, Gemini).
Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T09:54:44Z.
@wish131400 —
VERIFY-2567-LINUX-VEGA20: tested3501c5bfmerged cleanly with3ca0707dd, synthetic inputs only.Same-input Red → Green: main’s strict Python and native C++ production decoders each matched 44 of the 1,076 committed golden rows and rejected 1,032. The merged decoders matched 1,076/1,076, including 49/49 BC2 and 334/334 BC7. Pure Python and the optional native entropy path both matched. For the same synthetic BC2 and BC7 texture pools, main could not publish a new DDS; merged exported all five mips, 5,456 expected payload bytes per DDS.
Linux Python/export/research suites: 299 passed, one C# tool-dependent skip. Portable C++ BCPack CTest: 1/1. Wine BCPack and DirectStorage CTests: 2/2, including 546 DirectStorage checks. An independent 22-request shim control had 15 failures on main and zero on merged. The C++ path here was scalar/reference, not the MSVC AVX2 path.
Physical gfx906 / RADV Mesa 26.0.8: sampled 16 decoded 8×8 textures spanning BC1–BC7, including signed and unsigned BC6H. Compared to sampling separately uploaded golden blocks, 1,024/1,024 RGBA texels were bit-exact. A BC1 color change affected only the intended 4×4 block. Zero Khronos validation errors or sync hazards. This checks GPU use of the CPU-decoded BC blocks, not GPU BCPack decompression. No Rust results claimed.
Minor documentation mismatch: the module overview in
make_game.pystill recommends a local calibration profile for assets, but productionttpf_assets.load_profile()no longer reads one.AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by wish131400 on 2026-11-28T11:37:41Z.
Updated to
cb947eac0by mergingmainat4a54aedcb; the published decoder commit is preserved and no force push was used.make_game.pymodule overview's obsolete local-calibration recommendation, as noted in the independent Linux review.Validation on Windows x64 / MSVC 19.43: C++ BCPack CTest passed (1,076 goldens on all supported CPU paths); Rust 42 passed, five ignored; DirectStorage 546 checks with zero failures; related Python 308 tests, four skips, zero failures; full translator regression 507 files / 6,410 tests / zero failed files. Docs links (17) and CTest registration (seven) pass, as do generated-table checks, compilation, formatting of changed Rust files, game-data screening and whitespace checks. CPU-only local refresh; no game or GPU run.
For the remaining tool/documentation CI failures, I reran all eight affected test files on an unmodified checkout of the same main commit. Both checkouts have the same ten failing tests; the new generator is no longer in the stdout guard failure list. No tests were disabled. Main's own CI is also failing: https://github.com/ProjectLeonida/mandy/actions/runs/46138636141 . Previous runtime CI GPU failures are outside the decoder tests and are not claimed fixed here.
The upstream conflict-label workflow currently reports HTTP 403 / installation API rate limiting, so the label can lag behind GitHub's actual mergeability calculation.
AI-assisted: Codex.
Imported from ubiquitarianism/leonida. Originally posted by GrahamboJangles on 2026-11-29T13:49:42Z.
Review: COMMENTED
Independent review pass (overnight shift; verification from a Windows x64 checkout, Python 3.14.9).
Claim protocol: verified.
BCPACK-STANDALONE-BC1-BC7appears exactly once as aclaiming:line in #1608 and once asdone: … -> #2567;gh pr list --search "BCPACK-STANDALONE"returns only this PR — no claim squatting. Body declaresAI-assisted: yes — CodexandGPUs tested: n/ahonestly, and provenance is explicit (not clean-room; GDK used only as an oracle for synthetic inputs).Local grounding at the PR head
cb947eac0: ran the six Python bcpack suites unmodified:tests/test_bcpack_standalone.py: 3 tests OK in ~4.2 s — the committed 1,076 goldens decode byte-exact through the pure-Python path (native entropy skipped: no wheels here). Thelen(cases) == 1076assertion fired, so the fixture count is real.test_bcpack20 OK;test_bcpack_native12 skipped (native module absent);test_bcpack_tables34 OK;test_bcpack_tool18 OK (1 skip);test_bcpack_history_calib19 OK. Total: 106 tests, 0 failures.Delta vs fresh main
54b2a81e9: on anorigin/maincheckout the same suite has a red —tests/test_bcpack_history_calib.py::test_resolve_pools_deduplicates_macos_case_and_accents_and_keeps_case_sensitivefails (AssertionError: 1 != 2), andtest_bcpack_standalone.pydoes not exist on main at all. At the PR head that file is green. Note the greenness partly comes from removing five test methods fromtest_bcpack_history_calib.py(the macOS case/accents pool-dedup test among them — net 24→19 tests in that file). Since open PR #1538 (BCPACK-CALIB-DEDUP-PATH-GUARD) also owns pool dedup/guard coverage, maintainers should confirm no dedup-guard coverage is silently lost when the calibration path is pared down.Merge status needs work — flagged. GitHub reports this PR CONFLICTING / DIRTY against current main. The refresh merged
mainat4a54aedcb, but main has since merged, after that point: #2512 (assets BCPack strict history, merged 2026-11-29T08:14:19Z), #1422 (bcpack_tool hardening, merged 2026-11-28T20:15:13Z) and #1013 (assets pools parallel) — I confirmed none of their head commits are ancestors ofpr2567(git merge-base --is-ancestor→ false for all three). A local preview merge (pr2567←origin/main@54b2a81e9) conflicts in 14 files:README.md,docs/directstorage.md,make_game.py,runtime/CMakeLists.txt,runtime/shims/dstorage.cpp,runtime/src/bcpack.cpp,runtime/src/bcpack.h,runtime/test/dstorage_test.cpp,tests/test_bcpack_history_calib.py,tests/test_ttpf_assets.py,tools/bcpack_calibration/README.md,tools/bcpack_tool.py,tools/gen_bcpack_runtime_tables.py,tools/ttpf_assets.py. The PR needs a second refresh onto current main — and since #2512 (previously listed as an open overlap) has now landed, the "production needs no external history" claim has to be reconciled against main's merged strict-history asset path before this can merge.CI on head: passes
windows,semantic-tests,translator-tests,viewer-tests,change-scope,no-game-data; failslinux-gpu-tools,macos,macos-python,stdlib-tests-linux(+ one unnamed check job). Consistent with the body's honest "not globally green; main's CI also fails" statement — the passing jobs are the decoder-relevant ones.Verdict: decoder work is solid — I independently reproduced the goldens end-to-end in pure Python at the head, and the local suite is 0-failure. Not approving from my side while the merge state is CONFLICTING: request-change is the refresh-onto-current-main plus the #2512 reconciliation. Commented review, no merge action taken.
Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-11-29T17:38:56Z.
Mechanical note, no review: this branch conflicts with
main(4364a4fa6) on a rebase, and the conflict is smaller than it sounds.git merge-tree --write-tree origin/main refs/pull/2567/headreports 15 conflicted file(s):d3d12/crates/leonida-formats/src/bcpack.rs,docs/directstorage.md,make_game.py,README.md… (15 in total)This is the heaviest of the five: 49 files changed, 10130 insertions and 2033 deletions, and 1320 commits behind. A rebase here is real work, not a formality.
So a rebase is all it needs - the change itself may well be fine, I have not looked at its content, only at whether git can apply it.
Written with an AI assistant.
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-29T21:54:26Z.
Tried
cb947eac0againstmain060c47160(Windows 11, Rust toolchain fromd3d12/rust-toolchain.toml, CPU only): it no longer merges,git mergeconflicts withmain. Not tested further.mainalone,cargo test -p leonida-formats --lockedgives 41 passed, 5 ignored, and clippy has 0 findings for that crate.main? I will rerun the tests on the new head.AI-assisted (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by GrahamboJangles on 2026-11-30T08:25:32Z.
Review: COMMENTED
Follow-up re-check after the reconcile push (head
cb947eac0->7078256d18), 2026-11-30.Merge reconciliation verified. The new merge commit
7078256d18has second parentb8bd37111, which is on current main (e1fe82f63), and #2512's head (a23d69194) is now an ancestor of the PR head. GitHub reports the PR MERGEABLE against main; the 14-file conflict from the previous head is resolved. The head is ~20 commits behind current main, but sinceb8bd37111is on main, the merge-into-main effect is exactly the diff I analyzed locally.Local verification at the new head (Windows, Python 3.14, unmodified suites, checkout of head
7078256d18):Semantic-tests CI failure at the new head is inherited, not introduced. Reproduced locally with scripts/run_semantic_tests.py tests/semantic on both tiers: identical result on the PR head and on a fresh main checkout — "529 files, 6526 tests, 1 files failed" both times. The single failing file is tests/semantic/test_interp_computed_ij_fallback.py with two failures on both tiers: test_p1lv_f16_computed_ij_uses_interpolated_attribute_not_vsrc2 (AssertionError: 17407 != 17408) and test_perspective_fixture_branch_and_f16_halves (0.07745361328125 != 0.0775146484375). Nothing in this PR touches interp fallback; main's CI is red the same way.
One semantic note for maintainers. Vs current main the PR's net effect is 50 files, +10,234/-2,322. In runtime/src/bcpack.cpp, bcpack.h, shims/dstorage.cpp and their test, the PR is a net deletion (~633 lines removed vs the four files' current main state): it replaces the history-dependent bcpack implementation — including what #2512 (ASSETS-BCPACK-STRICT-HISTORY) landed on main — with the x2w-bcpack standalone decoder. #2512's head is contained and main's bcpack suites stay green at the head, so nothing measurable breaks; but #2512 had landed by the time the original body was written only as an open overlap, so please confirm deleting the strict-history decode path is the intended supersession rather than an oversight.
CI at
7078256d18: windows, linux-gpu-tools, translator-tests, viewer-tests, change-scope, no-game-data pass; check, macos, macos-python, semantic-tests, stdlib-tests-linux fail, all inherited from main as shown above. With the conflicts resolved and no test regression vs fresh main, the main remaining risk is the #2512 supersession question above.Imported from ubiquitarianism/leonida. Originally posted by KelboLive on 2026-11-30T16:53:48Z.
Independent check on Windows (not the author), at
7078256d1.cargo test --locked -p leonida-formats --lib(shared warm target): 42 passed, 0 failed, 5 ignored in 5.7 s.payload_step_matches_the_reference_decode, pass.Environment: Ryzen 9 7950X3D, Windows 11 Pro 10.0.26200.9711, Rust 1.98.1 pinned.
AI-assisted: yes (opencode).
Imported from ubiquitarianism/leonida. Originally posted by deleted-user on 2026-12-01T11:53:09Z.
Review: CHANGES_REQUESTED
Keeping #2567 over closed #1974 (
#1974only optimized the legacy fitted-historyruntime/src/bcpack.cppthat this PR replaces with standalone BC1–BC7 decoding across C++, Rust, and Python).Holding from merge until the current conflicts with
mainare resolved and CI is green.(AI-assisted review.)
Imported from ubiquitarianism/leonida. Originally posted by Kal0s-design on 2026-12-02T15:52:46Z.
Ran natively on Windows 11, head
7078256d1tested on its own. It does not merge cleanly into currentmain(3c106eb2f):git merge-treereports conflicts in 2 files,d3d12/crates/leonida-formats/src/bcpack.rsandtests/test_make_game_runtime_staging.py. Everything below ran at the PR head, except themaincolumns, which ran at3c106eb2fin a separate build directory. CPU only, synthetic inputs only.1. What the
bcpack.rsconflict means (measured)Since the PR's last
mainmerge (b8bd37111),mainhas changedbcpack.rsthrough #2690 (AVX2 rANS model lookup), #2715 (BC7 index LUTs and 8-byte BC1/3/4/5 post-processing) and1341d658b. This is fromgit log b8bd37111..main -- bcpack.rs.The PR's 1,076 fixture rows through current
main's Rustbcpack::decode:mainalready produces correct BC7 bytes (b589e0fe0,1e090c6a9). The Rust side of this PR is therefore now BC2 support plus the BC1/BC4 streamsmain's lane scheduler rejects.mainoutputs no wrong bytes, it only rejects.Rust decode speed, release build, single thread, MB of BC output per second. Medians of 3 interleaved runs, run-to-run spread about ±10%:
mainbcpack_throughput(16,384 random blocks), BC1If the conflict is resolved by taking the PR's
bcpack.rs, the Rust DirectStorage decode gets about 1.4-1.9x slower. That would undo #2690 and #2715. Porting the BC2 and lane-scheduler fixes ontomain's current file would keep both. The fixture table above is the check for that port.2. Differential fuzz across the three implementations at the head (measured)
I built a corpus from the 1,076 goldens: every truncation length, 32 single-bit flips and 32 random overwrites of 1-4 bytes per row, zero and non-zero tails, 8 wrong destination sizes, codec ids 0-8 and 255, and 20,000 random streams of up to 2,048 bytes.
x2w_bcpackreference / scalar / AVX2, MSVC 19.50/O2/fsanitize=addresstools/bcpack.py, native lanes offA 64 or 512 MiB destination with a 64-byte source fails at once in Rust.
Two divergences, both on corrupt input only. Neither affects the goldens.
invalid lane terminal state. By codec: BC1 7, BC2 6, BC3 7, BC4 15, BC5 5, BC6H 112, BC7 79 (out of 160,423 inputs Rust rejects)._decode_lanes_raw, which the PR leaves unchanged, has no equivalent of Rust's final-state check (final_state∈ {LOW,0x10000,0x100}) or C++'s, so a non-flush fragment can end in any state. Smallest example: BC6H, 1 block. Python returns562e3af030f4b3b28a419244dbb4ed2a; Rust and all three C++ paths reject it:10101010101004100404040404040404010101010104040400000202020101011070000000000000104003030302020200000202020505051010101010101010040404040404040410101001010101040808080202020200000000000000003809090903030303901111110202020200So the assets exporter could publish a DDS from a chunk both runtimes would fail. I did not trace this through the exporter.
mode out of rangeand BC7unused BC7 control code, both raised during block rebuild after the lanes decoded. The rest is from reading the code. The C++ DirectStorage shim decodes intoscratch, so it is unaffected. The Rust HLE path (leonida-hle/src/modules/dstorage.rs,into_destination) decodes straight into title memory, both for non-paged destinations and for paged ones mapped as one contiguous window. In those cases a failed request leaves partly written texture data in title memory. Scattered page lists are staged first.main'sbc6/bc7return the same errors from inside the block loop, so this predates the PR.Minor: for codec ids 0, 8 and 255 Python raises
BcpackUnsupportedCodec. That is aNotImplementedError, not aBcpackError, so a caller that catches onlyBcpackErrorwill not see it.3. Block coverage of the emitted BC data (reading the fixture's expected bytes)
All 8 BC7 modes appear (mode 6: 8 blocks, mode 7: 3,140). All 14 BC6H modes appear (160-1,737 blocks each). BC1, BC2 and BC3 colour blocks have both endpoint orderings (
c0 > c1andc0 <= c1; only BC1 then selects the 3-colour/punch-through mode, 4,408 blocks), and BC3, BC4 and BC5 have both 6- and 8-value alpha. Across the 7,277 accepted fuzz outputs (141,316 BC7 and 137,077 BC6H blocks), no BC7 block had the invalid mode byte0x00and no BC6H block had a reserved mode. The decoders reject those records rather than emitting them.4. Other speeds at the head (fixture rows, MB/s, single thread, timed separately from §1 under different machine load)
5. Suites at the head (measured, matching earlier reports)
cargo test -p leonida-formatsgives 42 passed, 5 ignored. Thebcpack_testgoldens pass on all 3 CPU paths. The PR's Python suites pass with-I:test_bcpack*,test_ttpf_*,test_make_game_assets_pools,test_make_game_runtime_stagingandtest_calibrated_texture_extra, 334 tests, 0 failures.cargo clippy -p leonida-formats --all-targets -D warningsfails at the head with one error,precedenceattexture.rs:1346. The PR does not touch that file, and the same command passes on currentmain.bcpack.rsandbcpack_bc2_tables.rsare clippy- and rustfmt-clean. Nit: with MSVC 19.50,runtime/test/bcpack_test.cpp:36raises C4244 at/W4becausestd::fillis called withint0xa5.Not checked: BCn to RGBA decoding on the GPU or WARP, per-mode texel error, and BC6H NaN/inf/denormal/sign handling. The PR stops at BC block bytes and contains no texel decoder, so these do not apply to it. Also not checked: the full Windows runtime / CMake build, the DirectStorage shim test, the optional native Python library, streams over 1,024 blocks from a real encoder, a hand-resolved merge with
main, and any game run.GPUs tested: n/a (CPU-only tests).
AI-assisted: yes (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T18:01:33Z.
Triage only: head
7078256d1conflicts with currentmain45dc41f95, and five CI jobs fail on that head. Not tested further.CI on
7078256d1(2026-11-30):stdlib-tests-linux,macos-python,check,semantic-tests (ubuntu-latest)andmacosallfailure. Thestdlib-tests-linuxlog fails intests/test_dstorage_multilevel_fit.py, for example:That suite exercises the BC7/BC6H paths this PR replaces (
tools/bcpack.py-993 lines,runtime/src/bcpack.cpp-424 lines), so these are probably caused by the change, not by the runner. I have not confirmed that on a merge because the branch does not merge.Scope note for review once it is rebased: 50 files, including about 6,000 lines vendored under
third_party/x2w-bcpack/(bcpack_tables*.h/.inl) andtools/bcpack_standalone_tables.json. Per CONTRIBUTING.md, a reviewer should confirm where those tables come from (an MIT-licensed decoder, or values measured from retail data) before merge, and runpython -I scripts/check_no_game_data.pyon them. Splitting the vendored decoder from the tool and runtime changes would make the review tractable.The branch has been conflicting since 2026-11-29 (noted by @fiestorra and @MoonEyes) with no push since 2026-11-30.
Verdict: conflict (also blocked on CI failures).
AI-assisted verification: Claude Opus (Claude Code), separate agent per batch.
Generated by Claude Code
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T22:01:43Z.
This pull request touches the render path, so it needs an in-game run before it can be merged: unit tests and CI do not catch rendering regressions (a device loss after an earlier merge is why this gate exists).
Could you, or anyone with a working setup, post a run report on the current head merged onto current
main:mainSHA it was merged onto;mainalone for comparison, if you can.Please do not attach logs or screenshots that show game content. If a run on this exact head is already posted, a link to it in a reply is enough.
AI-assisted (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-03T07:02:28Z.
VERIFY-2567 — 208 tests y 1289 subtests en verde en la PR de decodificación de BC1–BC7, y el
1118es el número que importa50 ficheros, +10 234: 8 en
runtime/, 13 entools/, 12 entests/, 2 end3d12/. Los tests de Python que toca, corridos en su árbol:Y
1118 subtestsen un fichero con 3 tests significa una cosa: la tabla de decodificación se comprueba entrada por entrada, que es exactamente cómo se prueba un decodificador de bloques comprimidos — no con tres casos elegidos a mano, sino con el espacio entero.Lo que la PR hace, por su título: decodificación BC1–BC7 standalone, es decir sin las bibliotecas del sistema, en los dos runtimes y en las herramientas de assets. Y la razón de que exista: un bloque BC decodificado de forma distinta en el runtime C++ y en el port es una textura que se ve distinta sin que nadie sepa por qué — la misma familia que
#2686,#2807y#2698: dos implementaciones de lo mismo y ninguna forma de compararlas.Lo que verifiqué: los seis ficheros de test de las herramientas que toca, y que los 1289 subtests pasan.
Lo que no: la decodificación en la GPU ni en el runtime C++ — eso es el build de 50 ficheros y necesita el juego con sus texturas. Lo que sí puedo decir es que la parte que se puede comprobar sin GPU está comprobada exhaustivamente, y que es la parte donde un error de tabla se propaga a todas las texturas.
Y una nota sobre el
2 skippeddettpf_assets: los dos que se saltan son de assets que no están en este checkout, y el test lo dice en vez de fallar — la misma elección que hice en mi guarda de i18n, por el mismo motivo.Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-03T10:08:47Z.
Estado de la rebasada, medido hoy: no es de las mecánicas, y mejor saberlo antes de empezar.
Y la diferencia entre las dos listas es la de siempre:
merge-treedice en qué choca la fusión de dos árboles, y el cherry-pick dice en qué choca aplicar el parche commit a commit — quince contra dos, porque la PR es anterior a la reorganización deruntime/ytools/.Lo que ya está comprobado y no hace falta repetir (lo corrí en la sesión del 2-dic):
pytest tests/test_bcpack_history_calib.py tests/test_ttpf_assets.py→ 208 tests y 1289 subtests, en verde, y elbcpack_testdel runtime compilado y ejecutado. Lo que no: si sigue en verde sobremainde hoy, porque para eso hay que rebasarla y esos quince conflictos son de contenido, no de posición (runtime/cambió de sitio).No la voy a rebasar yo: 15 ficheros es tocar el trabajo de otro sin poder ejecutar el juego, y prefiero decirlo antes que dejar un rebase a medias.
Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-03T13:09:29Z.
I rechecked the refreshed head
ea26edfbon Linux. It includesmainb053a181and also merges cleanly with #3271 (cfecc6ba).The earlier merge conflicts are resolved on this head. CI, D3D12 runtime, and No Game Data all succeeded on
ea26edfb. This was synthetic CPU verification. The in-game gate remains open.AI-assisted (Codex).
Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-03T13:14:48Z.
Rust throughput after the
ea26edfbrefresh. Following up on the earlier measurements, the refresh improves throughput over7078256din every codec I measured. It still delivers 24–32% less output per second thanmain(b053a181) on inputs all three builds decode correctly.b053a1817078256dea26edfbFigures are median MB of decoded BC output per second across six interleaved samples per build. I compiled the three
bcpack::decodeversions with rustc 1.98.1 (-C opt-level=3 -C codegen-units=1) on Linux and pinned the thread to one core of a Ryzen 7 7800X3D. Both PR revisions matched all 1,076 committed synthetic reference outputs. The time trials used the shared byte-exact cases per codec, with reused output buffers. BC2 compares the two PR revisions becausemainlacks BC2 support.The gap persisted on a second physical core (23–31%) and on the 8–16 KiB output subset with rustc 1.97.1 and reversed run order (24–33%). This measures CPU decoder throughput on synthetic inputs. The requested in-game run remains open.
AI-assisted (Codex).
Imported from ubiquitarianism/leonida. Originally posted by EdenBendheim on 2026-12-03T13:45:20Z.
RUN (RTX 3090 24 GB) — both exact-head candidate and main-only 300 s compatibility gates PASS.
ea26edfb15aa223a0e846b37d71ef6d6f3aa205econtains pinned mainb053a1813c8980c4357d51bbe6e69a35dc8c476c(merge no-op). Candidate exe SHA-256be2046d3c49a847445dd516ffbd27fd6d6db2c67600758ca1784296b64d18e4e; main8ddb36f22fd4c0883f3d633cb9317f40c26d5b24c73302115939554a8895d576. Both locked Rust 1.98.1, diagnostics,dlss,mimalloc.World+60 measured 2,157/1,586 present intervals, draw medians 5,359.5/8,473; zero sampled pipeline-busy windows. DirectStorage in this window reported 106,620/80,268 completed requests and 317/171 MB of BC destination-size counters. These counters are truncated per report and omit the final partial interval; they are not exact decoded bytes. Both runs showed substantial streaming activity, no logged request/table failures or device losses, and cache saved on normal target stop. Both native placements confirmed; 25/25 vs 19/19 near-location samples, sustained observed suffix 243.967/192.098 s. The different workloads and time at location preclude FPS or throughput attribution.
Synthetic Rust BC tests: 17 passed, 4 ignored on candidate; 16 passed, 4 ignored on main; zero failures. Candidate includes independent 1,076 synthetic golden fixture test. Author's existing red evidence not repeated. No per-codec coverage or visual correctness conclusion from the runtime gate. Clean-room file scan and diff check passed; author explicitly notes implementation inspection and synthetic GDK oracle in provenance. This report covers compatibility and existing synthetic tests only, no additional SDK code or game payloads copied.
AI-assisted: Codex GPT-6.2 Sol (tester and independent numeric check). No game content attached.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.