Skip to content

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

Open
dheerajc8073 wants to merge 1 commit into
trustno1-coder:mainfrom
dheerajc8073:fix/framegen-mfg-multiplier-buffers
Open

dheerajc8073 wants to merge 1 commit into
trustno1-coder:mainfrom
dheerajc8073:fix/framegen-mfg-multiplier-buffers

Conversation

@dheerajc8073

@dheerajc8073 dheerajc8073 commented Nov 28, 2026 •

Copy link
Copy Markdown

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.

…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Frame Gen

1 participant