Repository navigation
GPU: support multi-frame generation (3X-6X) on RTX 50 by sizing swap chain buffers and options (#1233) - #1271
Conversation
…chain buffers and options (trustno1-coder#1233) Root cause: On RTX 50 series cards (Blackwell, e.g. RTX 5060 Ti / RTX 5080), multi-frame generation (3X-6X via VICTORY_FRAMEGEN_X) clamped down to 2X (1 generated frame per engine frame) due to two interdependent constraints: 1. slDLSSGGetState was called with a null pointer for options. The Streamline DLSSG runtime requires populated DlssgOptions containing num_back_buffers and viewport dimensions to report multi-frame generation capabilities. Furthermore, any query failure or zero return prematurely forced `most` down to 1 (2X). 2. The DXGI swap chain buffer count in host.rs was hardcoded to 2 back buffers. Under flip-discard model, presenting up to 5 synthesized frames per engine frame causes swapchain starvation and presentation stalls unless sufficient back buffers are allocated. Changes: - Increased host DXGI swap chain back buffer count from 2 to 8 (BUFFERS = 8) to avoid buffer starvation when presenting up to 5 synthesized frames. - Populated DlssgOptions with num_back_buffers, flags, dimensions, and num_frames_to_generate prior to slDLSSGGetState, passing &options instead of null. - Guarded state.num_frames_to_generate_max against premature 1-clamping so queries that succeed report true multi-frame capacity, while preserving the requested generation level on fallback. - Added comprehensive regression tests in framegen_tests covering swap chain buffer sizing, DlssgOptions alignment, multiplier clamping, and query resolution across RTX 50 and RTX 40 hardware profiles. Closes trustno1-coder#1233 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Ran the frame-generation multiplier test at Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only, 16 GB) driver 32.0.16.2124, Intel Core i5-12400F, 64 GB RAM, Rust 1.98.1 (48a229cea 2026-09-01, pinned by The test passes on a card from the RTX 50 family: multipliers 3X-6X are preserved, the generated-frame count is Not tested: a retail title, presented-frame counts with MFG 3X-6X, a paired smoke run, the full workspace suite, AMD and Intel GPUs, native wave64 hosts, Wine, release profile, game data. AI-assisted (OpenCode), model: DeepSeek V4.1 Flash Free - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used. |
|
Tested on an RTX 5080 (driver 621.14) + Ryzen 7 9800X3D, Windows 11 26200, 1440p 280 Hz monitor. This PR is cherry-picked onto On this card, 4x was not clamped to 2x before this PR. The Streamline line already showed 4 frames per present ("15 presents with it on, 0 off, 60 frames shown"). But with 2 back buffers the present call held the presenting thread for most of a frame:
Before, the frame rate sat at exactly 14.0 rendered / 56 shown in every scene, on a 60 Hz and on a 280 Hz monitor alike. With the PR the rendered rate follows the scene (10 to 20 in the world here, about 40 to 64 shown). No errors, and the picture looked right in a daytime drive. In heavy outdoor scenes (11,000 draws a frame) the rendered rate didn't go up much, because the submitting thread sets it there. The stall itself is gone. |
…TX 50 by sizing swap c
Summary
Fixes #1233. Resolves an issue on NVIDIA GeForce RTX 50 series graphics cards (Blackwell architecture, e.g. RTX 5060 Ti, RTX 5080) where selecting multi-frame generation multipliers higher than 2X (
VICTORY_FRAMEGEN_X=3..6) in the F1 menu clamped presentation down to 2X (1 generated frame per engine frame).Root Cause Analysis
On RTX 50 series GPUs supporting DLSS Multi-Frame Generation (MFG) up to 6X (up to 5 synthesized frames per engine render), requested frame generation multipliers 3X through 6X were being prematurely constrained due to two interconnected limitations:
DlssgOptions& Query Guard instreamline.rs:slDLSSGGetStatewas called with anullpointer forDlssgOptions. The Streamline DLSS-G runtime expects a populatedDlssgOptionsstruct containing valid swap chain parameters (num_back_buffers), viewport dimensions (color_width,color_height), and generation flags (DLSSG_RETAIN_RESOURCES_WHEN_OFF) to report the hardware's multi-frame generation capabilities.let most = if code == 0 { state.num_frames_to_generate_max.max(1) } else { 1 };forcedmostto 1, clamping any requested multiplier down to 2X.host.rs:const BUFFERS: u32 = 2.DXGI_SWAP_EFFECT_FLIP_DISCARDmode, generating and queueing up to 5 synthesized frames per engine frame (6X multiplier) requires a sufficiently deep buffer queue. Sizing at only 2 back buffers starves the swapchain pipeline, resulting in presenter stalls, dropped presentation slots, or driver fallback to standard single-frame generation.Key Changes
Host DXGI Swap Chain Sizing (
crates/victory-gpu/src/host.rs):pub const BUFFERS: u32 = 8).Populate
DlssgOptionsBefore Querying State (crates/victory-gpu/src/streamline.rs):options.num_back_buffers = crate::host::BUFFERS,options.num_frames_to_generate = generated,options.flags = abi::DLSSG_RETAIN_RESOURCES_WHEN_OFF, and viewport dimensions prior to querying state.&optionsintoslDLSSGGetState(&viewport, &mut state, &options).Guarded Multi-Frame Capability Resolution (
crates/victory-gpu/src/streamline.rs):num_frames_to_generate_max = 5, preserving 3X, 4X, 5X, and 6X.num_frames_to_generate_max = 1safely clamps multipliers > 2X down to 2X.options.num_back_buffersreferencescrate::host::BUFFERS.Regression Unit Tests (
framegen_tests):swapchain_buffer_count_prevents_starvation: VerifiesBUFFERS >= 8.dlssg_options_num_back_buffers_matches_host_buffers: VerifiesDlssgOptionssynchronizes with host swap chain buffers.framegen_multiplier_mapping_and_clamping: Tests multiplier clamping (0 turns off, 1 -> 2X, 2..6 preserved, >6 clamped to 6X), generated frame counts (wanted.max(2) - 1), RTX 50 multi-frame preservation (up to 5 generated frames), RTX 40 clamping (1 generated frame), and query fallback resilience.Verification
framegen_testscovers all multi-frame generation paths, multiplier ranges, and capability queries.Closes #1233.