F1 menu: clear the shader cache (#496) #629

Open
github-bot wants to merge 1 commit from github-bot/gh-629 into main AGit
Owner

@⁠Luqueze on GitHub · 2026-11-28 02:03 UTC · original
Luqueze:feat/menu-clear-shader-cache → main · +168 −24 · 4 files · 1 commits · open

Closes #496.

What this adds

A line in the F1 menu, CLEAR SHADER CACHE (RESTARTS THE GAME), right after PRELOAD SHADERS. It works the way PRELOAD SHADERS does:

  • the first Enter shows ENTER AGAIN: SAVE, CLOSE THE GAME AND CLEAR SHADERS;
  • the second Enter saves and starts the launcher again with VICTORY_CLEAR_SHADERS=1;
  • that start deletes the cache's shaders and pipelines folders before the game runs.

Shaders are then made again as the game goes, or all at once with PRELOAD SHADERS. Three lines under the menu say so while the line is picked.

Deleted: shaders and pipelines. The second holds the pipeline book, the library and the warm-up's progress, so the start really is from scratch.

Kept: images (the translated title, which is not made of shaders and takes a while to make again), settings, saves and logs. The driver's own shader cache is left to Windows' Disk Cleanup, as you said in the issue.

Changes

  • menu.rs: the new action, with CLEAR, ABOUT_CLEAR, CONFIRM_CLEAR and RESET in place of the literal 3. restart(bool) becomes restart(Then) (Play, Preload, ClearShaders), and Then::switch gives the PowerShell that sets the start's variable.
  • play.rs: clear_shaders() and clear_shaders_in(cache), which report the MB freed. A folder that isn't there is fine. An error, for example a file still held, is reported, and victory play still starts the game.
  • main.rs: victory clear-shaders does it by hand. victory play reads VICTORY_CLEAR_SHADERS before prepare, next to VICTORY_PRELOAD.
  • scripts/play-foxhound.ps1: reads VICTORY_CLEAR_SHADERS and runs victory clear-shaders from the repository folder (so victory.toml's cache_dir applies) before the preload. Its lines go to the log as # clear-shaders: ....

Tested

RTX 4070 SUPER, Ryzen 7 5700X3D, Windows 11 build 26300, release build of this branch on a4d05e7, scripts\play-nvidia.ps1, Series X profile.

  • In the game: started with VICTORY_CACHE_DIR set to a throwaway folder, then F1, CLEAR SHADER CACHE, Enter, Enter. The game closed and started again, and the new log shows # clear-shaders: Shader cache cleared: 130 MB freed. Afterwards images was untouched and new shaders/pipelines were being made.
  • By hand: victory clear-shaders on a test cache with shaders, pipelines and images deleted the first two and kept images.
  • Not tested: the same restart through victory.exe alone (double click). It takes the same clear_shaders() path in main.rs.
  • cargo test -p victory-gpu --lib menu: 6 passed, including the new a_restart_asks_its_start_for_what_it_was_picked_for. Every menu line still fits and has its glyphs.
  • cargo test -p victory --bin victory: 25 passed, including the new clearing_the_shader_cache_leaves_the_translated_title.
  • cargo xtask policy: ok.
  • cargo clippy -p victory -p victory-gpu --all-targets: nothing in the lines changed here. The two findings in the touched files, play.rs:772 and main.rs:580, are also on main, so -D warnings fails with or without this change.
**@⁠Luqueze** on GitHub · 2026-11-28 02:03 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/629) `Luqueze:feat/menu-clear-shader-cache` → `main` · +168 −24 · 4 files · 1 commits · open Closes #496. ## What this adds A line in the F1 menu, **CLEAR SHADER CACHE (RESTARTS THE GAME)**, right after PRELOAD SHADERS. It works the way PRELOAD SHADERS does: - the first Enter shows `ENTER AGAIN: SAVE, CLOSE THE GAME AND CLEAR SHADERS`; - the second Enter saves and starts the launcher again with `VICTORY_CLEAR_SHADERS=1`; - that start deletes the cache's `shaders` and `pipelines` folders before the game runs. Shaders are then made again as the game goes, or all at once with PRELOAD SHADERS. Three lines under the menu say so while the line is picked. **Deleted:** `shaders` and `pipelines`. The second holds the pipeline book, the library and the warm-up's progress, so the start really is from scratch. **Kept:** `images` (the translated title, which is not made of shaders and takes a while to make again), settings, saves and logs. The driver's own shader cache is left to Windows' Disk Cleanup, as you said in the issue. ## Changes - `menu.rs`: the new action, with `CLEAR`, `ABOUT_CLEAR`, `CONFIRM_CLEAR` and `RESET` in place of the literal `3`. `restart(bool)` becomes `restart(Then)` (`Play`, `Preload`, `ClearShaders`), and `Then::switch` gives the PowerShell that sets the start's variable. - `play.rs`: `clear_shaders()` and `clear_shaders_in(cache)`, which report the MB freed. A folder that isn't there is fine. An error, for example a file still held, is reported, and `victory play` still starts the game. - `main.rs`: `victory clear-shaders` does it by hand. `victory play` reads `VICTORY_CLEAR_SHADERS` before `prepare`, next to `VICTORY_PRELOAD`. - `scripts/play-foxhound.ps1`: reads `VICTORY_CLEAR_SHADERS` and runs `victory clear-shaders` from the repository folder (so `victory.toml`'s `cache_dir` applies) before the preload. Its lines go to the log as `# clear-shaders: ...`. ## Tested RTX 4070 SUPER, Ryzen 7 5700X3D, Windows 11 build 26300, release build of this branch on `a4d05e7`, `scripts\play-nvidia.ps1`, Series X profile. - **In the game:** started with `VICTORY_CACHE_DIR` set to a throwaway folder, then F1, CLEAR SHADER CACHE, Enter, Enter. The game closed and started again, and the new log shows `# clear-shaders: Shader cache cleared: 130 MB freed`. Afterwards `images` was untouched and new `shaders`/`pipelines` were being made. - **By hand:** `victory clear-shaders` on a test cache with `shaders`, `pipelines` and `images` deleted the first two and kept `images`. - **Not tested:** the same restart through `victory.exe` alone (double click). It takes the same `clear_shaders()` path in `main.rs`. - `cargo test -p victory-gpu --lib menu`: 6 passed, including the new `a_restart_asks_its_start_for_what_it_was_picked_for`. Every menu line still fits and has its glyphs. - `cargo test -p victory --bin victory`: 25 passed, including the new `clearing_the_shader_cache_leaves_the_translated_title`. - `cargo xtask policy`: ok. - `cargo clippy -p victory -p victory-gpu --all-targets`: nothing in the lines changed here. The two findings in the touched files, `play.rs:772` and `main.rs:580`, are also on `main`, so `-D warnings` fails with or without this change.
A line in the F1 menu, CLEAR SHADER CACHE (RESTARTS THE GAME), asks for a
second Enter, saves, and starts the launcher again with
VICTORY_CLEAR_SHADERS=1. That start deletes the cache's shaders and
pipelines folders before the game, so they are made again as it goes or with
a preload. The translated title (images), settings, saves and logs stay.

victory clear-shaders does the same by hand. victory play and
scripts\play-foxhound.ps1 both read the variable, as they read
VICTORY_PRELOAD. The menu's restart takes what the start does first
(Then::Play, Preload, ClearShaders) instead of a preload flag.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 02:03:35 +00:00
Author
Owner

@⁠hussainmussa on GitHub · 2026-11-28 02:12 UTC · original

One thing from testing the same idea on an RTX 4070 12 GB, which may be worth a line in the menu text.

I had built the same clear for #496 locally before seeing this (same scope: shaders and pipelines, deleted at the next start). I did not run this branch, so this is about the behaviour after a clear, not about your code.

In the first run after the clear, a character's head was not drawn for the whole session (about 10 minutes, cap and glasses floating). The log's "dropped without a host pipeline" stayed at 250-290 draws a frame with 0 being made.

Start Head Draws dropped per frame
first run after the clear missing 250-290
next start, same cache as that run left it there about 90
same build on a full, preloaded cache there about 85

The shaders the game made again were identical to the preloaded ones (2,466 files compared byte for byte), so nothing is damaged: it looks like pipelines that are not ready in that first run, as on a fresh install, and the next start has them.

A user who clears from F1 and sees that may think the clear broke the game. Saying "the first run after it may miss parts of the picture; start the game once more, or preload" in the text would cover it.

One run each, played by hand. Release build on a4d05e7, Series X, 1440p, DLSS Quality.

Written with help from Claude; everything above was built and run on my machine.

**@⁠hussainmussa** on GitHub · 2026-11-28 02:12 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/629#issuecomment-7232207320) One thing from testing the same idea on an RTX 4070 12 GB, which may be worth a line in the menu text. I had built the same clear for #496 locally before seeing this (same scope: `shaders` and `pipelines`, deleted at the next start). I did not run this branch, so this is about the behaviour after a clear, not about your code. **In the first run after the clear, a character's head was not drawn** for the whole session (about 10 minutes, cap and glasses floating). The log's "dropped without a host pipeline" stayed at 250-290 draws a frame with 0 being made. | Start | Head | Draws dropped per frame | |---|---|---| | first run after the clear | missing | 250-290 | | next start, same cache as that run left it | there | about 90 | | same build on a full, preloaded cache | there | about 85 | The shaders the game made again were identical to the preloaded ones (2,466 files compared byte for byte), so nothing is damaged: it looks like pipelines that are not ready in that first run, as on a fresh install, and the next start has them. A user who clears from F1 and sees that may think the clear broke the game. Saying "the first run after it may miss parts of the picture; start the game once more, or preload" in the text would cover it. One run each, played by hand. Release build on `a4d05e7`, Series X, 1440p, DLSS Quality. Written with help from Claude; everything above was built and run on my machine.
This pull request can be merged automatically.
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/629/head:github-bot/gh-629'
git switch 'github-bot/gh-629'

Merge

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