BCPack: the test oracle reads BC7 dictionary entries as Tables::parse does #2236

Open
domx4q wants to merge 1 commit from upstream-pr/2236 into main
domx4q commented 2026-11-29 10:52:54 +00:00 (Migrated from github.com)

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-formats fail:

  • bcpack::tests::oracle_parity_all_formats_and_strip_boundaries
  • bcpack::tests::oracle_parity_all_bc7_modes_rotations_subsets
  • bcpack::tests::oracle_parity_errors_and_noise

f9de61c5 ("BC7 dictionary indices read as Microsoft's decoder reads them") changed how Tables::parse reads 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 in tests::ref_oracle keeps 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::parse now does. The decoder is unchanged.

How it was tested

  • cargo test -p victory-formats --lib, on Linux:
    • before, on main 829188e9: 80 passed, 3 failed
    • after: 83 passed, 0 failed
  • Not a shader change. Nothing changes at run time.

Checked for overlap

  • I searched the open pull requests and issues for oracle_parity and bcpack. None touches the oracle.
<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5550003960 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2236). Originally posted by [domx4q](https://github.com/domx4q) on 2026-11-29T10:52:54Z. --- ## What it changes On current main, three tests in `victory-formats` fail: - `bcpack::tests::oracle_parity_all_formats_and_strip_boundaries` - `bcpack::tests::oracle_parity_all_bc7_modes_rotations_subsets` - `bcpack::tests::oracle_parity_errors_and_noise` f9de61c5 ("BC7 dictionary indices read as Microsoft's decoder reads them") changed how `Tables::parse` reads 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 in `tests::ref_oracle` keeps 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::parse` now does. The decoder is unchanged. ## How it was tested - `cargo test -p victory-formats --lib`, on Linux: - before, on main 829188e9: 80 passed, 3 failed - after: 83 passed, 0 failed - Not a shader change. Nothing changes at run time. ## Checked for overlap - [x] I searched the open pull requests and issues for `oracle_parity` and `bcpack`. None touches the oracle.
Halfect commented 2026-11-29 11:11:31 +00:00 (Migrated from github.com)

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:

  • Base 829188e969ffd2907e5867c5d9aca29bd91cb1b6: 80 passed, 3 failed, 7 ignored. The failures are exactly oracle_parity_all_bc7_modes_rotations_subsets, oracle_parity_all_formats_and_strip_boundaries, and oracle_parity_errors_and_noise.
  • PR head 18eaf9476cdeb19a47a8ec9c43cfbeb8446a8fe6: 83 passed, 0 failed, 7 ignored.
  • git diff --check origin/main..HEAD: clean.

No game data was used.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:review:6102611652 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2236#pullrequestreview-6102611652). Originally posted by [Halfect](https://github.com/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`: - Base `829188e969ffd2907e5867c5d9aca29bd91cb1b6`: **80 passed, 3 failed, 7 ignored**. The failures are exactly `oracle_parity_all_bc7_modes_rotations_subsets`, `oracle_parity_all_formats_and_strip_boundaries`, and `oracle_parity_errors_and_noise`. - PR head `18eaf9476cdeb19a47a8ec9c43cfbeb8446a8fe6`: **83 passed, 0 failed, 7 ignored**. - `git diff --check origin/main..HEAD`: clean. No game data was used.
Yuanzer commented 2026-11-29 12:08:27 +00:00 (Migrated from github.com)

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):

  • Parent: 0b8225e3 on the current #2244 branch.
  • Applied this PR's head 18eaf947 cleanly as local commit 4f09c9bb.
  • Toolchain: Rust 1.98.1 x86_64-pc-windows-msvc; i7-14700KF, RTX 5060 Ti 8 GB.

Results:

  • cargo test --locked -p victory-formats oracle_parity -- --test-threads=1: 4 passed, 0 failed, including all three previously failing oracle_parity_* tests.
  • cargo test --workspace --locked --quiet -- --test-threads=1: every crate and application suite passed, including victory-gpu with 919 passed / 57 ignored and victory-shader with 462 passed / 9 ignored.
  • The only workspace failure was the pre-existing, untouched xtask::policy::tests::repository_passes_policy on crates/victory-loader/src/heap_sites/frame_users.rs (2,022 hex digits in one run). #2244 already documents this separately.
  • Both cargo clippy --workspace --all-targets configurations with -D warnings pass on parent 0b8225e3.

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.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7255595552 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2236#issuecomment-7255595552). Originally posted by [Yuanzer](https://github.com/Yuanzer) on 2026-11-29T12:08:27Z. --- Independent integration check on the reporter's Windows 11 machine (AI-assisted): - Parent: `0b8225e3` on the current #2244 branch. - Applied this PR's head `18eaf947` cleanly as local commit `4f09c9bb`. - Toolchain: Rust 1.98.1 x86_64-pc-windows-msvc; i7-14700KF, RTX 5060 Ti 8 GB. Results: - `cargo test --locked -p victory-formats oracle_parity -- --test-threads=1`: **4 passed, 0 failed**, including all three previously failing `oracle_parity_*` tests. - `cargo test --workspace --locked --quiet -- --test-threads=1`: every crate and application suite passed, including `victory-gpu` with **919 passed / 57 ignored** and `victory-shader` with **462 passed / 9 ignored**. - The only workspace failure was the pre-existing, untouched `xtask::policy::tests::repository_passes_policy` on `crates/victory-loader/src/heap_sites/frame_users.rs` (2,022 hex digits in one run). #2244 already documents this separately. - Both `cargo clippy --workspace --all-targets` configurations with `-D warnings` pass on parent `0b8225e3`. 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.*
dyshay commented 2026-11-29 12:32:25 +00:00 (Migrated from github.com)

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 --locked fails oracle_parity_all_bc7_modes_rotations_subsets, oracle_parity_errors_and_noise and oracle_parity_all_formats_and_strip_boundaries; reading all 32 index words after the two width bytes in the oracle (as Tables::parse does since f9de61c5) 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.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7255885105 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2236#issuecomment-7255885105). Originally posted by [dyshay](https://github.com/dyshay) on 2026-11-29T12:32:25Z. --- Same finding here, independently: on 829188e9, `cargo test -p victory-formats --locked` fails `oracle_parity_all_bc7_modes_rotations_subsets`, `oracle_parity_errors_and_noise` and `oracle_parity_all_formats_and_strip_boundaries`; reading all 32 index words after the two width bytes in the oracle (as `Tables::parse` does since f9de61c5) 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.
dyshay commented 2026-11-29 13:05:10 +00:00 (Migrated from github.com)

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 of 829188e9 plus 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.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7256277753 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2236#issuecomment-7256277753). Originally posted by [dyshay](https://github.com/dyshay) on 2026-11-29T13:05:10Z. --- Merged into our fork's integration branch for testing ([dyshay/VIctory-NVIDIA](https://github.com/dyshay/VIctory-NVIDIA), branch `janus-prs`, on top of 829188e9 plus 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.
Andreww2009 commented 2026-11-29 22:30:17 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Andreww2009 on 2026-11-29T22:30:17Z.


I applied 18eaf947 to 716a0c99 on Windows x86-64 with Rust 1.98.1 and compared all 334 synthetic BC7 cases byte-for-byte against the published outputs from Microsoft’s BCPackDecompress. 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 blocks

Would you include a one-block mode 5 regression test that checks each reader against an independently calculated block? I tried this fixture locally:

  • Give the last synthetic dictionary entry index widths [2, 2]. Set slots 0, 15, 16, 31 to 1, 3, 1, 2 respectively. Leave the other slots and endpoints zero.
  • Decode block 0 with dictionary reference 255, zero residuals, one subset and rotation 0. Mode 5 puts the two index sets at bit offsets 66 and 97. Reading the output as a little-endian u128, the expected value is 0x20u128 | (1 << 66) | (3 << 95) | (1 << 97) | (2 << 126). Mode 5 layout

With the old reader, the production assertion passed and the reference assertion failed. With this PR and the extra test, victory-formats passed in debug and release (84 passed, 7 ignored in each).

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7263724506 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2236#issuecomment-7263724506). Originally posted by [Andreww2009](https://github.com/Andreww2009) on 2026-11-29T22:30:17Z. --- I applied `18eaf947` to `716a0c99` on Windows x86-64 with Rust 1.98.1 and compared all 334 synthetic BC7 cases byte-for-byte against the published outputs from Microsoft’s `BCPackDecompress`. 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 blocks](https://github.com/ProjectLeonida/mandy/blob/cb947eac0d1b46ac8a5938d06a17fe7bd95cfe12/tests/fixtures/bcpack-standalone.txt) Would you include a one-block mode 5 regression test that checks each reader against an independently calculated block? I tried this fixture locally: - Give the last synthetic dictionary entry index widths `[2, 2]`. Set slots `0, 15, 16, 31` to `1, 3, 1, 2` respectively. Leave the other slots and endpoints zero. - Decode block 0 with dictionary reference 255, zero residuals, one subset and rotation 0. Mode 5 puts the two index sets at bit offsets 66 and 97. Reading the output as a little-endian `u128`, the expected value is `0x20u128 | (1 << 66) | (3 << 95) | (1 << 97) | (2 << 126)`. [Mode 5 layout](https://learn.microsoft.com/en-us/windows/win32/direct3d11/bc7-format-mode-reference#mode-5) With the old reader, the production assertion passed and the reference assertion failed. With this PR and the extra test, `victory-formats` passed in debug and release (**84 passed, 7 ignored** in each).
danielsteman commented 2026-11-30 14:14:56 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by danielsteman on 2026-11-30T14:14:56Z.


I confirmed this on current main (41adb551).

  • Without this PR, on a clean checkout: cargo test --locked -p victory-formats --lib bcpack::tests::oracle_parity gives 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.
  • With this PR's diff applied, it applies cleanly and cargo test --locked -p victory-formats --lib gives 83 passed, 0 failed, 7 ignored.

These same three tests stop cargo test --workspace on other PRs too (for example #3962's Windows run), so merging this unblocks that step for them.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7281071157 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2236#issuecomment-7281071157). Originally posted by [danielsteman](https://github.com/danielsteman) on 2026-11-30T14:14:56Z. --- I confirmed this on current `main` (`41adb551`). - Without this PR, on a clean checkout: `cargo test --locked -p victory-formats --lib bcpack::tests::oracle_parity` gives 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. - With this PR's diff applied, it applies cleanly and `cargo test --locked -p victory-formats --lib` gives 83 passed, 0 failed, 7 ignored. These same three tests stop `cargo test --workspace` on other PRs too (for example #3962's Windows run), so merging this unblocks that step for them.
RochDawid commented 2026-12-01 01:32:31 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by RochDawid on 2026-12-01T01:32:31Z.


main already has this change. be0ba3b7 ("bcpack: the BC7 oracle reads the dictionary as Microsoft's decoder does") makes the same edit to RefTables::parse: no skipped word after the widths, and all 32 index slots read. It reached main with the merge of #2565 (ac6b767d, 2026-11-29) and is in every release since v2026.11.30.01.

On main at f5c3d243, cargo test --locked -p victory-formats --lib oracle_parity gives 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 main and has nothing left to add, so it can probably be closed. #2236, #2419 and #3263 all make this same change.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7297622023 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2236#issuecomment-7297622023). Originally posted by [RochDawid](https://github.com/RochDawid) on 2026-12-01T01:32:31Z. --- `main` already has this change. be0ba3b7 ("bcpack: the BC7 oracle reads the dictionary as Microsoft's decoder does") makes the same edit to `RefTables::parse`: no skipped word after the widths, and all 32 index slots read. It reached `main` with the merge of #2565 (ac6b767d, 2026-11-29) and is in every release since v2026.11.30.01. On `main` at f5c3d243, `cargo test --locked -p victory-formats --lib oracle_parity` gives 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 `main` and has nothing left to add, so it can probably be closed. #2236, #2419 and #3263 all make this same change.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/2236:upstream-pr/2236'
git switch 'upstream-pr/2236'

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.

git switch 'main'
git merge --no-ff 'upstream-pr/2236'
git switch 'upstream-pr/2236'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2236'
git switch 'upstream-pr/2236'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2236'
git switch 'main'
git merge --squash 'upstream-pr/2236'
git switch 'main'
git merge --ff-only 'upstream-pr/2236'
git switch 'main'
git merge 'upstream-pr/2236'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
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
trustno1-coder/VIctory-NVIDIA!2236
No description provided.