BCPack: the test oracle reads BC7 dictionary entries as Tables::parse does #2236
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2236"
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 trustno1-coder/VIctory-NVIDIA. Originally posted by domx4q on 2026-11-29T10:52:54Z.
What it changes
On current main, three tests in
victory-formatsfail:bcpack::tests::oracle_parity_all_formats_and_strip_boundariesbcpack::tests::oracle_parity_all_bc7_modes_rotations_subsetsbcpack::tests::oracle_parity_errors_and_noisef9de61c5("BC7 dictionary indices read as Microsoft's decoder reads them") changed howTables::parsereads a BC7 dictionary entry: the word after the index widths is now pixel 0's index, and all 32 slots are read. The test oracle intests::ref_oraclekeeps its own copy of the parser (RefTables::parse). That copy still skips that word and reads only 31 slots. The fast decoder and the oracle therefore disagree in the index bytes of every BC7 block that comes from the dictionary, and that is where the tests fail.This changes only the oracle's parser, so that it reads entries the way
Tables::parsenow does. The decoder is unchanged.How it was tested
cargo test -p victory-formats --lib, on Linux:829188e9: 80 passed, 3 failedChecked for overlap
oracle_parityandbcpack. None touches the oracle.Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Halfect on 2026-11-29T11:11:31Z.
Review: APPROVED
LGTM. The reference parser now consumes the same 32 BC7 index words as
Tables::parse, including the word after the widths as pixel 0's index. This corrects the independent test oracle without changing the runtime decoder.I reproduced the before/after locally with
cargo test --locked -p victory-formats --lib:829188e969ffd2907e5867c5d9aca29bd91cb1b6: 80 passed, 3 failed, 7 ignored. The failures are exactlyoracle_parity_all_bc7_modes_rotations_subsets,oracle_parity_all_formats_and_strip_boundaries, andoracle_parity_errors_and_noise.18eaf9476cdeb19a47a8ec9c43cfbeb8446a8fe6: 83 passed, 0 failed, 7 ignored.git diff --check origin/main..HEAD: clean.No game data was used.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Yuanzer on 2026-11-29T12:08:27Z.
Independent integration check on the reporter's Windows 11 machine (AI-assisted):
0b8225e3on the current #2244 branch.18eaf947cleanly as local commit4f09c9bb.Results:
cargo test --locked -p victory-formats oracle_parity -- --test-threads=1: 4 passed, 0 failed, including all three previously failingoracle_parity_*tests.cargo test --workspace --locked --quiet -- --test-threads=1: every crate and application suite passed, includingvictory-gpuwith 919 passed / 57 ignored andvictory-shaderwith 462 passed / 9 ignored.xtask::policy::tests::repository_passes_policyoncrates/victory-loader/src/heap_sites/frame_users.rs(2,022 hex digits in one run). #2244 already documents this separately.cargo clippy --workspace --all-targetsconfigurations with-D warningspass on parent0b8225e3.So this BCPack fix cleanly clears the three failures seen in #2244. It is currently blocked only because current
main's pre-existing Clippy errors stop the check before it reaches tests; once #2019/#2048 or the warning-cleanup commit from #2244 lands, this can be rerun.Tested locally on behalf of the reporter.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by dyshay on 2026-11-29T12:32:25Z.
Same finding here, independently: on
829188e9,cargo test -p victory-formats --lockedfailsoracle_parity_all_bc7_modes_rotations_subsets,oracle_parity_errors_and_noiseandoracle_parity_all_formats_and_strip_boundaries; reading all 32 index words after the two width bytes in the oracle (asTables::parsedoes sincef9de61c5) makes the crate 83 passed, 0 failed. We had reached the same reading of the dictionary entries on our tree earlier (the word after the widths is pixel 0's index, there is no repeated widths word), and a run on an RTX 4090 with it showed no picture regression. +1 for merging.Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by dyshay on 2026-11-29T13:05:10Z.
Merged into our fork's integration branch for testing (dyshay/VIctory-NVIDIA, branch
janus-prs, on top of829188e9plus a couple of local fixes). Read the full diff first: no network, process spawning, binaries, build/CI/dependency changes or game data. Builds with--profile diag --features diagnostics; victory-formats tests: 83 passed, 0 failed (3 parity failures before). In-game runs on an RTX 4090 are queued; I'll report back here.Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Andreww2009 on 2026-11-29T22:30:17Z.
I applied
18eaf947to716a0c99on Windows x86-64 with Rust 1.98.1 and compared all 334 synthetic BC7 cases byte-for-byte against the published outputs from Microsoft’sBCPackDecompress. The old reference reader matched 14/334 and returned different bytes for the other 320. With this patch it matched 334/334. The production decoder matched 334/334 on both revisions. Pinned inputs and expected blocksWould you include a one-block mode 5 regression test that checks each reader against an independently calculated block? I tried this fixture locally:
[2, 2]. Set slots0, 15, 16, 31to1, 3, 1, 2respectively. Leave the other slots and endpoints zero.u128, the expected value is0x20u128 | (1 << 66) | (3 << 95) | (1 << 97) | (2 << 126). Mode 5 layoutWith the old reader, the production assertion passed and the reference assertion failed. With this PR and the extra test,
victory-formatspassed in debug and release (84 passed, 7 ignored in each).Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by danielsteman on 2026-11-30T14:14:56Z.
I confirmed this on current
main(41adb551).cargo test --locked -p victory-formats --lib bcpack::tests::oracle_paritygives 1 passed and 3 failed. The failing tests are the same three listed above, and they fail on macOS (aarch64) as well, so the cause does not depend on the CPU architecture.cargo test --locked -p victory-formats --libgives 83 passed, 0 failed, 7 ignored.These same three tests stop
cargo test --workspaceon other PRs too (for example #3962's Windows run), so merging this unblocks that step for them.Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by RochDawid on 2026-12-01T01:32:31Z.
mainalready has this change.be0ba3b7("bcpack: the BC7 oracle reads the dictionary as Microsoft's decoder does") makes the same edit toRefTables::parse: no skipped word after the widths, and all 32 index slots read. It reachedmainwith the merge of #2565 (ac6b767d, 2026-11-29) and is in every release since v2026.11.30.01.On
mainatf5c3d243,cargo test --locked -p victory-formats --lib oracle_paritygives 4 passed, 0 failed (oracle_parity_all_bc7_modes_rotations_subsets,oracle_parity_errors_and_noise,oracle_parity_all_formats_and_strip_boundaries,oracle_parity_all_bc6_modes). I ran it on a macOS host with Rust 1.98.1, not on Windows.This pull request now conflicts with
mainand has nothing left to add, so it can probably be closed. #2236, #2419 and #3263 all make this same change.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.