From 29d8dbf7d9892ceb8bec378a9dbc3c4f2931b745 Mon Sep 17 00:00:00 2001 From: trustno1-coder <361337194+trustno1-coder@users.noreply.github.com> Date: Fri, 27 Nov 2026 09:06:36 -0800 Subject: [PATCH] AMD FSR 3 frame generation for cards without DLSS frame generation; start notice; F1 preload - FSR 3 frame generation (AMD FidelityFX 2.x DLLs, never in the repository: VICTORY_FIDELITYFX_DIR or a fidelityfx folder beside victory.exe), 2x at most, with the HUD-less picture so the HUD is not doubled. Series X needs DLSS upscaling. - F1 menu: FRAME GEN TYPE (auto, DLSS, FSR 3); PRELOAD SHADERS; unset rows read NOT SET; save and restart opens its own console window. - A notice at the start (30 s on the picture, and in the console): the GPU, which frame generation runs, and why not (DLSS off, NVIDIA files missing, or the card). - victory preload / --preload; warm keys its work to the program's path. - Logs are named victory-nvidia-...; README: what each card supports, first. Co-Authored-By: Claude Opus 5.5 --- README.md | 20 + apps/victory/src/main.rs | 23 + apps/victory/src/play.rs | 99 ++- apps/victory/src/run.rs | 11 +- apps/victory/src/warm.rs | 66 +- crates/victory-gpu/src/host.rs | 31 +- crates/victory-gpu/src/host/menu.rs | 139 +++- crates/victory-gpu/src/host/panel.rs | 182 +++-- crates/victory-gpu/src/pipeline/known.rs | 13 + crates/victory-gpu/src/streamline.rs | 256 +++++- crates/victory-gpu/src/streamline/fsr.rs | 944 +++++++++++++++++++++++ scripts/play-foxhound.ps1 | 46 +- 12 files changed, 1712 insertions(+), 118 deletions(-) create mode 100644 crates/victory-gpu/src/streamline/fsr.rs diff --git a/README.md b/README.md index d48c2e9..66b60aa 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,24 @@ # VIctory on NVIDIA +## Frame generation: what your card supports + +| Your card | Frame generation | Limits | +| --- | --- | --- | +| GeForce RTX 40 and RTX 50 | **DLSS frame generation** | 2x on RTX 40; more than 2x (up to 6x) needs an RTX 50 | +| GeForce RTX 20 and RTX 30 | **AMD FSR 3 frame generation** (DLSS frame generation needs an RTX 40 or later) | **2x at most**. DLSS upscaling still works on these cards, so the Series X profile is fine | +| Other cards (no DLSS) | **AMD FSR 3 frame generation** | **2x at most, Series S profile only** (F1 menu, CONSOLE): without DLSS the game's own upscaler, which FSR 3 needs, only takes the Series S sizes. Not tested here | + +- **At every start the game tells you** which one your card runs, and why + not if it can't, at the top of the picture for the first 30 seconds (and + in the console window). +- **F1 menu, FRAME GEN TYPE**: AUTO (DLSS where the card has it, else FSR 3), + DLSS, or FSR 3 (also on an RTX 40/50, if you prefer it). FRAME GENERATION + switches it off or on. +- FSR 3 needs AMD's FidelityFX DLLs (`amd_fidelityfx_loader_dx12.dll` and + `amd_fidelityfx_framegeneration_dx12.dll`, from AMD's FidelityFX SDK). They + are AMD's and not part of this program: put them in a `fidelityfx` folder + next to `victory.exe`, or name their folder with `VICTORY_FIDELITYFX_DIR`. + ## Quick start: how to run it **The easy way: one file, nothing to build** @@ -260,6 +279,7 @@ fork has always had; its options: | `-SeriesS` | the Series S profile: 1280x720 inside, faster, softer | | `-Res 1080to1440` / `4k` | scene at 1080p upscaled by the title / the stock 3840x2160 output | | `-NoFrameGenReady` | frame generation only with `-FrameGen` (it is otherwise made ready at every start, so the menu can switch it) | +| `-FgType auto` / `dlss` / `fsr` | which frame generation (see the top of this page); FSR 3's DLLs from `VICTORY_FIDELITYFX_DIR`, else `amd-sdk\FidelityFX\bin` here | | `-Build diag` | the diagnostics build (slower; captures, timelines, recording time in the F3 panel) | | `-More @{VICTORY_X='1'}` | add or override any switch | diff --git a/apps/victory/src/main.rs b/apps/victory/src/main.rs index b55ba11..f3cfa2f 100644 --- a/apps/victory/src/main.rs +++ b/apps/victory/src/main.rs @@ -129,6 +129,17 @@ enum Command { #[arg(long, hide = true)] these: Option, }, + /// Preload: `shaders` and then `warm` over the title's folder, and the + /// pipelines a run makes while it loads stored in the pipeline library + /// the runs start with; what they say is shown as they go (the F1 menu's "PRELOAD SHADERS" has the + /// launcher do this before the title starts). A while, maybe long on + /// slower hardware; an update of the translator or the driver needs it + /// again. Stopped, it goes on where it was the next time. + #[cfg(windows)] + Preload { + /// The title's folder (default: the configured game folder). + paths: Vec, + }, /// Play: the title with this fork's settings, as a start with no /// command at all does (a double click on the program beside the /// title's `game_scarlett_master.exe`). F1 in the game is the settings @@ -213,7 +224,12 @@ fn main() -> Result<()> { // before anything else is set up. #[cfg(windows)] if let Command::Play(options) = &cli.command { + // (Read before `prepare` clears the `VICTORY_...` variables: the menu's restart sets it.) + let preload = options.preload || std::env::var_os("VICTORY_PRELOAD").is_some_and(|v| v == "1"); let done = play::prepare(options).and_then(|ready| { + if preload { + play::preload(&ready.exe); + } victory_core::logging::init("info"); let console = if ready.series_s { Console::SeriesS } else { Console::SeriesX }; run::run(&ready.exe, Unimplemented::Trap, false, true, console) @@ -269,6 +285,13 @@ fn main() -> Result<()> { #[cfg(windows)] Command::Warm { jobs, limit, again, used, these } => warm::run(jobs, limit, again, used, these), #[cfg(windows)] + Command::Preload { paths } => { + play::explain_preload(); + translate::precompile(paths, None)?; + warm::run(None, None, false, false, None)?; + warm::into_library(None) + } + #[cfg(windows)] Command::Play(_) => unreachable!("handled above"), #[cfg(windows)] Command::GetDlss => play::get_dlss(), diff --git a/apps/victory/src/play.rs b/apps/victory/src/play.rs index 92e7ca7..ec9ff61 100644 --- a/apps/victory/src/play.rs +++ b/apps/victory/src/play.rs @@ -88,9 +88,12 @@ const KEPT: &[&str] = &[ "VICTORY_CACHE_DIR", "VICTORY_DATA_DIR", "VICTORY_STREAMLINE_DIR", + "VICTORY_FIDELITYFX_DIR", "VICTORY_LOG", ]; +const FG_TYPES: [&str; 3] = ["auto", "dlss", "fsr"]; + const RESOLUTIONS: [&str; 3] = ["1440", "1080to1440", "4k"]; const DLSS_MODES: [&str; 5] = ["off", "dlaa", "quality", "balanced", "performance"]; @@ -116,12 +119,55 @@ pub(crate) struct Play { /// Frame generation not made ready at the start. #[arg(long)] no_framegen_ready: bool, + /// Which frame generation: auto (DLSS frame generation where the card has + /// it, RTX 40 and later, else AMD FSR 3), dlss, or fsr (2X at most). FSR 3 + /// needs AMD's FidelityFX DLLs (`VICTORY_FIDELITYFX_DIR`, else a + /// `fidelityfx` folder beside this program) and, on Series X, DLSS. + #[arg(long, default_value = "auto", value_parser = FG_TYPES)] + fg_type: String, /// Frames a second at most (30: the title's own rate; 1000: no cap). #[arg(long, default_value_t = 1000, value_parser = clap::value_parser!(u32).range(1..=1000))] fps: u32, /// Add or override a switch, as often as needed: `--set VICTORY_X=1`. #[arg(long = "set", value_name = "NAME=VALUE")] more: Vec, + /// Make every shader before the title starts (`victory preload`, as the + /// F1 menu's "PRELOAD SHADERS" does): a while, maybe long. + #[arg(long)] + pub(crate) preload: bool, +} + +/// What a preload is, said before it begins. +pub(crate) fn explain_preload() { + println!(); + println!("Preloading shaders: every shader of the title is translated, then the pipelines the game"); + println!("made in earlier runs are built, and those it needs while loading are stored where it loads"); + println!("them from at the start, so it does not stop to make them while you play."); + println!("This takes a while, and possibly a long time, depending on your hardware (CPU above all)."); + println!("What is done is kept: stopped (close this window), the next preload goes on from there."); + println!("A later update of this build, or a new graphics driver, may need a new preload."); + println!(); +} + +/// Runs `victory preload` over the title's folder with this start's settings +/// (the translations depend on them), then lets the start go on, whatever came of it. +pub(crate) fn preload(exe: &Path) { + let folder = exe.parent().map(Path::to_path_buf).unwrap_or_default(); + let began = std::time::Instant::now(); + let done = std::env::current_exe().and_then(|program| { + std::process::Command::new(program) + .arg("preload") + .arg(&folder) + // Its own lines in this window; the start's log is the title's. + .env_remove("VICTORY_LOG_FILE") + .status() + }); + let minutes = began.elapsed().as_secs_f64() / 60.0; + match done { + Ok(s) if s.success() => println!("Shaders preloaded in {minutes:.1} min. Starting the game."), + Ok(s) => println!("The preload stopped ({s}) after {minutes:.1} min; what it did is kept. Starting the game."), + Err(e) => println!("The preload did not start ({e}). Starting the game."), + } } /// `%LOCALAPPDATA%\victory`. @@ -177,6 +223,7 @@ fn settings(o: &Play, menu: &[(String, String)], streamline: Option<&Path>) -> ( times = n; } } + let fg_type = saved("VICTORY_MENU_FG_TYPE").filter(|t| FG_TYPES.contains(t)).unwrap_or(&o.fg_type); let fps = saved("VICTORY_MENU_FPS") .and_then(|f| f.parse::().ok()) .filter(|f| (1..=1000).contains(f)) @@ -213,6 +260,22 @@ fn settings(o: &Play, menu: &[(String, String)], streamline: Option<&Path>) -> ( set("VICTORY_TEXTURE_ROOM_PERCENT", if framegen { "80" } else { "86" }); } } + // AMD FSR 3 frame generation, made ready as DLSS frame generation is: auto, the layer uses + // it only where DLSS frame generation does not run; fsr, DLSS frame generation is not asked. + // The layer checks the files and the card and says at the start what runs and why not. + if fg_type != "dlss" && (framegen || !o.no_framegen_ready) { + set("VICTORY_FSR_FRAMEGEN", "1"); + if fg_type == "fsr" { + s.remove("VICTORY_FRAMEGEN"); + } + let mut set = |k: &str, v: &str| drop(s.insert(k.to_owned(), v.to_owned())); + let x = *framegen_x.get_or_insert(if framegen { times } else { 0 }); + set("VICTORY_FRAMEGEN_X", &x.to_string()); + if !s.contains_key("VICTORY_TEXTURE_ROOM_PERCENT") { + s.insert("VICTORY_TEXTURE_ROOM_PERCENT".to_owned(), if framegen { "80" } else { "86" }.to_owned()); + } + } + let mut set = |k: &str, v: &str| drop(s.insert(k.to_owned(), v.to_owned())); set("VICTORY_FRAME_INTERVAL_US", &(1_000_000.0 / f64::from(fps)).round().to_string()); for (k, v) in menu.iter().filter(|(k, _)| !k.starts_with("VICTORY_MENU_")) { if v.is_empty() { @@ -230,6 +293,7 @@ fn settings(o: &Play, menu: &[(String, String)], streamline: Option<&Path>) -> ( set("VICTORY_MENU_RES", res); set("VICTORY_MENU_DLSS", if dlss_on { dlss } else { "off" }); set("VICTORY_MENU_FRAMEGEN", &framegen_x.unwrap_or(0).to_string()); + set("VICTORY_MENU_FG_TYPE", fg_type); set("VICTORY_MENU_FPS", &fps.to_string()); (s, series_s) } @@ -260,16 +324,21 @@ fn log_file(logs: &Path) -> Result { .flatten() .flatten() .map(|e| e.path()) - .filter(|p| p.file_name().is_some_and(|n| n.to_string_lossy().starts_with("play-"))) + // ("play-": the name before 2026-11-27; it sorts first, so goes first.) + .filter(|p| p.file_name().is_some_and(|n| n.to_string_lossy().starts_with(LOG_PREFIX) || n.to_string_lossy().starts_with("play-"))) .collect(); old.sort(); for gone in old.iter().rev().skip(9) { let _ = std::fs::remove_file(gone); } let now = std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).map_or(0, |d| d.as_secs()); - Ok(logs.join(format!("play-{}-{}.log", stamp(now), std::process::id()))) + Ok(logs.join(format!("{LOG_PREFIX}{}-{}.log", stamp(now), std::process::id()))) } +/// The start of the built-in launcher's log names (scripts\play-foxhound.ps1's +/// are `victory-nvidia--