Skip to content

Launcher: shaders, warm and preload run on their own apply the defaults play applies - #1971

Open
eleboucher wants to merge 4 commits into
trustno1-coder:mainfrom
eleboucher:warm-keyed
Open

eleboucher wants to merge 4 commits into
trustno1-coder:mainfrom
eleboucher:warm-keyed

Conversation

@eleboucher

Copy link
Copy Markdown
Contributor

Fixes #

What it changes

victory play puts its defaults table (SETTINGS in play.rs) into the environment. Three of those defaults are part of the shader cache key in shader_cache.rs build(): VICTORY_EARLY_DEPTH=1, VICTORY_NAN_SCRUB=1 and VICTORY_BVH_MISS=1. victory shaders, victory warm and victory preload run on their own did not apply them, so they translated and made pipelines under another key. A default play afterwards missed every translation and the driver compiled again during the start; on a new translator that can last long enough for the title's 30 s hang watchdog (+0x23cf683, see #628).

These three commands now apply what a plain play applies, through the same settings() (defaults table plus victory-settings.txt). A variable already set in the environment is kept, so warming under another value still works. play --preload is unchanged: the preload it starts already has the start's environment.

How it was tested

  • GPU and profile: RTX 4070 Ti SUPER 16 GB, 16 GB RAM, Windows 11, Series X profile, native 1440p, no DLSS or frame generation, default play
  • Before (our test queue runs victory shaders then victory warm --used, then play): shaders from the cache and translated so far hits=0 misses=1709, and some pipelines took 20-44 s to make during the start
  • After, this branch on main 568c5e5, same sequence with none of the three variables set in the shell: shaders translated 25763 shaders fresh (116 s), then play logged hits=1924 misses=0 and host pipelines all made made=1621 loaded=1113
  • Shader wave sizes: not touched
  • cargo test: not run for apps/victory; cargo xwin check --workspace --all-targets and clippy on victory pass

Checked for overlap

@github-actions github-actions Bot added the pr-fix Pull request: fixes a bug label Nov 29, 2026
@github-actions github-actions Bot changed the title [pr-fix] Launcher: shaders, warm and preload run on their own apply the defaults play applies Launcher: shaders, warm and preload run on their own apply the defaults play applies Nov 29, 2026
wzzeus added a commit to wzzeus/VIctory-NVIDIA that referenced this pull request Nov 29, 2026
…remove racy state/remap elision

- Revert D3D12 State root-argument / IA elision in draw.rs (trustno1-coder#1967): ExecuteIndirect, ambient SetDescriptorHeaps, gpudetile, inplace, and Streamline mutate the command list directly, causing skipped binds and wrong material/texture descriptor tables
- Revert VICTORY_REMAP_SAME in xmem.rs, VICTORY_PLANE_SAME / shared_zeros in texture.rs, and VICTORY_SWEEP_ASYNC / RefreshSet in host.rs, memory.rs, and resource.rs so physical-page DirectStorage texture updates always invalidate GPU views and slot_evict never races with victory-submit
- Fix 16 GB / 24 GB+ VRAM budget in adaptive.rs (TexPool 93% / 94%, peak-sized target reserve, VICTORY_WINDOWS_BAR_MB=512) so ~79k high-Mip world textures stay resident alongside DLSS Multi-Frame Generation without hitting premature no-room throttling
- Retain pure verified fixes: slot_evict 3-lock deadlock fix (trustno1-coder#1969), sparse interior-page sweep_mapping check (trustno1-coder#1958), per-tier pool block sizing & CPU pool budgets (trustno1-coder#1968), O(log N) ahead binary search, single-range descriptor copy fast path, in-world Bink FG gate fix, simultaneous LT+RT mouse input fix (trustno1-coder#1949), VICTORY_KEEP_AWAKE, and standalone cache warm defaults (trustno1-coder#1971)
xSil3nt added a commit to xSil3nt/VIctory-NVIDIA that referenced this pull request Nov 29, 2026
Alxspb added a commit to Alxspb/VIctory-NVIDIA that referenced this pull request Nov 29, 2026
Held in the fork until upstream takes them; each switch keeps the old
behaviour by default:
- trustno1-coder#1937 the placed-texture span lock is skipped by default
  (VICTORY_SPANS_QUICK on), VICTORY_QUEUE_BATCH_MAX;
- trustno1-coder#1556 no-op refreshes batched, the lock-free ask_once fast path, a
  binary search in Journal::ahead;
- trustno1-coder#1561 less CPU lock contention in shadow merges, refreshes and card sync;
- trustno1-coder#2049 the sparse copy_stale fast path, the Batch/card_steps hot caches,
  the RT reserve's settle-decay, the depth plan;
- trustno1-coder#1971 the launcher's shader warm and preload runs apply what play applies;
- trustno1-coder#1911 Series S keeps 1,536 MB for render targets, not 3,072;
- trustno1-coder#1985 the XMA decoder thread runs at the helpers' priority
  (VICTORY_XMA_PRIORITY=-2..2);
- trustno1-coder#1912 flights in the air are settled before a bake reads title memory
  (VICTORY_BAKE_SETTLE);
- trustno1-coder#1274 room for a full-size 3840x2160 scene (VICTORY_NATIVE_4K,
  VICTORY_RT_HEAP_MB, VICTORY_SCENE_POOL).
@davemathews12

Copy link
Copy Markdown

This fixes a real problem. #3451 is full of people who ran victory.exe preload / warm by hand from a plain shell. Their caches are keyed without play's translator switches (VICTORY_BVH_MISS, VICTORY_NAN_SCRUB, VICTORY_EARLY_DEPTH, VICTORY_SAMPLED_MARKS are all named in the translator, so all are in translation_fingerprint), and the game then compiles everything again in play.

One interaction to guard against: the script launcher. scripts\play-foxhound.ps1 sets its own switch table, runs victory preload in that environment, and then starts the game with victory run. run doesn't call apply_defaults. Because apply_defaults fills in every play default the environment lacks, the launcher's preload would gain any translator switch that play sets and the launcher doesn't. Its cache would then no longer match the game the launcher starts.

That's already the case on main for VICTORY_SAMPLED_MARKS (and VICTORY_BVH_MISS / VICTORY_NAN_SCRUB until #3411 or #2722 lands). #3411 leaves SAMPLED_MARKS out of the launcher on purpose ("with them the save point took 2.7 GB more"), so the gap is meant to stay.

Suggestion: apply the defaults only when none of play's settings are in the environment. That is a command typed in a plain shell; the launcher, victory play and the F1 restart always set them. For example:

let (s, _) = settings(&Plain::parse_from(["play"]).play, &menu, None);
if s.keys().any(|k| std::env::var_os(k).is_some()) {
    return; // started by play or a launcher: its switches stand
}

With that, a hand-typed preload matches victory play, and a launcher's preload keeps matching the launcher's own game.

… environment (a launcher's own preload keeps its switch table)
@eleboucher

Copy link
Copy Markdown
Contributor Author

Thanks, done as you suggested: apply_defaults now returns when any of play's settings is already in the environment, and otherwise fills them all. A hand-typed preload/warm/shaders gets play's keys; play, the F1 restart and play-foxhound.ps1 keep their own switch table, so the launcher's cache still matches the game it starts with victory run. Also merged main. The red check is main's own clippy errors (unwind_copy, victory-shader analysis.rs/native.rs), which #2048 clears.

Comment thread apps/victory/src/play.rs Outdated
let Ok(home) = home() else { return };
let menu = parse_menu(&std::fs::read_to_string(home.join("victory-settings.txt")).unwrap_or_default());
let (s, _) = settings(&Plain::parse_from(["play"]).play, &menu, None);
if s.keys().any(|k| std::env::var_os(k).is_some()) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#3884 reproduces on the exact release/main 41adb551. All four listed switches are present in play and in the cache-key path. I ran the production settings logic and shader_cache::translation() in separate Windows fixture processes. Play defaults Cache key inputs

Scenario Standalone preload key prefix Matching play key prefix
Main, clean environment 43ddf8eba9a8c027 01189934b9bc314f
#1971 a6e5ddb, clean environment 01189934b9bc314f 01189934b9bc314f
#1971, standalone shell with only VICTORY_EARLY_DEPTH=0 43ddf8eba9a8c027 125747ae336d4ee0

The last case exits here because one setting is present. The override survives, but NAN_SCRUB, SAMPLED_MARKS, and BVH_MISS remain unset. Its matching launch uses play --set VICTORY_EARLY_DEPTH=0 and has all three at 1.

I tested using the existing VICTORY_MENU_PLAY marker to recognize the two launchers' prepared environment, and filling only missing variables in a standalone shell. Clean preload still matches play. The single override now matches 125747ae336d4ee0. A launcher-marked child retains its deliberately partial table and the same key 8e34f419fb8fc944. The 28 existing play::tests passed. Script launcher marker

Could we use the launcher marker here, or have the existing launchers pass an explicit equivalent, so a standalone caller can keep one override and fill the remaining defaults? The fixture checked key equality. A gameplay preload run remains a separate check.

If you reuse this regression case or follow-up, please retain its authorship with Co-authored-by: andrewpozdnakov7-jpg <andrewpozdnakov7-jpg@users.noreply.github.com>.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, that is the better rule; done in 8b5d771 following your suggestion (credit for the regression case and the marker idea is yours): apply_defaults returns when VICTORY_MENU_PLAY is set (play/F1 restart set it at play.rs:1149, play-foxhound.ps1 at line 310), and otherwise fills only the variables the shell did not set. So a clean standalone preload keys like play, a standalone shell with one override keeps it and gets the other defaults, and a launcher-marked child keeps its own table. victory clippy is clean here; I have not re-run your key fixture.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Retested the exact updated head 8b5d771d on Windows. All five fixture processes produced the expected keys. Clean preload and play both used 01189934b9bc314f. With only VICTORY_EARLY_DEPTH=0, preload and the matching play launch both used 125747ae336d4ee0. The launcher-marked child kept its partial environment and 8e34f419fb8fc944.

This resolves the environment-override case I raised. Thanks for the update.

…; a plain shell fills only the defaults it did not set
SJTheGreat06 pushed a commit to SJTheGreat06/VIctory-NVIDIA that referenced this pull request Nov 30, 2026
…d preload run on their own apply the defaults play applies
@eleboucher

Copy link
Copy Markdown
Contributor Author

Merged main (c71899d), no conflicts. Main already carries apply_defaults and its call, so this PR's diff is now only the VICTORY_MENU_PLAY early return in play.rs. apply_defaults reads play's current SETTINGS, so the 14 entries c71899d turned on are covered; none of them is in the translation cache key. Windows cargo xwin check -p victory (with and without diagnostics) passes; the play:: and warm:: tests pass on Windows.

@andrewpozdnakov7-jpg

Copy link
Copy Markdown
Contributor

I reran the five Windows cache-key scenarios on release main c71899d and the exact PR head 2c45596. The fixture uses the launcher defaults and the production shader translation key.

Scenario Release main This PR
Clean shell: preload and play Both 8e237e33026210df Both 8e237e33026210df
Standalone VICTORY_EARLY_DEPTH=0: preload and play Both d9b08adeabe58304 Both d9b08adeabe58304
Prepared launcher with VICTORY_MENU_PLAY and SAMPLED_MARKS absent Preload adds SAMPLED_MARKS=1, key d9b08adeabe58304 Preload leaves it absent, key b5e4de90a09821ac

The remaining guard in this PR fixes the prepared-launcher case on release main. Standalone commands still fill in missing defaults and preserve explicit overrides. The scoped Windows test runs on the PR passed 29 launcher tests and 12 warm-up tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-fix Pull request: fixes a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants