fix(bcpack): standalone BC1-BC7 decoding across runtimes and assets #2567
Closed
leonida/mandy
wish131400 wants to merge 4 commits from
github-pr/2567 into main
pull from: github-pr/2567
merge into: leonida:main
leonida:main
leonida:github-pr/3295
leonida:beta
leonida:docs/changelog-3483-3500
leonida:github-pr/3294
leonida:github-pr/2975
leonida:github-pr/2815
leonida:feat/gate-driver-start
leonida:feat/skip-pipelines-release
leonida:perf/lazy-compare
leonida:perf/mwaitx-wait
leonida:test/prio-ceiling-main
leonida:fix/ab-cpu-stdout
leonida:fix/gate-old-crashes
leonida:diag/ab-cpu
leonida:test/main-0312
leonida:github-pr/3291
leonida:diag/indirect-clamp-census
leonida:feat/barrier-enhanced
leonida:perf/texture-frame-ceiling
leonida:perf/dstorage-threads
leonida:fix/console-queue-dma-tables
leonida:fix/port-descriptors-record-parts
leonida:fix/frame-waits-fence
leonida:fix/console-sampler-words
leonida:fix/graphics-userdata-spill
leonida:fix/xg-reserved-layout-rotation
leonida:fix/barrier-console-flags
leonida:fix/switches-wait-test-child
leonida:test/list-value-waits
leonida:test/lot-gxdk-0412
leonida:fix/bvh-compacted-size
leonida:docs/i18n-quickstarts
leonida:feat/native-pipeline-slots
leonida:fix/clippy-leonida-gpu
leonida:fix/list-value-producers
leonida:fix/descriptor-page-straddle
leonida:fix/xmem-low-window
leonida:fix/ffx-jitter-never-zero
leonida:fix/run-stdout-closed
leonida:github-pr/2892
leonida:github-pr/2896
leonida:feat/warm-save-every
leonida:github-pr/2980
leonida:github-pr/2994
leonida:github-pr/3005
leonida:github-pr/3010
leonida:github-pr/3136
leonida:github-pr/3303
leonida:github-pr/3220
leonida:github-pr/3143
leonida:github-pr/3330
leonida:github-pr/3226
leonida:github-pr/3187
leonida:carry/3395
leonida:github-pr/2946
leonida:github-pr/2947
leonida:github-pr/2945
leonida:github-pr/2983
leonida:github-pr/3001
leonida:github-pr/3372
leonida:github-pr/3128
leonida:github-pr/3296
leonida:github-pr/2588
leonida:github-pr/3119
leonida:github-pr/3378
leonida:fix/crash-diagnostics
leonida:feat/dlss-mip-bias
leonida:fix/retired-out-of-order
leonida:fix/dxr-postbuild-barrier
leonida:fix/amd-relay-default
leonida:fix/removed-report-wait
leonida:feat/heap-twin
leonida:feat/vram-margin
leonida:github-pr/2472
leonida:github-pr/3123
leonida:github-pr/3088
leonida:assets/annonce-v1
leonida:github-pr/2794
leonida:github-pr/3300
leonida:github-pr/3304
leonida:github-pr/3308
leonida:github-pr/3367
leonida:github-pr/3369
leonida:fix/launcher-dlss-diagnostics
leonida:github-pr/3269
leonida:github-pr/2957
leonida:github-pr/3205
leonida:fix/crash-zero-guard
leonida:github-pr/3185
leonida:github-pr/3099
leonida:github-pr/3104
leonida:github-pr/3348
leonida:github-pr/3379
leonida:github-pr/3377
leonida:perf/darner-title-priority-ceiling
leonida:github-pr/3376
leonida:gh-readonly-queue/main/pr-3311-b5c45b663dbc5a9c3532bb3f307e5f81b32faefa
leonida:gh-readonly-queue/main/pr-3088-af22e7847ff5808f72d1a1881c24be2fafd20b54
leonida:gh-readonly-queue/main/pr-3123-7f3fa026a94c6646e89244f28e1ce22290361867
leonida:github-pr/3373
leonida:github-pr/3368
leonida:github-pr/3198
leonida:gh-readonly-queue/main/pr-3354-637baa0b77ba47222e7280b17c1a59c6a1781d57
leonida:gh-readonly-queue/main/pr-3365-d7a0e0196a43834813014b4bd3aa5502a8263b14
leonida:gh-readonly-queue/main/pr-3361-5dfe8bbd05ed12fb2f2e1718d9af77a7c5f46fd8
leonida:gh-readonly-queue/main/pr-3366-8da9148204e9d12c585efa9ac2b7cc1ab08c7682
leonida:github-pr/3346
leonida:github-pr/3375
leonida:github-pr/2958
leonida:github-pr/3151
leonida:github-pr/3307
leonida:github-pr/3278
leonida:github-pr/3374
leonida:fix/runtime-test-conservative-fixtures
leonida:github-pr/3366
leonida:ci/shard-semantic-linux
leonida:github-pr/3354
leonida:docs/fg-limit-fps-switch
leonida:github-pr/3365
leonida:fix/read-file-hard-link
leonida:github-pr/3364
leonida:fix/book-slot-heap-never-read
leonida:github-pr/3361
leonida:github-pr/3263
leonida:github-pr/3360
leonida:github-pr/3353
leonida:github-pr/3331
leonida:fix/alias-later-queued-submissions
leonida:github-pr/3352
leonida:github-pr/3228
leonida:github-pr/3349
leonida:claude/gallant-sagan-aamatr
leonida:github-pr/3200
leonida:github-pr/3132
leonida:github-pr/3323
leonida:github-pr/3332
leonida:github-pr/3340
leonida:github-pr/3311
leonida:github-pr/3334
leonida:github-pr/3297
leonida:github-pr/3256
leonida:github-pr/2851
leonida:d3d12/agility-sdk-621
leonida:github-pr/3164
leonida:github-pr/3114
leonida:github-pr/3050
leonida:github-pr/3113
leonida:github-pr/3326
leonida:github-pr/3144
leonida:github-pr/2642
leonida:github-pr/3072
leonida:github-pr/2789
leonida:github-pr/2643
leonida:github-pr/3009
leonida:github-pr/3035
leonida:github-pr/3031
leonida:github-pr/2686
leonida:github-pr/2834
leonida:github-pr/3321
leonida:github-pr/3325
leonida:github-pr/3290
leonida:github-pr/3324
leonida:github-pr/3130
leonida:claude/fervent-curie-m19lnr
leonida:github-pr/3309
leonida:github-pr/3305
leonida:github-pr/3306
leonida:github-pr/3302
leonida:github-pr/3301
leonida:github-pr/3345
leonida:github-pr/3211
leonida:github-pr/3027
leonida:github-pr/3286
leonida:github-pr/3235
leonida:github-pr/3265
leonida:github-pr/3275
leonida:codex/skip-no-hit-ray-passes
leonida:github-pr/2823
leonida:github-pr/2911
leonida:github-pr/3262
leonida:github-pr/3125
leonida:github-pr/3206
leonida:github-pr/3250
leonida:github-pr/3238
leonida:github-pr/3188
leonida:github-pr/2952
leonida:github-pr/3217
leonida:github-pr/3168
leonida:t3/preserve-fsr-sdk-restart-path
leonida:t3/propagate-host-failure-hresult
leonida:github-pr/3209
leonida:t3/launcher-custom-parameters
leonida:github-pr/3207
leonida:github-pr/3183
leonida:github-pr/3160
leonida:github-pr/3201
leonida:ci/less-to-run
leonida:github-pr/2930
leonida:github-pr/2797
leonida:github-pr/2999
leonida:perf/native-compute-shader-forms
leonida:github-pr/3191
leonida:github-pr/3011
leonida:github-pr/3019
leonida:github-pr/2996
leonida:gh-readonly-queue/main/pr-2789-45dc41f95c1cd0dcc29c2c50582e0e9af8a77259
leonida:claude/blissful-franklin-ukp7ag
leonida:github-pr/3141
leonida:github-pr/3156
leonida:github-pr/3150
leonida:github-pr/3153
leonida:github-pr/3163
leonida:github-pr/3142
leonida:github-pr/3139
leonida:github-pr/2841
leonida:github-pr/3069
leonida:github-pr/3098
leonida:github-pr/3107
leonida:github-pr/3071
leonida:github-pr/2774
leonida:github-pr/2889
leonida:github-pr/3075
leonida:github-pr/2661
leonida:github-pr/3064
leonida:github-pr/3054
leonida:github-pr/3049
leonida:github-pr/2855
leonida:github-pr/2943
leonida:github-pr/3016
leonida:github-pr/2887
leonida:github-pr/3006
leonida:github-pr/3003
leonida:github-pr/2993
leonida:notes/card-time-and-plant-flicker
leonida:github-pr/2989
leonida:feat/vulkan-rs
leonida:github-pr/2985
leonida:github-pr/2951
leonida:github-pr/2982
leonida:github-pr/752
leonida:github-pr/792
leonida:github-pr/2877
leonida:github-pr/2654
leonida:github-pr/2893
leonida:github-pr/2948
leonida:github-pr/2944
leonida:github-pr/2919
leonida:github-pr/2915
leonida:archive/ci/less-to-run/20261202T1121Z
leonida:github-pr/2800
leonida:github-pr/2822
leonida:github-pr/2833
leonida:github-pr/2840
leonida:github-pr/2831
leonida:github-pr/2832
leonida:github-pr/2801
leonida:github-pr/2890
leonida:github-pr/2891
leonida:github-pr/2664
leonida:github-pr/2807
leonida:rt-call-trace
leonida:github-pr/2755
leonida:perf/ahead-split
leonida:github-pr/2587
leonida:github-pr/2698
leonida:github-pr/2609
leonida:github-pr/3219
leonida:docs/readme-runtime-proposal
leonida:github-pr/2017
leonida:github-pr/1741
leonida:github-pr/1667
leonida:codex/coord-claim-check-20261124-7e48
No reviewers
Assignees
Clear assignees
No assignees
Labels
Clear labels
bug
Something isn't working
dependencies
Pull requests that update a dependency file
documentation
Improvements or additions to documentation
enhancement
New feature or request
missing claim
Needs a claim in #14
needs rebase
Conflicts with the base branch: rebase it on main
needs-triage
Needs maintainer evaluation before the next triage state
question
Further information is requested
ready-for-agent
Fully specified and ready for an AFK agent
submodules
Pull requests that update submodules code
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
Projects
Clear projects
No items
No project
Milestone
Clear milestone
No items
No milestone
Dependencies
No dependencies set
Notifications
2 participants
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Reference
leonida/mandy!2567
Loading…
Reference in a new issue
No description provided.
Delete branch "github-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?
Pull request closed
Please reopen this pull request to perform a merge.
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
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).
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).
@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.
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.
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.
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).
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).
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).
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
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).
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.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.
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).
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).
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.
Closing this one, on the maintainer's decision.
The PR states itself that it is not clean-room: the GDK's code was examined to write it (
docs/bcpack-standalone.md:47). That goes against the clean-room rule of CONTRIBUTING.md, so it cannot go into this public repository as it is. An independent review reached the same conclusion.If you want to take BCPack decoding up again, a version written only from observed behaviour and our own measurements (
docs/textures.md), with nothing taken from the GDK, is welcome in a new PR.🤖 Generated with Claude Code