play: keep VICTORY_KEEP_OLD_SHADERS from environment across prepare #4387
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/4387"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by nidea1 on 2026-11-30T19:35:10Z.
Follow-up to #4231 (reported by @Kwaarckmoon).
What it changes
play::clear_stale_shaderschecksVICTORY_KEEP_OLD_SHADERS=1from the environment, andplay::preloadspawns a childvictory preloadprocess that runs the same check. However, onvictory play,clear_stale_shadersruns insideplay::prepare(..).and_then(..), afterprepareclears every inheritedVICTORY_*variable not listed inKEPT. BecauseVICTORY_KEEP_OLD_SHADERSwas not inKEPT, settingVICTORY_KEEP_OLD_SHADERS=1in the caller's environment was silently stripped and the old shader cache was still deleted (only--set VICTORY_KEEP_OLD_SHADERS=1or a line invictory-settings.txtworked)."VICTORY_KEEP_OLD_SHADERS"toKEPTinapps/victory/src/play.rsso the environment variable survivesplay::prepare(and any childvictory preloadspawned byplay), while an explicit--set VICTORY_KEEP_OLD_SHADERS=...orvictory-settings.txtline still overrides it.play::tests::play_keeps_the_storage_paths_when_resetting_switchesto coverVICTORY_KEEP_OLD_SHADERScase-insensitively.How it was tested
apps/victory); launcher env-handling fix (no runtime GPU change).stale_switch("VICTORY_KEEP_OLD_SHADERS")returnedtrue, soplay::preparestripped inheritedVICTORY_KEEP_OLD_SHADERS=1beforeclear_stale_shadersran.stale_switch("VICTORY_KEEP_OLD_SHADERS")andstale_switch("victory_keep_old_shaders")returnfalse, keeping the env var intact forclear_stale_shadersand childpreload.cargo testpassed 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
KEPT, does not includeVICTORY_KEEP_OLD_SHADERS).Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by babuakhil on 2026-11-30T19:55:05Z.
Checked on Windows 11 (Rust 1.98.1, pinned), on
main(e1251c31), which this is based on.cargo test -p victorypasses (91 unit, 1 + 2 integration), andcargo clippy -p victory --all-targets --no-deps -- -D warningsis clean. Not tested in the game.The order is as described. In
main.rs'sCommand::Playarm,play::prepareruns first and removes every nameleftovers()returns, which isstale_switchover the environment, and only then doesplay::clear_stale_shaders(named_cache)readVICTORY_KEEP_OLD_SHADERS. The other switches that arm needs (VICTORY_PRELOAD,VICTORY_CLEAR_SHADERS,VICTORY_CACHE_DIR) are read beforepreparefor that reason, and this one was missed. With theKEPTline 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 beforepreparelike the other three, also carries it into thevictory preloadchild, whose ownclear_stale_shaders(theShaders | Warm | Preloadarm) reads the same variable. So this is the better of the two ways to fix it.Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by andrewpozdnakov7-jpg on 2026-12-01T10:10:23Z.
The PowerShell launcher has the same gap as the native launcher.
play-nvidia.ps1removesVICTORY_KEEP_OLD_SHADERSbefore eitherwarm --usedorpreloadentersclear_stale_shaders. I added the setting to the script's existing preserved environment entries in 41de5c1588b861b59c4cc6b23b859d3c8018129f, directly on your2afbf6dahead. Review commitIn 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.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by nidea1 on 2026-12-01T10:55:10Z.
Thanks @andrewpozdnakov7-jpg! Cherry-picked onto this branch as
9eceadf7b2(from41de5c1588) with your original Git author preserved. Verifiedscripts/play-nvidia.ps1parses cleanly with CRLF preserved, along withcargo test --locked -p victory,cargo clippy --locked -p victory --all-targets -- -D warnings, andcargo xtask policy.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.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.