play: keep title pipeline book across translator updates and stamp standalone preload #4232

Manually merged
github merged 1 commit from github-bot/gh-4231 into main 2026-11-30 18:23:01 +00:00 AGit
Owner

@⁠nidea1 on GitHub · 2026-11-30 17:37 UTC · original
nidea1:fix/preserve-pipeline-book-on-translator-change → main · +133 −31 · 2 files · 1 commits · merged 2026-11-30 18:19 UTC

Related: #4177, #4185, #4150

What it changes

Two regressions in 5baad7e3 (clear_stale_shaders) broke pipeline preloading after a translator update:

  1. Translator-change cleanup deleted the title's pipeline book. clear_stale_in called clear_shaders_in, which removes all of cache/pipelines/ — wiping the translator-independent title records (known-pipelines.bin, known-shaders.bin, early-pipelines.txt, slow-pipelines.txt, static-samplers.txt) right before play::preload ran. warm::run then saw 0 pipelines known, built 0 host pipelines, and finish_preload still recorded the exe as warmed, leaving the game to compile every pipeline live during play.
    • clear_stale_in now deletes only translator-dependent artifacts: cache/shaders/, cache/pipelines/adapters/, cache/pipelines/host-pipelines.*, cache/pipelines/warm-done.txt, and cache/pipelines/warm-bad.txt, while keeping the title's recorded pipeline book intact so preload can rebuild all known pipelines for the new translator.
    • Explicit clear_shaders (victory clear-shaders / F1 CLEAR SHADER CACHE) keeps its full-folder removal behavior unchanged.
  2. Standalone victory preload / shaders / warm never cleared stale artifacts or stamped translator.txt. Running victory preload (directly or through scripts\play-nvidia.ps1 -Preload) populated the cache for the new translator without updating translator.txt, so the very next victory play saw a missing/stale mark and deleted the freshly preloaded cache.
    • main.rs now calls play::clear_stale_shaders(named_cache) alongside play::apply_defaults() for top-level Command::Shaders, Command::Warm (these: None, skipping per-chunk worker subprocesses), and Command::Preload, preserving VICTORY_CACHE_DIR and VICTORY_KEEP_OLD_SHADERS=1.

(Note: this PR intentionally does not alter play.rs's existing VICTORY_FRAMEGEN == 1 automatic preload condition documented in #3941.)

How it was tested

  • GPU and profile: unit tests on Windows x64 (apps/victory), plus end-to-end verification of clear_stale_in against a populated cache fixture containing both stale host artifacts and the five pipeline-book files.
  • Before: upgrading across a translator change removed cache/pipelines/known-pipelines.bin, known-shaders.bin, early-pipelines.txt, slow-pipelines.txt, and static-samplers.txt, causing the subsequent preload to warm 0 pipelines; standalone victory preload left translator.txt unstamped so the next victory play wiped its output.
  • After: clear_stale_in deletes shaders/, pipelines/adapters/, pipelines/host-pipelines.*, warm-done.txt, and warm-bad.txt, preserves all five pipeline-book files and images/, writes translator.txt, and is a no-op when re-run under the same translator ID. Standalone shaders/warm/preload clear stale artifacts and stamp translator.txt before building.
  • For shader changes, the wave sizes tested: N/A (launcher/cache cleanup only).
  • cargo test passed for the crates it touches: yes (cargo test -p victory: 90/90 unit + 3/3 integration tests passed; cargo clippy -p victory --tests: 0 warnings in apps/victory; cargo run -p xtask -- policy --staged: 2 files ok).

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches. Related: #3941 (docs for when automatic preload runs); no open PRs touch clear_stale_shaders / translator.txt or 5baad7e3.
**@⁠nidea1** on GitHub · 2026-11-30 17:37 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4231) `nidea1:fix/preserve-pipeline-book-on-translator-change` → `main` · +133 −31 · 2 files · 1 commits · merged 2026-11-30 18:19 UTC Related: #4177, #4185, #4150 ## What it changes Two regressions in `5baad7e3` (`clear_stale_shaders`) broke pipeline preloading after a translator update: 1. **Translator-change cleanup deleted the title's pipeline book.** `clear_stale_in` called `clear_shaders_in`, which removes all of `cache/pipelines/` — wiping the translator-independent title records (`known-pipelines.bin`, `known-shaders.bin`, `early-pipelines.txt`, `slow-pipelines.txt`, `static-samplers.txt`) right before `play::preload` ran. `warm::run` then saw `0 pipelines known`, built 0 host pipelines, and `finish_preload` still recorded the exe as warmed, leaving the game to compile every pipeline live during play. - `clear_stale_in` now deletes only translator-dependent artifacts: `cache/shaders/`, `cache/pipelines/adapters/`, `cache/pipelines/host-pipelines.*`, `cache/pipelines/warm-done.txt`, and `cache/pipelines/warm-bad.txt`, while keeping the title's recorded pipeline book intact so `preload` can rebuild all known pipelines for the new translator. - Explicit `clear_shaders` (`victory clear-shaders` / F1 `CLEAR SHADER CACHE`) keeps its full-folder removal behavior unchanged. 2. **Standalone `victory preload` / `shaders` / `warm` never cleared stale artifacts or stamped `translator.txt`.** Running `victory preload` (directly or through `scripts\play-nvidia.ps1 -Preload`) populated the cache for the new translator without updating `translator.txt`, so the very next `victory play` saw a missing/stale mark and deleted the freshly preloaded cache. - `main.rs` now calls `play::clear_stale_shaders(named_cache)` alongside `play::apply_defaults()` for top-level `Command::Shaders`, `Command::Warm` (`these: None`, skipping per-chunk worker subprocesses), and `Command::Preload`, preserving `VICTORY_CACHE_DIR` and `VICTORY_KEEP_OLD_SHADERS=1`. *(Note: this PR intentionally does not alter `play.rs`'s existing `VICTORY_FRAMEGEN == 1` automatic preload condition documented in #3941.)* ## How it was tested - GPU and profile: unit tests on Windows x64 (`apps/victory`), plus end-to-end verification of `clear_stale_in` against a populated cache fixture containing both stale host artifacts and the five pipeline-book files. - Before: upgrading across a translator change removed `cache/pipelines/known-pipelines.bin`, `known-shaders.bin`, `early-pipelines.txt`, `slow-pipelines.txt`, and `static-samplers.txt`, causing the subsequent preload to warm 0 pipelines; standalone `victory preload` left `translator.txt` unstamped so the next `victory play` wiped its output. - After: `clear_stale_in` deletes `shaders/`, `pipelines/adapters/`, `pipelines/host-pipelines.*`, `warm-done.txt`, and `warm-bad.txt`, preserves all five pipeline-book files and `images/`, writes `translator.txt`, and is a no-op when re-run under the same translator ID. Standalone `shaders`/`warm`/`preload` clear stale artifacts and stamp `translator.txt` before building. - For shader changes, the wave sizes tested: N/A (launcher/cache cleanup only). - `cargo test` passed for the crates it touches: yes (`cargo test -p victory`: 90/90 unit + 3/3 integration tests passed; `cargo clippy -p victory --tests`: 0 warnings in `apps/victory`; `cargo run -p xtask -- policy --staged`: 2 files ok). ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. Related: #3941 (docs for when automatic preload runs); no open PRs touch `clear_stale_shaders` / `translator.txt` or `5baad7e3`.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-30 18:09:09 +00:00
Author
Owner

@⁠nidea1 on GitHub · 2026-11-30 17:50 UTC · original

Also verified end-to-end on a live translator upgrade (RTX 3060 Ti 8 GB, Windows 11, Series S, DLSS Quality, FSR 3 FG, RT off):

  • Running standalone victory.exe preload after upgrading across a translator change freed 10.9 GB of stale translated shaders and old host pipeline libraries while preserving all five title pipeline-book files (known-pipelines.bin, known-shaders.bin, early-pipelines.txt, slow-pipelines.txt, static-samplers.txt), stamped cache/translator.txt, and rebuilt 4,095/4,212 pipelines into a fresh 692 MB host pipeline library in 44 s.
  • The subsequent victory.exe play saw the matching translator.txt, kept the freshly preloaded cache intact, mapped the 692 MB pipeline library at startup, and reached steady play with no shader-compilation warning.
**@⁠nidea1** on GitHub · 2026-11-30 17:50 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4231#issuecomment-7286931453) Also verified end-to-end on a live translator upgrade (RTX 3060 Ti 8 GB, Windows 11, Series S, DLSS Quality, FSR 3 FG, RT off): - Running standalone `victory.exe preload` after upgrading across a translator change freed 10.9 GB of stale translated shaders and old host pipeline libraries while preserving all five title pipeline-book files (`known-pipelines.bin`, `known-shaders.bin`, `early-pipelines.txt`, `slow-pipelines.txt`, `static-samplers.txt`), stamped `cache/translator.txt`, and rebuilt 4,095/4,212 pipelines into a fresh 692 MB host pipeline library in 44 s. - The subsequent `victory.exe play` saw the matching `translator.txt`, kept the freshly preloaded cache intact, mapped the 692 MB pipeline library at startup, and reached steady play with no shader-compilation warning.
Author
Owner

@⁠Kwaarckmoon on GitHub · 2026-11-30 17:57 UTC · original

One more case this PR doesn't cover: on play, VICTORY_KEEP_OLD_SHADERS=1 set in the environment has no effect. clear_stale_shaders runs inside play::prepare(..).and_then(..), after prepare has removed inherited VICTORY_* variables, and VICTORY_KEEP_OLD_SHADERS is not in KEPT. So only --set VICTORY_KEEP_OLD_SHADERS=1 or a line in victory-settings.txt keeps the cache; the env var (as the doc comment suggests) is silently ignored. Reading it before prepare, next to named_cache, or adding it to KEPT would fix it.

Seen on v2026.11.30.02 (RTX 3070, Win 11): play with the env var set still printed "the old shader cache (8965 MB) was deleted".

**@⁠Kwaarckmoon** on GitHub · 2026-11-30 17:57 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4231#issuecomment-7287108613) One more case this PR doesn't cover: on `play`, `VICTORY_KEEP_OLD_SHADERS=1` set in the environment has no effect. `clear_stale_shaders` runs inside `play::prepare(..).and_then(..)`, after `prepare` has removed inherited `VICTORY_*` variables, and `VICTORY_KEEP_OLD_SHADERS` is not in `KEPT`. So only `--set VICTORY_KEEP_OLD_SHADERS=1` or a line in `victory-settings.txt` keeps the cache; the env var (as the doc comment suggests) is silently ignored. Reading it before `prepare`, next to `named_cache`, or adding it to `KEPT` would fix it. Seen on v2026.11.30.02 (RTX 3070, Win 11): `play` with the env var set still printed "the old shader cache (8965 MB) was deleted".
github manually merged commit 82f59e0d04 into main 2026-11-30 18:23:01 +00:00
Author
Owner

@⁠nidea1 on GitHub · 2026-11-30 19:35 UTC · original

Good catch @⁠Kwaarckmoon — adding VICTORY_KEEP_OLD_SHADERS to KEPT also preserves it for the child victory preload process spawned by play::preload (which runs clear_stale_shaders too), while --set / victory-settings.txt still override it.

Opened follow-up PR #4388 to fix this on main.

**@⁠nidea1** on GitHub · 2026-11-30 19:35 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4231#issuecomment-7289635179) Good catch @⁠Kwaarckmoon — adding `VICTORY_KEEP_OLD_SHADERS` to `KEPT` also preserves it for the child `victory preload` process spawned by `play::preload` (which runs `clear_stale_shaders` too), while `--set` / `victory-settings.txt` still override it. Opened follow-up PR #4388 to fix this on `main`.
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/trustno1-coder--VIctory-NVIDIA!4232
No description provided.