Fix BC7 reference oracle dictionary index ordering #3263

Open
edge2labs wants to merge 1 commit from upstream-pr/3263 into main
edge2labs commented 2026-11-29 21:08:31 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by edge2labs on 2026-11-29T21:08:31Z.


Summary

Synchronize the BC7 reference oracle with the production decoder following commit f9de61c5.

The reference implementation was still skipping the word immediately after the index widths, causing three oracle parity tests to fail.

Changes

  • Correct reference dictionary index ordering.
  • Add a synthetic regression test covering all 32 dictionary words.
  • Preserve production decoder behavior.
  • No new dependencies or game assets.

Validation

  • Debug tests: 84 passed, 0 failed, 7 ignored.
  • Release tests: 84 passed, 0 failed, 7 ignored.
  • Strict victory-formats Clippy: PASS.
  • Staged asset policy: PASS.
  • Git diff check: PASS.

Performance impact

No direct runtime performance change. This fix restores the reliability of the regression tests required to validate future BCPack performance optimizations.

Known upstream issues

The baseline commit f72cec77 has unrelated workspace Clippy and repository-wide asset policy failures.

Tested on Windows with Rust 1.98.1.

Contribution by Edge2Labs.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5555139465 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3263). Originally posted by [edge2labs](https://github.com/edge2labs) on 2026-11-29T21:08:31Z. --- ## Summary Synchronize the BC7 reference oracle with the production decoder following commit `f9de61c5`. The reference implementation was still skipping the word immediately after the index widths, causing three oracle parity tests to fail. ## Changes - Correct reference dictionary index ordering. - Add a synthetic regression test covering all 32 dictionary words. - Preserve production decoder behavior. - No new dependencies or game assets. ## Validation - Debug tests: 84 passed, 0 failed, 7 ignored. - Release tests: 84 passed, 0 failed, 7 ignored. - Strict victory-formats Clippy: PASS. - Staged asset policy: PASS. - Git diff check: PASS. ## Performance impact No direct runtime performance change. This fix restores the reliability of the regression tests required to validate future BCPack performance optimizations. ## Known upstream issues The baseline commit `f72cec77` has unrelated workspace Clippy and repository-wide asset policy failures. Tested on Windows with Rust 1.98.1. Contribution by Edge2Labs.
edge2labs commented 2026-11-30 00:14:26 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by edge2labs on 2026-11-30T00:14:26Z.


I've completed an integrated performance contribution under Edge2Labs, consisting of seven commits rebased onto v2026.11.29.05 (41adb551).

The synthetic benchmarks on my i9-14900K, RTX 4080 SUPER and 64 GB RAM produced the following results:

  • 99.39% reduction in typical peak staging allocation latency.
  • 90.17% reduction in accumulated staging allocation time.
  • Up to 91.17% reduction in mapped texture memory query time.
  • Up to 83% reduction in GPU pool selection time.
  • Approximately 27% reduction in plain descriptor allocation benchmark time.
  • 1.26% reduction in BC6H decoding time.
  • Fixed three failing BC7 reference parity tests.

Both Release and Diagnostics builds succeeded. The two higher-risk runtime optimizations remain opt-in.

I also compared the contribution against an unchanged upstream checkout. Several existing test failures and Clippy errors are reproducible upstream, while some GPU tests appear sensitive to concurrent execution.

One remaining concern before submission: cargo xtask policy reports an existing violation in crates/victory-loader/src/heap_sites/frame_users.rs on both upstream and our branch. None of our changes touch this file. Could you clarify how you would like contributors to proceed?

I'd like to submit the integrated contribution for review under the pr-performance label and, if possible, have it benchmarked in-game against upstream, particularly without frame generation.

My main objective is to help achieve stable native 60 FPS or higher. I have not yet measured actual in-game FPS, so the reported improvements are strictly synthetic benchmark results.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7265090740 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3263#issuecomment-7265090740). Originally posted by [edge2labs](https://github.com/edge2labs) on 2026-11-30T00:14:26Z. --- I've completed an integrated performance contribution under Edge2Labs, consisting of seven commits rebased onto v2026.11.29.05 (41adb551). The synthetic benchmarks on my i9-14900K, RTX 4080 SUPER and 64 GB RAM produced the following results: - 99.39% reduction in typical peak staging allocation latency. - 90.17% reduction in accumulated staging allocation time. - Up to 91.17% reduction in mapped texture memory query time. - Up to 83% reduction in GPU pool selection time. - Approximately 27% reduction in plain descriptor allocation benchmark time. - 1.26% reduction in BC6H decoding time. - Fixed three failing BC7 reference parity tests. Both Release and Diagnostics builds succeeded. The two higher-risk runtime optimizations remain opt-in. I also compared the contribution against an unchanged upstream checkout. Several existing test failures and Clippy errors are reproducible upstream, while some GPU tests appear sensitive to concurrent execution. One remaining concern before submission: `cargo xtask policy` reports an existing violation in `crates/victory-loader/src/heap_sites/frame_users.rs` on both upstream and our branch. None of our changes touch this file. Could you clarify how you would like contributors to proceed? I'd like to submit the integrated contribution for review under the pr-performance label and, if possible, have it benchmarked in-game against upstream, particularly without frame generation. My main objective is to help achieve stable native 60 FPS or higher. I have not yet measured actual in-game FPS, so the reported improvements are strictly synthetic benchmark results.
RochDawid commented 2026-12-01 01:32:34 +00:00 (Migrated from github.com)

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


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. The only part main lacks is the new bc7_oracle_dictionary_word_order test; the oracle change itself is already there. #2236, #2419 and #3263 all make this same change.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7297622935 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3263#issuecomment-7297622935). Originally posted by [RochDawid](https://github.com/RochDawid) on 2026-12-01T01:32:34Z. --- `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`. The only part `main` lacks is the new `bc7_oracle_dictionary_word_order` test; the oracle change itself is already there. #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/3263:upstream-pr/3263'
git switch 'upstream-pr/3263'

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/3263'
git switch 'upstream-pr/3263'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/3263'
git switch 'upstream-pr/3263'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/3263'
git switch 'main'
git merge --squash 'upstream-pr/3263'
git switch 'main'
git merge --ff-only 'upstream-pr/3263'
git switch 'main'
git merge 'upstream-pr/3263'
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!3263
No description provided.