From 033be27f336e395745667df5fe20160e375209ca Mon Sep 17 00:00:00 2001 From: trustno1-coder <361337194+trustno1-coder@users.noreply.github.com> Date: Wed, 25 Nov 2026 19:41:22 -0800 Subject: [PATCH] Pick the card (VICTORY_ADAPTER); RTX 5060 Ti results; Series S 1080p crashes - host.rs: VICTORY_ADAPTER= creates the host device on that card instead of Windows' default; the log names the card, or lists the cards when nothing matches. play-nvidia.ps1 -Adapter. - README: RTX 5060 Ti 16 GB vs RTX 5070 12 GB on the same PC, same build and settings (Series S 540p): 14.9 vs 19.3 fps. The GPU work is close; the 5060 Ti's slot is PCIe 4.0 x4 with no display, and this layer's copies dominate. - README: Series S at 1080p (render scale 1.0) stops at a breakpoint at start on a 12 GB card too, so it is not video memory; use 720p or lower. Co-Authored-By: Claude Opus 5.5 --- README.md | 32 ++++++++++++++++++++--- crates/victory-gpu/src/host.rs | 48 ++++++++++++++++++++++++++++++++++ scripts/play-nvidia.ps1 | 4 +++ 3 files changed, 80 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 8d981f8..2ad8090 100644 --- a/README.md +++ b/README.md @@ -179,6 +179,8 @@ Also in, off by default: - F9 frame capture (`capture.rs`): with `VICTORY_CAPTURE=` and `VICTORY_DUMP_TARGETS=1`, F9 saves the next frame's picture, its commands and every 2D target. +- `VICTORY_ADAPTER=` (`host.rs`): the card to + run on when there is more than one (`play-nvidia.ps1 -Adapter`). --- @@ -258,7 +260,7 @@ subtitles stay sharp either way. Series S outputs 1920x1080 and Series X | Script | Console | World drawn at | Render scale | Tested on the RTX 5070 | |---|---|---|---|---| -| `play-S-1080p.ps1` | Series S | 1920x1080 | 1.0 | not yet (one report of a crash on an RTX 2080 8 GB) | +| `play-S-1080p.ps1` | Series S | 1920x1080 | 1.0 | **crashes at start** (the title stops at a breakpoint; also reported on an RTX 2080) | | `play-S-720p.ps1` | Series S | 1280x720 | 0.667 | not yet | | `play-S-540p.ps1` | Series S | 960x540 | 0.5 | yes: the default, about 18-22 fps | | `play-S-480p.ps1` | Series S | 853x480 | 0.444 | not yet | @@ -283,12 +285,34 @@ What to expect: - **Lower is softer and smears more.** The title's temporal upscaler rebuilds detail from earlier frames. At low resolutions and low frame rates, fast camera moves (driving, turning quickly) leave visible trails. -- **Higher needs more video memory.** At 1.0 the title's targets are at full - size on top of the 1.5 GB set aside for memory compares. On an 8 GB card, - stay at 720p or lower if 1080p crashes. +- **Series S at 1080p (render scale 1.0) does not work yet.** The title stops + at a breakpoint as soon as it starts, on a 12 GB card too, so it is not video + memory. Use 720p or lower on Series S. - Series S cannot go above 1080p: its output is 1080p, and the script says so and stops if asked for more. +### More than one card, and other cards + +On a PC with two cards, `-Adapter` picks one by part of its name or its index +(`-Adapter 5060`, `-Adapter '#1'`); it sets `VICTORY_ADAPTER`, and the log says +which card the game is on. Without it the game uses Windows' default card, the +one the main display is on. + +Measured on the same PC (Ryzen 7 9800X3D), same build and settings +(`play-S-540p`, the default), one run each in the prison prologue: + +| Card | Slot it sits in | fps | Preparing a frame (CPU) | On the GPU | +|---|---|---|---|---| +| RTX 5070 12 GB | PCIe 5.0 x16, drives the display | 19.3 | 34 ms | 4.6 ms | +| RTX 5060 Ti 16 GB | PCIe 4.0 x4, no display attached | 14.9 | 50 ms | 5.4 ms | + +The GPU work itself is close; the gap is in preparing frames, mostly copies of +title memory to and from the card. This layer moves tens of MB a frame, so the +link to the card matters: the 5060 Ti here has about an eighth of the 5070's +bandwidth, and its finished frames are also copied to the 5070 to be shown. +In a full-speed slot with the display on it, a 5060 Ti should land closer to +the 5070. Neither run lost the device; both refused the same 7 programs. + `-Resolution` works on `play-nvidia.ps1` itself too (`-Resolution 720 -SeriesX`), and `-More @{VICTORY_RENDER_SCALE='0.6'}` still sets any scale from 0.2 to 1.0. diff --git a/crates/victory-gpu/src/host.rs b/crates/victory-gpu/src/host.rs index 763cefb..71cde63 100644 --- a/crates/victory-gpu/src/host.rs +++ b/crates/victory-gpu/src/host.rs @@ -884,6 +884,9 @@ fn create() -> windows::core::Result { let adapter = warp_adapter()?; D3D12CreateDevice(&adapter, D3D_FEATURE_LEVEL_12_0, &mut device)?; tracing::info!("host device on the software adapter (WARP)"); + } else if let Some(adapter) = chosen_adapter() { + D3D12CreateDevice(&adapter, D3D_FEATURE_LEVEL_12_0, &mut device)?; + crate::tdr::log(); } else { D3D12CreateDevice(None, D3D_FEATURE_LEVEL_12_0, &mut device)?; // Whether a GPU hang ends the run or freezes the PC (#1054). @@ -982,6 +985,51 @@ impl Host { /// DXGI may return hardware for `EnumWarpAdapter` (notably under Proton). /// Reject it before creating a device in diagnostics' software-only mode. +/// LOCAL: the card `VICTORY_ADAPTER` names, for a PC with more than one. +/// The value is part of the card's name, any case (`5060`, `RTX 5070`), or +/// its index in DXGI's order (`#1`). Unset: Windows' default card. A value +/// that matches no hardware card is logged with the list and ignored. +fn chosen_adapter() -> Option { + let want = std::env::var("VICTORY_ADAPTER").ok()?; + let want = want.trim(); + if want.is_empty() { + return None; + } + // SAFETY: plain DXGI adapter queries. + unsafe { + let factory: IDXGIFactory4 = CreateDXGIFactory2(DXGI_CREATE_FACTORY_FLAGS(0)).ok()?; + let index = want.strip_prefix('#').and_then(|n| n.parse::().ok()); + let mut seen = Vec::new(); + for i in 0.. { + let Ok(adapter) = factory.EnumAdapters1(i) else { break }; + let Ok(desc) = adapter.GetDesc1() else { continue }; + let len = desc.Description.iter().position(|&c| c == 0).unwrap_or(desc.Description.len()); + let name = String::from_utf16_lossy(&desc.Description[..len]); + let software = desc.Flags & DXGI_ADAPTER_FLAG_SOFTWARE.0 as u32 != 0; + let hit = match index { + Some(n) => n == i, + None => name.to_lowercase().contains(&want.to_lowercase()), + }; + if hit && !software { + tracing::warn!( + adapter = %name, + index = i, + memory_mb = desc.DedicatedVideoMemory / (1024 * 1024), + "host device on the card VICTORY_ADAPTER names" + ); + return Some(adapter); + } + seen.push(format!("#{i} {name}")); + } + tracing::warn!( + want, + cards = %seen.join(", "), + "VICTORY_ADAPTER names no hardware card; Windows' default card is used" + ); + None + } +} + pub(crate) fn warp_adapter() -> windows::core::Result { // SAFETY: plain DXGI adapter queries. unsafe { diff --git a/scripts/play-nvidia.ps1 b/scripts/play-nvidia.ps1 index 32ebc6b..277b845 100644 --- a/scripts/play-nvidia.ps1 +++ b/scripts/play-nvidia.ps1 @@ -8,6 +8,8 @@ # -Resolution the height the game renders at before the title's own upscaler: 2160, 1440, 1080, 720, 540 or 480. # Series S outputs 1080p (so up to 1080 there), Series X 2160p. Default: half the output (540 on S, # 1080 on X). The play-S-*.ps1 and play-X-*.ps1 scripts next to this one call it with each. +# -Adapter on a PC with more than one card, the one to use: part of its name (-Adapter 5060) or its index +# (-Adapter '#1'). Default: Windows' default card (the one the main display is on). # -Build target\diag (the default, the build all measurements are of) or target\release # (the release build ignores the ray-tracing skip list: VICTORY_SKIP_PIPELINES is a diagnostics switch) # -More other settings: -More @{VICTORY_PANEL='1'} @@ -19,6 +21,7 @@ param( [switch]$Quality, [switch]$RayTracing, [ValidateSet('2160', '1440', '1080', '720', '540', '480')][string]$Resolution, + [string]$Adapter, [ValidateSet('diag', 'release')][string]$Build = 'diag', [hashtable]$More = @{} ) @@ -77,6 +80,7 @@ if ($Resolution) { } $settings.VICTORY_RENDER_SCALE = ([int]$Resolution / $outHeight).ToString('0.####', [Globalization.CultureInfo]::InvariantCulture) } +if ($Adapter) { $settings.VICTORY_ADAPTER = $Adapter } foreach ($k in $More.Keys) { $settings[$k] = $More[$k] } $scale = [double]::Parse($settings.VICTORY_RENDER_SCALE, [Globalization.CultureInfo]::InvariantCulture) Write-Host "Series $console, rendering at $([int]($outHeight * $scale))p (render scale $($settings.VICTORY_RENDER_SCALE))"