play: keep VICTORY_KEEP_OLD_SHADERS from environment across prepare #4388

Open
github-bot wants to merge 2 commits from github-bot/gh-4387 into main AGit
Owner

@⁠nidea1 on GitHub · 2026-11-30 19:35 UTC · original
nidea1:fix/keep-old-shaders-env → main · +10 −2 · 2 files · 2 commits · open

Follow-up to #4232 (reported by @⁠Kwaarckmoon).

What it changes

play::clear_stale_shaders checks VICTORY_KEEP_OLD_SHADERS=1 from the environment, and play::preload spawns a child victory preload process that runs the same check. However, on victory play, clear_stale_shaders runs inside play::prepare(..).and_then(..), after prepare clears every inherited VICTORY_* variable not listed in KEPT. Because VICTORY_KEEP_OLD_SHADERS was not in KEPT, setting VICTORY_KEEP_OLD_SHADERS=1 in the caller's environment was silently stripped and the old shader cache was still deleted (only --set VICTORY_KEEP_OLD_SHADERS=1 or a line in victory-settings.txt worked).

  • Add "VICTORY_KEEP_OLD_SHADERS" to KEPT in apps/victory/src/play.rs so the environment variable survives play::prepare (and any child victory preload spawned by play), while an explicit --set VICTORY_KEEP_OLD_SHADERS=... or victory-settings.txt line still overrides it.
  • Extend play::tests::play_keeps_the_storage_paths_when_resetting_switches to cover VICTORY_KEEP_OLD_SHADERS case-insensitively.

How it was tested

  • GPU and profile (Series X or S, resolution, DLSS, frame generation, ray tracing): Windows 11 x64 unit/integration tests (apps/victory); launcher env-handling fix (no runtime GPU change).
  • Before: stale_switch("VICTORY_KEEP_OLD_SHADERS") returned true, so play::prepare stripped inherited VICTORY_KEEP_OLD_SHADERS=1 before clear_stale_shaders ran.
  • After: stale_switch("VICTORY_KEEP_OLD_SHADERS") and stale_switch("victory_keep_old_shaders") return false, keeping the env var intact for clear_stale_shaders and child preload.
  • For shader changes, the wave sizes tested (32 and/or 64 lanes): N/A.
  • cargo test passed for the crates it touches: yes (cargo test -j 4 -p victory --locked: 91/91 unit + 3/3 integration tests passed; cargo clippy -j 4 -p victory --all-targets --locked --no-deps -- -D warnings: 0 warnings; cargo run -p xtask -- policy --staged: 1 files ok).

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches. Related: #4232, #4014 (adds VRAM/room knobs to KEPT, does not include VICTORY_KEEP_OLD_SHADERS).
**@⁠nidea1** on GitHub · 2026-11-30 19:35 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4387) `nidea1:fix/keep-old-shaders-env` → `main` · +10 −2 · 2 files · 2 commits · open Follow-up to #4232 (reported by @⁠Kwaarckmoon). ## What it changes `play::clear_stale_shaders` checks `VICTORY_KEEP_OLD_SHADERS=1` from the environment, and `play::preload` spawns a child `victory preload` process that runs the same check. However, on `victory play`, `clear_stale_shaders` runs inside `play::prepare(..).and_then(..)`, after `prepare` clears every inherited `VICTORY_*` variable not listed in `KEPT`. Because `VICTORY_KEEP_OLD_SHADERS` was not in `KEPT`, setting `VICTORY_KEEP_OLD_SHADERS=1` in the caller's environment was silently stripped and the old shader cache was still deleted (only `--set VICTORY_KEEP_OLD_SHADERS=1` or a line in `victory-settings.txt` worked). - Add `"VICTORY_KEEP_OLD_SHADERS"` to `KEPT` in `apps/victory/src/play.rs` so the environment variable survives `play::prepare` (and any child `victory preload` spawned by `play`), while an explicit `--set VICTORY_KEEP_OLD_SHADERS=...` or `victory-settings.txt` line still overrides it. - Extend `play::tests::play_keeps_the_storage_paths_when_resetting_switches` to cover `VICTORY_KEEP_OLD_SHADERS` case-insensitively. ## How it was tested - GPU and profile (Series X or S, resolution, DLSS, frame generation, ray tracing): Windows 11 x64 unit/integration tests (`apps/victory`); launcher env-handling fix (no runtime GPU change). - Before: `stale_switch("VICTORY_KEEP_OLD_SHADERS")` returned `true`, so `play::prepare` stripped inherited `VICTORY_KEEP_OLD_SHADERS=1` before `clear_stale_shaders` ran. - After: `stale_switch("VICTORY_KEEP_OLD_SHADERS")` and `stale_switch("victory_keep_old_shaders")` return `false`, keeping the env var intact for `clear_stale_shaders` and child `preload`. - For shader changes, the wave sizes tested (32 and/or 64 lanes): N/A. - `cargo test` passed for the crates it touches: yes (`cargo test -j 4 -p victory --locked`: 91/91 unit + 3/3 integration tests passed; `cargo clippy -j 4 -p victory --all-targets --locked --no-deps -- -D warnings`: 0 warnings; `cargo run -p xtask -- policy --staged`: 1 files ok). ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. Related: #4232, #4014 (adds VRAM/room knobs to `KEPT`, does not include `VICTORY_KEEP_OLD_SHADERS`).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-30 19:40:17 +00:00
Author
Owner

@⁠babuakhil on GitHub · 2026-11-30 19:55 UTC · original

Checked on Windows 11 (Rust 1.98.1, pinned), on main (e1251c31), which this is based on. cargo test -p victory passes (91 unit, 1 + 2 integration), and cargo clippy -p victory --all-targets --no-deps -- -D warnings is clean. Not tested in the game.

The order is as described. In main.rs's Command::Play arm, play::prepare runs first and removes every name leftovers() returns, which is stale_switch over the environment, and only then does play::clear_stale_shaders(named_cache) read VICTORY_KEEP_OLD_SHADERS. The other switches that arm needs (VICTORY_PRELOAD, VICTORY_CLEAR_SHADERS, VICTORY_CACHE_DIR) are read before prepare for that reason, and this one was missed. With the KEPT line taken back out, the extended test fails (stale_switch("victory_keep_old_shaders") is true), and with it the test passes.

Keeping it in KEPT, rather than reading it before prepare like the other three, also carries it into the victory preload child, whose own clear_stale_shaders (the Shaders | Warm | Preload arm) reads the same variable. So this is the better of the two ways to fix it.

**@⁠babuakhil** on GitHub · 2026-11-30 19:55 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4387#issuecomment-7290131272) Checked on Windows 11 (Rust 1.98.1, pinned), on `main` (`e1251c31`), which this is based on. `cargo test -p victory` passes (91 unit, 1 + 2 integration), and `cargo clippy -p victory --all-targets --no-deps -- -D warnings` is clean. Not tested in the game. The order is as described. In `main.rs`'s `Command::Play` arm, `play::prepare` runs first and removes every name `leftovers()` returns, which is `stale_switch` over the environment, and only then does `play::clear_stale_shaders(named_cache)` read `VICTORY_KEEP_OLD_SHADERS`. The other switches that arm needs (`VICTORY_PRELOAD`, `VICTORY_CLEAR_SHADERS`, `VICTORY_CACHE_DIR`) are read before `prepare` for that reason, and this one was missed. With the `KEPT` line taken back out, the extended test fails (`stale_switch("victory_keep_old_shaders")` is true), and with it the test passes. Keeping it in `KEPT`, rather than reading it before `prepare` like the other three, also carries it into the `victory preload` child, whose own `clear_stale_shaders` (the `Shaders | Warm | Preload` arm) reads the same variable. So this is the better of the two ways to fix it.
github-bot force-pushed github-bot/gh-4387 from 89e4e282f1 to 2afbf6da3c 2026-12-01 03:10:31 +00:00 Compare
Author
Owner

@⁠andrewpozdnakov7-jpg on GitHub · 2026-12-01 10:10 UTC · original

The PowerShell launcher has the same gap as the native launcher. play-nvidia.ps1 removes VICTORY_KEEP_OLD_SHADERS before either warm --used or preload enters clear_stale_shaders. I added the setting to the script's existing preserved environment entries in 41de5c1588b861b59c4cc6b23b859d3c8018129f, directly on your 2afbf6da head. Review commit

In Windows PowerShell 5.1, I ran the exact environment filter with synthetic entries. Your head selected both uppercase and lowercase spellings of the setting for removal. The updated filter kept both and still selected an unrelated flag for removal. The script parsed and the one-file staged policy check passed.

The commit is ready to include here if you want both launchers to honor the setting. Please preserve the Git author on cherry-pick or rebase, or add Co-authored-by: andrewpozdnakov7-jpg <[email protected]> if folding it in.

AI-assisted with OpenAI Codex.

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-12-01 10:10 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4387#issuecomment-7307781048) The PowerShell launcher has the same gap as the native launcher. `play-nvidia.ps1` removes `VICTORY_KEEP_OLD_SHADERS` before either `warm --used` or `preload` enters `clear_stale_shaders`. I added the setting to the script's existing preserved environment entries in 41de5c1588b861b59c4cc6b23b859d3c8018129f, directly on your `2afbf6da` head. [Review commit](https://github.com/andrewpozdnakov7-jpg/VIctory-NVIDIA/commit/41de5c1588b861b59c4cc6b23b859d3c8018129f) In Windows PowerShell 5.1, I ran the exact environment filter with synthetic entries. Your head selected both uppercase and lowercase spellings of the setting for removal. The updated filter kept both and still selected an unrelated flag for removal. The script parsed and the one-file staged policy check passed. The commit is ready to include here if you want both launchers to honor the setting. Please preserve the Git author on cherry-pick or rebase, or add `Co-authored-by: andrewpozdnakov7-jpg <[email protected]>` if folding it in. AI-assisted with OpenAI Codex.
Author
Owner

@⁠nidea1 on GitHub · 2026-12-01 10:55 UTC · original

Thanks @⁠andrewpozdnakov7-jpg! Cherry-picked onto this branch as 9eceadf7b2 (from 41de5c1588) with your original Git author preserved. Verified scripts/play-nvidia.ps1 parses cleanly with CRLF preserved, along with cargo test --locked -p victory, cargo clippy --locked -p victory --all-targets -- -D warnings, and cargo xtask policy.

**@⁠nidea1** on GitHub · 2026-12-01 10:55 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4387#issuecomment-7308912996) Thanks @⁠andrewpozdnakov7-jpg! Cherry-picked onto this branch as 9eceadf7b20b4267dda1b4569bc3bbc006caf171 (from `41de5c1588`) with your original Git author preserved. Verified `scripts/play-nvidia.ps1` parses cleanly with CRLF preserved, along with `cargo test --locked -p victory`, `cargo clippy --locked -p victory --all-targets -- -D warnings`, and `cargo xtask policy`.
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/4388/head:github-bot/gh-4387'
git switch 'github-bot/gh-4387'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-4387'
git switch 'github-bot/gh-4387'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-4387'
git switch 'github-bot/gh-4387'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-4387'
git switch 'main'
git merge --squash 'github-bot/gh-4387'
git switch 'main'
git merge --ff-only 'github-bot/gh-4387'
git switch 'main'
git merge 'github-bot/gh-4387'
git push origin '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!4388
No description provided.