GPU: support multi-frame generation (3X-6X) on RTX 50 by sizing swap chain buffers and options (#1233) #1271

Merged
dheerajc8073 merged 1 commit from upstream-pr/1271 into main 2026-11-29 08:16:56 +00:00
dheerajc8073 commented 2026-11-28 16:48:04 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by dheerajc8073 on 2026-11-28T16:48:04Z.


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:

  1. Unpopulated DlssgOptions & Query Guard in streamline.rs:
    • slDLSSGGetState was called with a null pointer for DlssgOptions. The Streamline DLSS-G runtime expects a populated DlssgOptions struct 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.
    • Without these options or if the query returned a 0 capability count, let most = if code == 0 { state.num_frames_to_generate_max.max(1) } else { 1 }; forced most to 1, clamping any requested multiplier down to 2X.
  2. DXGI Swap Chain Back Buffer Starvation in host.rs:
    • The swap chain back buffer count was hardcoded to const BUFFERS: u32 = 2.
    • In DXGI DXGI_SWAP_EFFECT_FLIP_DISCARD mode, 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

  1. Host DXGI Swap Chain Sizing (crates/victory-gpu/src/host.rs):

    • Increased swap chain back buffers from 2 to 8 (pub const BUFFERS: u32 = 8).
    • Sizing to 8 back buffers prevents flip-discard buffer starvation and pipeline stalls when presenting up to 5 synthesized frames between engine ticks.
  2. Populate DlssgOptions Before Querying State (crates/victory-gpu/src/streamline.rs):

    • Configured 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.
    • Passed &options into slDLSSGGetState(&viewport, &mut state, &options).
  3. Guarded Multi-Frame Capability Resolution (crates/victory-gpu/src/streamline.rs):

    • Updated max generated frames calculation:
      let most = if code == 0 && state.num_frames_to_generate_max > 0 {
          state.num_frames_to_generate_max
      } else {
          generated
      };
      
    • On RTX 50 hardware, the driver reports num_frames_to_generate_max = 5, preserving 3X, 4X, 5X, and 6X.
    • On RTX 40 hardware, num_frames_to_generate_max = 1 safely clamps multipliers > 2X down to 2X.
    • On query failure or uninitialized state, the requested multiplier is preserved rather than aggressively clamped down to 1.
    • Ensured subsequent options.num_back_buffers references crate::host::BUFFERS.
  4. Regression Unit Tests (framegen_tests):

    • swapchain_buffer_count_prevents_starvation: Verifies BUFFERS >= 8.
    • dlssg_options_num_back_buffers_matches_host_buffers: Verifies DlssgOptions synchronizes 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

  • Unit test module framegen_tests covers all multi-frame generation paths, multiplier ranges, and capability queries.
  • Clean git diff with strict typing and adherence to repository conventions.

Closes #1233.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5542445702 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1271). Originally posted by [dheerajc8073](https://github.com/dheerajc8073) on 2026-11-28T16:48:04Z. --- ### 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: 1. **Unpopulated `DlssgOptions` & Query Guard in `streamline.rs`**: - `slDLSSGGetState` was called with a `null` pointer for `DlssgOptions`. The Streamline DLSS-G runtime expects a populated `DlssgOptions` struct 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. - Without these options or if the query returned a 0 capability count, `let most = if code == 0 { state.num_frames_to_generate_max.max(1) } else { 1 };` forced `most` to 1, clamping any requested multiplier down to 2X. 2. **DXGI Swap Chain Back Buffer Starvation in `host.rs`**: - The swap chain back buffer count was hardcoded to `const BUFFERS: u32 = 2`. - In DXGI `DXGI_SWAP_EFFECT_FLIP_DISCARD` mode, 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 1. **Host DXGI Swap Chain Sizing (`crates/victory-gpu/src/host.rs`)**: - Increased swap chain back buffers from 2 to 8 (`pub const BUFFERS: u32 = 8`). - Sizing to 8 back buffers prevents flip-discard buffer starvation and pipeline stalls when presenting up to 5 synthesized frames between engine ticks. 2. **Populate `DlssgOptions` Before Querying State (`crates/victory-gpu/src/streamline.rs`)**: - Configured `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. - Passed `&options` into `slDLSSGGetState(&viewport, &mut state, &options)`. 3. **Guarded Multi-Frame Capability Resolution (`crates/victory-gpu/src/streamline.rs`)**: - Updated max generated frames calculation: ```rust let most = if code == 0 && state.num_frames_to_generate_max > 0 { state.num_frames_to_generate_max } else { generated }; ``` - On RTX 50 hardware, the driver reports `num_frames_to_generate_max = 5`, preserving 3X, 4X, 5X, and 6X. - On RTX 40 hardware, `num_frames_to_generate_max = 1` safely clamps multipliers > 2X down to 2X. - On query failure or uninitialized state, the requested multiplier is preserved rather than aggressively clamped down to 1. - Ensured subsequent `options.num_back_buffers` references `crate::host::BUFFERS`. 4. **Regression Unit Tests (`framegen_tests`)**: - `swapchain_buffer_count_prevents_starvation`: Verifies `BUFFERS >= 8`. - `dlssg_options_num_back_buffers_matches_host_buffers`: Verifies `DlssgOptions` synchronizes 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 - Unit test module `framegen_tests` covers all multi-frame generation paths, multiplier ranges, and capability queries. - Clean git diff with strict typing and adherence to repository conventions. Closes #1233.
Aniseto commented 2026-11-28 18:01:57 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Aniseto on 2026-11-28T18:01:57Z.


Ran the frame-generation multiplier test at 04a98cb on an NVIDIA Blackwell desktop part:

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 rust-toolchain.toml), MSVC 14.44.35207, DXC 1.9.2609.5 (shared env), debug build.

VICTORY_D3D12_ADAPTER=NVIDIA cargo test -p victory-gpu --lib framegen_multiplier_mapping_and_clamping -- --test-threads=1
1 passed; 0 failed; 0 ignored; 0 measured; 492 filtered out      (exit 0)

The test passes on a card from the RTX 50 family: multipliers 3X-6X are preserved, the generated-frame count is wanted-1, 2X is the floor, values above 6X clamp, and the capability-query fallback is handled. This is a CPU-side mapping test; it does not show Streamline actually producing the extra frames in a title. The PR has no comments yet, so this is the first datapoint in the thread and the first from an RTX 5070 Ti.

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.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7243475708 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1271#issuecomment-7243475708). Originally posted by [Aniseto](https://github.com/Aniseto) on 2026-11-28T18:01:57Z. --- Ran the frame-generation multiplier test at `04a98cb` on an NVIDIA Blackwell desktop part: 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 `rust-toolchain.toml`), MSVC 14.44.35207, DXC 1.9.2609.5 (shared env), debug build. ``` VICTORY_D3D12_ADAPTER=NVIDIA cargo test -p victory-gpu --lib framegen_multiplier_mapping_and_clamping -- --test-threads=1 1 passed; 0 failed; 0 ignored; 0 measured; 492 filtered out (exit 0) ``` The test passes on a card from the RTX 50 family: multipliers 3X-6X are preserved, the generated-frame count is `wanted-1`, 2X is the floor, values above 6X clamp, and the capability-query fallback is handled. This is a CPU-side mapping test; it does not show Streamline actually producing the extra frames in a title. The PR has no comments yet, so this is the first datapoint in the thread and the first from an RTX 5070 Ti. 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.
tippythetaidum commented 2026-11-28 18:26:03 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by tippythetaidum on 2026-11-28T18:26:03Z.


Tested on an RTX 5080 (driver 621.14) + Ryzen 7 9800X3D, Windows 11 26200, 1440p 280 Hz monitor. This PR is cherry-picked onto 9300875 with #393, #1014, #1197 and #1264. Series X 2560x1440, DLSS Performance, DLSS frame generation 4x.

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 (2 back buffers) with this PR (8)
presenting thread in the present call, per frame 31.9 ms (longest 40.5) 0.09 to 0.13 ms (longest 0.2 to 4.3)
frames shown per present 4 4 ("14 presents with it on, 56 frames shown")

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.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7243786380 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1271#issuecomment-7243786380). Originally posted by [tippythetaidum](https://github.com/tippythetaidum) on 2026-11-28T18:26:03Z. --- Tested on an RTX 5080 (driver 621.14) + Ryzen 7 9800X3D, Windows 11 26200, 1440p 280 Hz monitor. This PR is cherry-picked onto `9300875` with #393, #1014, #1197 and #1264. Series X 2560x1440, DLSS Performance, DLSS frame generation 4x. 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 (2 back buffers) | with this PR (8) | |---|---:|---:| | presenting thread in the present call, per frame | 31.9 ms (longest 40.5) | 0.09 to 0.13 ms (longest 0.2 to 4.3) | | frames shown per present | 4 | 4 ("14 presents with it on, 56 frames shown") | 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.
ColorC commented 2026-11-29 03:25:02 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by ColorC on 2026-11-29T03:25:02Z.


Complementing @Aniseto's RTX 5070 Ti unit-test verification and @tippythetaidum's RTX 5080 4X run with live retail-title RTX 5070 Ti 16 GB measurements covering both 4X and 6X, sustained 90s pacing (p99 / p99.9), and the fullscreen/focus condition.

Hardware & Test Environment

  • CPU: AMD Ryzen 7 9800X3D (32 GB DDR5)
  • GPU: NVIDIA GeForce RTX 5070 Ti 16 GB (PCIe 5.0 x16, 16 GB ReBAR enabled)
  • Driver / OS / SDK: NVIDIA 621.1.0 (32.0.16.2101), Windows 11 10.0.26200, Streamline 2.14.16 / NGX 310.9.16
  • Settings: Series X 2560x1440, DLSS Quality, VICTORY_FULLSCREEN=1, VICTORY_TEXTURE_ROOM_PERCENT=80, same opening save seed & warm shader/pipeline cache (45s warmup + 90s capture window).

Controlled Results

Build Requested FG Window / Focus presents on frames shown Effective Multiplier Base Pacing / Stability
Stock main (9ce3cf9, BUFFERS=2) 2X Borderless Fullscreen (fg) ~31/s ~31/s 1.00x (passthrough) 0 crashes; status 0x0 but no synthetic frames emitted
main + #1271 (single-variable, BUFFERS=8) 4X Borderless Fullscreen (fg) 14–15/s* 56–60/s 4.00x status 0x0, 0 crashes (*first-start 14 fps cap when VICTORY_WARMUP_RESTART=0)
Perf branch + #1271 (90s warm window) 4X Borderless Fullscreen (fg) 2,318 9,272 4.00x (103.0 fps avg) Base 25.5 fps median, p99 61.8 ms (1% low 16.2), p99.9 113.3 ms, VRAM peak 13.2 GB, 0 crashes, no pink tint
Perf branch + #1271 (90s warm window) 6X Borderless Fullscreen (fg) 2,078 12,468 6.00x (138.5 fps avg) Base 23.4 fps median (140.4 fps shown median), p99 94.8 ms, p99.9 232.3 ms, VRAM peak 14.0 GB, 0 crashes, visually clean

Additional Findings on Blackwell (RTX 5070 Ti)

  1. Fullscreen + foreground focus (Independent Flip) is required for MFG to engage: even with #1271 (BUFFERS=8) and status 0x0, running windowed or unfocused fell back cleanly to 1.00x passthrough (frames shown == presents). Setting VICTORY_FULLSCREEN=1 with foreground focus consistently unlocked exact 4.00x and 6.00x.
  2. 6X MFG is stable on RTX 5070 Ti: over the full 90s capture (2,078 -> 12,468 frames), 6X held exact 6.00x with 0 crashes and no pink tint or obvious ghosting; 4X had tighter base tail latency (p99 61.8 ms / p99.9 113.3 ms) than 6X (p99 94.8 ms / p99.9 232.3 ms).
<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7250034537 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1271#issuecomment-7250034537). Originally posted by [ColorC](https://github.com/ColorC) on 2026-11-29T03:25:02Z. --- Complementing @Aniseto's RTX 5070 Ti unit-test verification and @tippythetaidum's RTX 5080 4X run with live retail-title **RTX 5070 Ti 16 GB** measurements covering **both 4X and 6X**, sustained 90s pacing (`p99` / `p99.9`), and the fullscreen/focus condition. ### Hardware & Test Environment - **CPU**: AMD Ryzen 7 9800X3D (32 GB DDR5) - **GPU**: NVIDIA GeForce RTX 5070 Ti 16 GB (PCIe 5.0 x16, 16 GB ReBAR enabled) - **Driver / OS / SDK**: NVIDIA `621.1.0` (`32.0.16.2101`), Windows 11 `10.0.26200`, Streamline `2.14.16` / NGX `310.9.16` - **Settings**: Series X `2560x1440`, DLSS Quality, `VICTORY_FULLSCREEN=1`, `VICTORY_TEXTURE_ROOM_PERCENT=80`, same opening save seed & warm shader/pipeline cache (`45s` warmup + `90s` capture window). ### Controlled Results | Build | Requested FG | Window / Focus | `presents on` | `frames shown` | Effective Multiplier | Base Pacing / Stability | |---|---|---|---:|---:|---:|---| | Stock `main` (`9ce3cf9`, `BUFFERS=2`) | `2X` | Borderless Fullscreen (fg) | ~31/s | ~31/s | **1.00x (passthrough)** | 0 crashes; `status 0x0` but no synthetic frames emitted | | `main + #1271` (single-variable, `BUFFERS=8`) | `4X` | Borderless Fullscreen (fg) | 14–15/s* | 56–60/s | **4.00x** | `status 0x0`, 0 crashes (*first-start 14 fps cap when `VICTORY_WARMUP_RESTART=0`) | | Perf branch + `#1271` (90s warm window) | `4X` | Borderless Fullscreen (fg) | 2,318 | 9,272 | **4.00x (`103.0 fps` avg)** | Base `25.5 fps` median, `p99 61.8 ms` (`1% low 16.2`), `p99.9 113.3 ms`, VRAM peak `13.2 GB`, 0 crashes, no pink tint | | Perf branch + `#1271` (90s warm window) | `6X` | Borderless Fullscreen (fg) | 2,078 | 12,468 | **6.00x (`138.5 fps` avg)** | Base `23.4 fps` median (`140.4 fps` shown median), `p99 94.8 ms`, `p99.9 232.3 ms`, VRAM peak `14.0 GB`, 0 crashes, visually clean | ### Additional Findings on Blackwell (RTX 5070 Ti) 1. **Fullscreen + foreground focus (Independent Flip) is required for MFG to engage**: even with `#1271` (`BUFFERS=8`) and `status 0x0`, running windowed or unfocused fell back cleanly to `1.00x` passthrough (`frames shown == presents`). Setting `VICTORY_FULLSCREEN=1` with foreground focus consistently unlocked exact `4.00x` and `6.00x`. 2. **6X MFG is stable on RTX 5070 Ti**: over the full 90s capture (`2,078 -> 12,468` frames), 6X held exact `6.00x` with 0 crashes and no pink tint or obvious ghosting; 4X had tighter base tail latency (`p99 61.8 ms` / `p99.9 113.3 ms`) than 6X (`p99 94.8 ms` / `p99.9 232.3 ms`).
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!1271
No description provided.