fix(victory-shader): exclude non-translation switches and test files from shader cache key #301

Open
github-bot wants to merge 3 commits from github-bot/gh-301 into main AGit
Owner

@⁠mauroalvare on GitHub · 2026-11-26 01:52 UTC · original
mauroalvare:fix/victory-shader-cache-switches → main · +98 −1 · 2 files · 3 commits · open

Change

Stops non-translation switches and test/utility files from polluting VICTORY_SHADER_SWITCHES and VICTORY_SHADER_SOURCE_HASH in third_party/victory/crates/victory-shader/build.rs (base c4c93bdc413191a9dc909998d2d53080a3f0c880).

Previously, victory-shader/build.rs walked every .rs file under src/ (including *_tests.rs, the uncompiled orphan emit/desc_data_tests.rs, emit/host.rs, emit/validator.rs, and emit/bitcode/census.rs) and scraped every "VICTORY_*" string literal into VICTORY_SHADER_SWITCHES, which emit::translation_fingerprint() hashes into the on-disk shader cache key. As a result:

  • Toggling VICTORY_D3D12_DEBUG=1 (from emit/host.rs), VICTORY_WAVE_WHY=1, VICTORY_DESC_WHY=1, VICTORY_SHADER_CENSUS=<file>, VICTORY_WARP=1, or VICTORY_DXIL=<path> invalidated 100% of the shader cache even though none of them change the emitted DXIL.
  • Switching between tools/lancer_victory.ps1 (which sets VICTORY_DESC_DATA=1) and -NoTunedSettings (which leaves VICTORY_DESC_DATA unset) also invalidated 100% of the shader cache, even though no compiled code reads VICTORY_DESC_DATA (it only exists in the uncompiled orphan emit/desc_data_tests.rs).
  • Even VICTORY_SHADER_SOURCE_HASH and VICTORY_SHADER_SWITCHES themselves (from env!(...) in emit/mod.rs) were scraped into VICTORY_SHADER_SWITCHES.
  • Editing any *_tests.rs unit-test file invalidated the shader cache via VICTORY_SHADER_SOURCE_HASH.

What changed:

  • Skip *_tests.rs, emit/host.rs, emit/validator.rs, and emit/bitcode/census.rs when computing VICTORY_SHADER_SOURCE_HASH and VICTORY_SHADER_SWITCHES.
  • Skip non-translation literals (*_WHY, VICTORY_SHADER_SOURCE_HASH, VICTORY_SHADER_SWITCHES, VICTORY_REF_VS, VICTORY_REF_PS) from VICTORY_SHADER_SWITCHES.
  • All real translation switches (VICTORY_F16_NEAREST, VICTORY_GROUP_SYNC, VICTORY_SHADER_OPT, VICTORY_SHADER_LOOP_LIMIT, VICTORY_WAVE_*, VICTORY_STRICT_JOINS, etc.) remain in VICTORY_SHADER_SWITCHES and still invalidate the cache as expected.

Linked issue: N/A

Verification

Base reproduction (c4c93bd, before the fix):

cargo test --locked -p victory-shader --test fingerprint_switches
-> FAILED. 0 passed; 1 failed
   non-translation switches changed translation_fingerprint() and would invalidate the shader cache
   (VICTORY_D3D12_DEBUG, VICTORY_DESC_DATA, VICTORY_DESC_WHY, VICTORY_WAVE_WHY, VICTORY_SHADER_CENSUS, VICTORY_WARP, VICTORY_DXIL, plus VICTORY_SHADER_SOURCE_HASH and VICTORY_SHADER_SWITCHES were all in VICTORY_SHADER_SWITCHES)

After the fix (ab7ee46):

cargo test --locked -p victory-shader --test fingerprint_switches -> ok. 1 passed; 0 failed (0.00s)
cargo check --locked -p victory                                   -> Finished `dev` profile in 12.66s
cargo xtask policy                                                -> asset policy: 200 files ok
python -m pytest tests/test_lanceur_victory.py -q                 -> 25 passed in 9.89s

No GPU execution is needed for this build-script / fingerprint test (pure CPU); verified on Windows x64 (Ryzen 7 9700X, RTX 5070 Ti, 32 GB RAM).

Oracle and test data

New integration test third_party/victory/crates/victory-shader/tests/fingerprint_switches.rs toggles 11 non-translation switches and verifies translation_fingerprint() is unchanged, then toggles VICTORY_F16_NEAREST=1 and verifies translation_fingerprint() changes. Fails on base c4c93bd and passes with this change. No game, console, or SDK files were used.

Checklist

  • The PR covers a single reviewable behaviour.
  • A test fails without this change and passes with it.
  • The commands and results of each check are given above.
  • An unimplemented function returns an error (E_NOTIMPL), never a fake success.
  • README: the same change in all 9 languages (test_readme_sync.py checks it).
  • No game, console or SDK file, no key, no dump, no download link.
  • Findings drawn from a title: limited to what rule 2 of AGENTS.md allows (names, slots, argument shapes, flag values, HRESULTs, IIDs, counts), with how they were obtained; no address or RVA.
  • Code taken from another project: compatible licence and credit in THIRD_PARTY.md.

Made with AI assistance (Antigravity).

**@⁠mauroalvare** on GitHub · 2026-11-26 01:52 UTC · [original](https://github.com/LooperSalty/AnyXboxX/pull/301) `mauroalvare:fix/victory-shader-cache-switches` → `main` · +98 −1 · 2 files · 3 commits · open ## Change Stops non-translation switches and test/utility files from polluting `VICTORY_SHADER_SWITCHES` and `VICTORY_SHADER_SOURCE_HASH` in `third_party/victory/crates/victory-shader/build.rs` (base `c4c93bdc413191a9dc909998d2d53080a3f0c880`). Previously, `victory-shader/build.rs` walked every `.rs` file under `src/` (including `*_tests.rs`, the uncompiled orphan `emit/desc_data_tests.rs`, `emit/host.rs`, `emit/validator.rs`, and `emit/bitcode/census.rs`) and scraped every `"VICTORY_*"` string literal into `VICTORY_SHADER_SWITCHES`, which `emit::translation_fingerprint()` hashes into the on-disk shader cache key. As a result: - Toggling `VICTORY_D3D12_DEBUG=1` (from `emit/host.rs`), `VICTORY_WAVE_WHY=1`, `VICTORY_DESC_WHY=1`, `VICTORY_SHADER_CENSUS=<file>`, `VICTORY_WARP=1`, or `VICTORY_DXIL=<path>` invalidated 100% of the shader cache even though none of them change the emitted DXIL. - Switching between `tools/lancer_victory.ps1` (which sets `VICTORY_DESC_DATA=1`) and `-NoTunedSettings` (which leaves `VICTORY_DESC_DATA` unset) also invalidated 100% of the shader cache, even though no compiled code reads `VICTORY_DESC_DATA` (it only exists in the uncompiled orphan `emit/desc_data_tests.rs`). - Even `VICTORY_SHADER_SOURCE_HASH` and `VICTORY_SHADER_SWITCHES` themselves (from `env!(...)` in `emit/mod.rs`) were scraped into `VICTORY_SHADER_SWITCHES`. - Editing any `*_tests.rs` unit-test file invalidated the shader cache via `VICTORY_SHADER_SOURCE_HASH`. What changed: - Skip `*_tests.rs`, `emit/host.rs`, `emit/validator.rs`, and `emit/bitcode/census.rs` when computing `VICTORY_SHADER_SOURCE_HASH` and `VICTORY_SHADER_SWITCHES`. - Skip non-translation literals (`*_WHY`, `VICTORY_SHADER_SOURCE_HASH`, `VICTORY_SHADER_SWITCHES`, `VICTORY_REF_VS`, `VICTORY_REF_PS`) from `VICTORY_SHADER_SWITCHES`. - All real translation switches (`VICTORY_F16_NEAREST`, `VICTORY_GROUP_SYNC`, `VICTORY_SHADER_OPT`, `VICTORY_SHADER_LOOP_LIMIT`, `VICTORY_WAVE_*`, `VICTORY_STRICT_JOINS`, etc.) remain in `VICTORY_SHADER_SWITCHES` and still invalidate the cache as expected. Linked issue: N/A ## Verification Base reproduction (`c4c93bd`, before the fix): ``` cargo test --locked -p victory-shader --test fingerprint_switches -> FAILED. 0 passed; 1 failed non-translation switches changed translation_fingerprint() and would invalidate the shader cache (VICTORY_D3D12_DEBUG, VICTORY_DESC_DATA, VICTORY_DESC_WHY, VICTORY_WAVE_WHY, VICTORY_SHADER_CENSUS, VICTORY_WARP, VICTORY_DXIL, plus VICTORY_SHADER_SOURCE_HASH and VICTORY_SHADER_SWITCHES were all in VICTORY_SHADER_SWITCHES) ``` After the fix (`ab7ee46`): ``` cargo test --locked -p victory-shader --test fingerprint_switches -> ok. 1 passed; 0 failed (0.00s) cargo check --locked -p victory -> Finished `dev` profile in 12.66s cargo xtask policy -> asset policy: 200 files ok python -m pytest tests/test_lanceur_victory.py -q -> 25 passed in 9.89s ``` No GPU execution is needed for this build-script / fingerprint test (pure CPU); verified on Windows x64 (Ryzen 7 9700X, RTX 5070 Ti, 32 GB RAM). ## Oracle and test data New integration test `third_party/victory/crates/victory-shader/tests/fingerprint_switches.rs` toggles 11 non-translation switches and verifies `translation_fingerprint()` is unchanged, then toggles `VICTORY_F16_NEAREST=1` and verifies `translation_fingerprint()` changes. Fails on base `c4c93bd` and passes with this change. No game, console, or SDK files were used. ## Checklist - [x] The PR covers a single reviewable behaviour. - [x] A test fails without this change and passes with it. - [x] The commands and results of each check are given above. - [x] An unimplemented function returns an error (`E_NOTIMPL`), never a fake success. - [x] README: the same change in all 9 languages (`test_readme_sync.py` checks it). - [x] No game, console or SDK file, no key, no dump, no download link. - [x] Findings drawn from a title: limited to what rule 2 of `AGENTS.md` allows (names, slots, argument shapes, flag values, HRESULTs, IIDs, counts), with how they were obtained; no address or RVA. - [x] Code taken from another project: compatible licence and credit in `THIRD_PARTY.md`. Made with AI assistance (Antigravity).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:42:24 +00:00
github-bot force-pushed github-bot/gh-301 from ab7ee466f5 to 5f0ae140b4 2026-11-26 20:25:01 +00:00 Compare
github-bot changed title from fix(victory-shader): exclude non-translation switches and test files from shader cache key to fix(victory): exclude shader tests from the active cache source hash 2026-11-26 20:33:51 +00:00
github-bot changed title from fix(victory): exclude shader tests from the active cache source hash to fix(victory-shader): exclude non-translation switches and test files from shader cache key 2026-11-27 00:36:25 +00:00
github-bot force-pushed github-bot/gh-301 from 5f0ae140b4 to e6518be3cf 2026-11-27 00:36:26 +00:00 Compare
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/301/head:github-bot/gh-301'
git switch 'github-bot/gh-301'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-301'
git switch 'github-bot/gh-301'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-301'
git switch 'github-bot/gh-301'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-301'
git switch 'main'
git merge --squash 'github-bot/gh-301'
git switch 'main'
git merge --ff-only 'github-bot/gh-301'
git switch 'main'
git merge 'github-bot/gh-301'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.