ExitProcess on device loss, title end and menu quit, so the driver keeps its shader cache #3698

Open
stasadance wants to merge 1 commit from upstream-pr/3698 into main
stasadance commented 2026-11-30 04:21:04 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by stasadance on 2026-11-30T04:21:04Z.


Related: #2775

What it changes

Under Wine, TerminateProcess on our own process is _exit: NVIDIA's shader disk cache never gets finished, so the next run starts a new cache file and compiles everything again.

Device loss, the title's own end and the F1 menu's quit rows now save the pipeline library and call ExitProcess instead. So a stuck exit can't hang the game, the exit is bounded by a small victory reap <pid> <ms> process that kills us after VICTORY_EXIT_WAIT_MS (default 15 s). VICTORY_EXIT_WAIT_MS=0 ends at once with TerminateProcess, as before.

Builds on #837 (process-detach notices on ExitProcess).

How it was tested

  • GPU and profile: RTX 4090 on Linux (NVIDIA 620.73.04, kron4ek Wine 11.23, vkd3d-proton GE cae8353ed), Series S profile, DLSS + frame generation
  • Before: every exit (menu quit, device loss) left the driver cache unfinished, and the next launch recompiled pipelines.
  • After: clean exits; the next launch loads its pipelines warm from the driver cache.
  • cargo test passed for the crates it touches: native cargo test cannot build victory-gpu on a Linux host (same on main), so no; cargo xwin clippy for the Windows target adds no warning over current main (main already fails -D warnings in victory-shader, victory-loader and victory-gpu).

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches. Related: #837, #2775.
<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5558928233 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3698). Originally posted by [stasadance](https://github.com/stasadance) on 2026-11-30T04:21:04Z. --- Related: #2775 ## What it changes Under Wine, `TerminateProcess` on our own process is `_exit`: NVIDIA's shader disk cache never gets finished, so the next run starts a new cache file and compiles everything again. Device loss, the title's own end and the F1 menu's quit rows now save the pipeline library and call `ExitProcess` instead. So a stuck exit can't hang the game, the exit is bounded by a small `victory reap <pid> <ms>` process that kills us after `VICTORY_EXIT_WAIT_MS` (default 15 s). `VICTORY_EXIT_WAIT_MS=0` ends at once with `TerminateProcess`, as before. Builds on #837 (process-detach notices on ExitProcess). ## How it was tested - GPU and profile: RTX 4090 on Linux (NVIDIA 620.73.04, kron4ek Wine 11.23, vkd3d-proton GE cae8353ed), Series S profile, DLSS + frame generation - Before: every exit (menu quit, device loss) left the driver cache unfinished, and the next launch recompiled pipelines. - After: clean exits; the next launch loads its pipelines warm from the driver cache. - `cargo test` passed for the crates it touches: native `cargo test` cannot build `victory-gpu` on a Linux host (same on main), so no; `cargo xwin clippy` for the Windows target adds no warning over current main (main already fails `-D warnings` in victory-shader, victory-loader and victory-gpu). ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. Related: #837, #2775.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/3698:upstream-pr/3698'
git switch 'upstream-pr/3698'

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.

git switch 'main'
git merge --no-ff 'upstream-pr/3698'
git switch 'upstream-pr/3698'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/3698'
git switch 'upstream-pr/3698'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/3698'
git switch 'main'
git merge --squash 'upstream-pr/3698'
git switch 'main'
git merge --ff-only 'upstream-pr/3698'
git switch 'main'
git merge 'upstream-pr/3698'
git push origin 'main'
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
trustno1-coder/VIctory-NVIDIA!3698
No description provided.