Shader cache keyed by the translator (survives rebuilds), missing switches in the key, and a warm-up: translate --cache #544

Closed
justrealyme wants to merge 1 commit from upstream-pr/544 into main
justrealyme commented 2026-11-25 02:04:51 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by justrealyme on 2026-11-25T02:04:51Z.


What

1. The shader cache keys on the translator, not the executable. shader_cache::build() hashed the whole victory.exe, so every rebuild, even one that leaves the translator alone, and every switch between the release and diagnostics builds started with an empty cache. The first run after that shows black screens and dropped draws while thousands of shaders translate. The key is now a hash of the translator's own sources (victory-shader's build script, taken from upstream VIctory c47b529 by Marvis, credited in the commit), plus the host settings and switches a translation depends on.

2. Three translation switches were missing from the key. VICTORY_WAVE_LOCAL, VICTORY_STRICT_JOINS and VICTORY_MESH_OUTPUT_STRICT change the translation but weren't hashed, so a run with one of them could be served translations made without it. They're in the key now, and so are the host's widest wave and capped view heap (set_host_max_wave, set_view_heap_limit), which the exe hash didn't cover either.

3. victory translate --cache <game dir>: a warm-up that translates every container into the shader cache run reads, through the same path a run takes (shader_cache::warm: the host device is created and the view heap cap probed first, since the translation and its key depend on them). Run it once after a translator change, with the same VICTORY_* switches you play with.

Checked

  • RTX 5070 Ti, driver 621.40, Windows 11, on this repo's code (the same change sits in my working copy, where I've been running it):
    • the warm-up translated 25,648 shaders in about 7 minutes;
    • a game run straight after took 2,378 shaders from the cache and translated none (shaders from the cache and translated so far hits=2378 misses=0), and reached the world sooner;
    • after rebuilds that didn't touch the translator, later runs kept hitting the cache (2,560 hits, 0 translated).
  • On this branch (on top of c96b4f2): translate --cache on the builder DLL twice into an empty cache: 49 translated now, then 49 were in the cache, 0 translated now.
  • cargo test --workspace: 505 passed. cargo clippy --workspace --all-targets --all-features -- -D warnings clean. Without --all-features, clippy stops on placed_filler_twins being unused (victory-gpu/src/resource.rs), which is already the case on main; this branch doesn't touch that file.

AI-assisted (Claude Code). No game data in the change or here.

🤖 Generated with Claude Code

<!-- greyfinch-sync:fxceless/victory-fork:issue:6595466192 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/544). Originally posted by [justrealyme](https://github.com/justrealyme) on 2026-11-25T02:04:51Z. --- ## What **1. The shader cache keys on the translator, not the executable.** `shader_cache::build()` hashed the whole `victory.exe`, so every rebuild, even one that leaves the translator alone, and every switch between the release and diagnostics builds started with an empty cache. The first run after that shows black screens and dropped draws while thousands of shaders translate. The key is now a hash of the translator's own sources (`victory-shader`'s build script, taken from upstream VIctory `c47b529` by Marvis, credited in the commit), plus the host settings and switches a translation depends on. **2. Three translation switches were missing from the key.** `VICTORY_WAVE_LOCAL`, `VICTORY_STRICT_JOINS` and `VICTORY_MESH_OUTPUT_STRICT` change the translation but weren't hashed, so a run with one of them could be served translations made without it. They're in the key now, and so are the host's widest wave and capped view heap (`set_host_max_wave`, `set_view_heap_limit`), which the exe hash didn't cover either. **3. `victory translate --cache <game dir>`**: a warm-up that translates every container into the shader cache `run` reads, through the same path a run takes (`shader_cache::warm`: the host device is created and the view heap cap probed first, since the translation and its key depend on them). Run it once after a translator change, with the same `VICTORY_*` switches you play with. ## Checked - RTX 5070 Ti, driver 621.40, Windows 11, on this repo's code (the same change sits in my working copy, where I've been running it): - the warm-up translated 25,648 shaders in about 7 minutes; - a game run straight after took **2,378 shaders from the cache and translated none** (`shaders from the cache and translated so far hits=2378 misses=0`), and reached the world sooner; - after rebuilds that didn't touch the translator, later runs kept hitting the cache (2,560 hits, 0 translated). - On this branch (on top of `c96b4f2`): `translate --cache` on the builder DLL twice into an empty cache: `49 translated now`, then `49 were in the cache, 0 translated now`. - `cargo test --workspace`: 505 passed. `cargo clippy --workspace --all-targets --all-features -- -D warnings` clean. Without `--all-features`, clippy stops on `placed_filler_twins` being unused (`victory-gpu/src/resource.rs`), which is already the case on `main`; this branch doesn't touch that file. AI-assisted (Claude Code). No game data in the change or here. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
upstream-sync closed this pull request 2026-11-25 09:08:33 +00:00
justrealyme commented 2026-11-25 09:08:48 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by justrealyme on 2026-11-25T08:14:30Z.


Closing this: 8dd30ab keys the cache on translation_fingerprint() (the translator's source hash plus every switch it reads) and adds translate --warm, which covers what this PR did and more. I've merged 8dd30ab into my fork instead.

AI-assisted (Claude Code).

<!-- greyfinch-sync:fxceless/victory-fork:comment:7156784184 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/544#issuecomment-7156784184). Originally posted by [justrealyme](https://github.com/justrealyme) on 2026-11-25T08:14:30Z. --- Closing this: 8dd30ab keys the cache on `translation_fingerprint()` (the translator's source hash plus every switch it reads) and adds `translate --warm`, which covers what this PR did and more. I've merged 8dd30ab into my fork instead. AI-assisted (Claude Code).
Headache3318 commented 2026-11-25 09:08:49 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by Headache3318 on 2026-11-25T08:32:43Z.


Independent verification: PR #544 merges cleanly onto main (fast-forward). Build: success (17.7s). Tests: fail to compile on Linux host due to Windows-specific code paths gated by #[cfg(windows)] (victory-gpu host module and host_resource() not found). Environment/target mismatch rather than PR regression. Machine: Arch Linux, kernel 7.3.5-arch1-1, 3x RTX 4090 driver 620.73.04, Proton, AI-assisted.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7157162139 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/544#issuecomment-7157162139). Originally posted by [Headache3318](https://github.com/Headache3318) on 2026-11-25T08:32:43Z. --- Independent verification: PR #544 merges cleanly onto main (fast-forward). Build: success (17.7s). Tests: fail to compile on Linux host due to Windows-specific code paths gated by #[cfg(windows)] (victory-gpu host module and host_resource() not found). Environment/target mismatch rather than PR regression. Machine: Arch Linux, kernel 7.3.5-arch1-1, 3x RTX 4090 driver 620.73.04, Proton, AI-assisted.

Pull request closed

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
fxceless/victory-fork!544
No description provided.