perf(vk): lift Auto-resolution native FPS 13-23% (+10-19% 1% low, -16-20% GPU) and cut FSR3 FI resize spikes 29% on GPU-limited GPUs via framegen-aware DRS #2400

Open
Jer9 wants to merge 3 commits from Jer9/Longshot:feat/vk-fg-aware-drs into main
Contributor

Summary

When Render resolution was set to Auto (opts.resolution = 0), menu_auto_tune() exited early and the renderer relied solely on the game's own internal dynamic resolution (tuned for Switch 2 hardware, not PC upscaler or frame-generation budgets). In GPU-heavy scenes like Market and Hyrule Field on an integrated GPU, the game remained at 75% (1200x750) even when AMD FSR 3.1 + 2x Frame Generation drove GPU time to 29–30 ms per frame (~30 FPS native, 1% lows below 26 FPS). Furthermore, when render resolution changed mid-play while AMD FSR 3.1 Frame Generation was active, gpu/vk/vk_fsr3fi.cpp tore down and reallocated all ~30+ internal resources—including ~25 display-sized optical-flow, luminance, and made[] images that depend solely on display dimensions—triggering frame spikes of +83.5 ms (126.3 ms peak).

This pull request introduces continuous, framegen-aware host Dynamic Resolution Scaling (DRS) and decouples render-sized scratch images from display-sized resources in vk_fsr3fi.cpp:

  1. Continuous Framegen-Aware DRS Controller (gpu/vk/drs.h, gpu/vk/switches.def: RX_VK_DRS): Evaluates native frame time, total GPU time (including upscaler and FG passes), and scene draw counts over rolling ~1-second presentation windows. When GPU utilization is heavy (GPU time > 92% of budget and native FPS < 90% of target for 3 consecutive windows), the controller smoothly steps down 1 quality stop across the active upscaler's defined scale stops (clamped to a 50% floor). A CPU-bound guard prevents downscaling when GPU utilization is low (< 75%), preserving sharpness in draw-call-heavy scenes. Recovery back up requires 10 windows of post-step-down cooldown and 10 windows of clear GPU headroom (< 68% budget and projected headroom at the next stop, allowing CPU-bound iGPUs starting at 67% to recover upward), with exponential cooldown backoff (10 -> 20 -> 40 windows) preventing seesawing.
  2. Decoupled FSR 3.1 Frame Generation Resources (gpu/vk/vk_fsr3fi.cpp): Separates internal resources into 25 display-sized images (of_luma, of_flow, of_vector, of_confidence, of_scd_*, fi_inpainting_pyramid, fi_previous_source, fi_distortion_field, and made[]) and 9 render-sized per-frame scratch images (fi_dilated_depth, fi_dilated_motion_vectors, fi_reconstructed_depth_*, fi_game_mv_*, fi_of_mv_*, fi_disocclusion_mask). When render resolution changes mid-play, only the 9 render-sized scratch images are reallocated; all 25 display-sized images and optical-flow allocations are preserved (while vk_fsr3_inputs.cpp still cleanly signals a 1-frame reset).
  3. Compatibility & Non-Destructive Storage: Active only when RX_VK_DRS=1 and opts.resolution == 0. Operates across all upscalers (FSR 3.1, DLSS, FSR 4, XeSS, Game's own) and presets without mutating saved opts.resolution (0) in longshot_options.ini. Setting RX_VK_DRS=0 completely disables the controller and restores exact previous behavior.

What a player notices:

  • With Render resolution set to Auto, gameplay in demanding scenes stays smooth and responsive: native frame rates increase by +13% to +23% (+10% to +19% 1% lows) and GPU frame times drop by 4.7–5.8 ms (-16% to -20%).
  • Alongside FSR 3.1 Frame Generation 2x, display latency drops by ~17% to ~21% (from 37 ms down to 29–31 ms) with a +18% to +21% increase in on-time presentations and zero resolution oscillation.
  • Dynamic resolution transitions during active Frame Generation feel significantly smoother, cutting mid-play resize spikes by 28.6% (-25.1 ms peak).

Helps:

  • Players on integrated GPUs (AMD Radeon 780M/860M/880M/890M, Intel Arc Xe/Xe2) or power-constrained laptops running with Render resolution = Auto.
  • Players using Frame Generation alongside dynamic resolution.

No measurable impact:

  • Players using fixed render resolutions (opts.resolution != 0, e.g. Quality 67% or Native 100%).
  • High-headroom discrete GPUs (where GPU time stays below the 92% budget threshold).
  • When disabled via RX_VK_DRS=0.

Files to read first:

  • gpu/vk/drs.h: the mkwvk::drs::State / drs::update() state machine, budget calculation, and hysteresis logic.
  • gpu/vk/vk_fsr3fi.cpp: split allocation of display_images() vs render_images().
  • gpu/vk/vk_replay.cpp: integration with log_frame_stats().
  • gpu/vk/vk_menu.cpp: menu_drs_tick(), menu_drs_enabled(), and atomic scale propagation.
  • tests/test_drs.py: deterministic unit tests covering step-down, hysteresis, FIFO+FG budgets, and FSR3 FI resource decoupling.

Testing

Tested:

  • Windows 11 (build 26200), AMD Ryzen AI 7 350, AMD Radeon 860M Graphics (8 CUs, RDNA 3.5 integrated GPU, 6 GB allocated VRAM), Adrenalin 26.10.1 (LLPC).
  • Market (save market-entrance): walked straight forward ~5 s (0:LUP/5000) to the central fountain before panning, 1600x1000 windowed @ 120 Hz, FSR 3.1 (dlss=3), resolution=0 (Auto), preset=0 (Custom), RX_VK_PRECOMPILE=1:
    • 2x FSR 3.1 FG Uncapped (frame_rate_cap=6, frame_generation=2): 3 interleaved rounds. DRS stepped 67% -> 58% -> 50% smoothly; native FPS lifted from 30.79 to 37.83 (+22.9%), 1% low lifted from 26.58 to 31.54 (+18.7%), GPU time dropped from 29.1 ms to 23.3 ms (-19.9%), and display latency dropped from 37.1 ms to 29.5 ms (-20.5%).
    • FG Off 60 FPS Cap (frame_rate_cap=0, frame_generation=0): 3 interleaved rounds. DRS stepped 67% -> 58% -> 50%; native FPS lifted from 38.66 to 44.15 (+14.2%), 1% low lifted from 33.66 to 37.11 (+10.2%), and GPU time dropped from 20.0 ms to 16.8 ms (-16.0%).
  • Hyrule Field (save castle-gate): 1600x1000 windowed @ 120 Hz, FSR 3.1, resolution=0 (Auto), 2x FSR 3.1 FG Uncapped:
    • 3 interleaved rounds. DRS stepped 67% -> 58% -> 50%; native FPS lifted from 30.66 to 34.74 (+13.3%), 1% low lifted from 25.39 to 28.51 (+12.3%), and GPU time dropped from 29.7 ms to 25.0 ms (-15.8%).
  • FSR 3.1 FG 2x Mid-Play Resize Spike: stepped 50% -> 67% -> 100% -> 67% -> 50% via longshot_ctl.py. On the largest step (67% -> 100%), spike dropped from +83.5 ms down to +59.7 ms (-28.6% spike, -25.1 ms peak frame time), confirming decoupled display and optical-flow resources.
  • Bypass & Fixed Baseline Checks: verified RX_VK_DRS=0 triggers 0 DRS transitions and matches main performance; verified fixed 67% render scale (resolution=3) shows zero regression.
  • Unit & System Tests: verified 27/27 --strict targeted tests PASS. Verified full tests/run_all.py on Windows (888 passed, 29 pre-existing baseline failures that also fail on clean main — test_auto_handheld, test_pads_after_menu, test_build_long_paths, test_dev_*, test_linux_preflight, test_perf_report, test_crash_dialog, etc. — 60 skipped in 374 s), with 0 regressions. Cleanly rebased onto current forge/main (79d192c6, head 62aad09e).

How to test:

  1. On a GPU-limited system, set Upscaler = AMD FSR 3.1, Render resolution = Auto (resolution=0), Quality preset = Custom, and Frame generation = 2x (FSR 3.1 FG) or Off (60 FPS cap).
  2. Load market-entrance, walk straight forward ~5 s (0:LUP/5000) to the central fountain before panning (and test castle-gate in Hyrule Field). Watch longshot_log.txt for smooth vk: drs: 67% -> 58% -> 50% transitions with zero seesaw, and confirm vk: fsr3fi: render inputs ... (keeping ... display & optical-flow images) on mid-play resolution steps.
  3. Repeat with RX_VK_DRS=0 to confirm 0 vk: drs: transitions and exact main behavior.

Still to test:

  • Linux AMD RADV / Steam Deck: verify DRS step-down and FSR 3.1 FG 2x pacing in an active game session (@Beanstalk Please test DRS and FSR3 FI on Linux AMD RADV and Steam Deck)
  • Windows NVIDIA RTX 40/50: verify DLSS / DLSS-G headroom target and zero throttling on high-headroom hardware (@Beanstalk Please test DRS with DLSS on RTX 40/50)
  • Windows unlocked desktop: interactive live menu resolution switching alongside DRS by hand

Measurements

Verdict: Cuts GPU time by 15.8–19.9% (-4.7 to 5.8 ms), lifts native FPS by +13.3% to +22.9% (+10.2% to +18.7% 1% low), and cuts FSR 3.1 FI resize spikes by -28.6% (-25.1 ms) on GPU-limited hardware.

Setup: Windows 11 (build 26200), AMD Ryzen AI 7 350, AMD Radeon 860M (6 GB VRAM), Adrenalin 26.10.1 (LLPC); 1600x1000 windowed @ 120 Hz, AMD FSR 3.1 (dlss=3), RX_VK_PRECOMPILE=1, clean warm cache reset per trial, 3 interleaved rounds per scenario (>= 12.5 s post-load settle). Measured on forge/main @ 958b71f9 vs 1b6e234c; cleanly rebased onto current forge/main @ 79d192c6 (head 62aad09e), where none of the intervening commits touch drs.h, vk_fsr3fi.cpp, or vk_menu.cpp, so the standalone measurements hold unchanged.

Where it makes a difference

Metric Before: main @ 958b71f9 After: this PR @ 1b6e234c Delta
(A) Market, 2x FSR 3.1 FG, Uncapped (cap=6, 1600x1000 @ 120 Hz, Auto resolution):
Native FPS 30.79 37.83 +22.9%
Native 1% low FPS 26.58 31.54 +18.7%
GPU time per frame 29.1 ms 23.3 ms -19.9% (-5.8 ms)
Display latency 37.1 ms 29.5 ms -20.5% (-7.6 ms)
Presentations on time (per 5 s) 287 348 +21.3%
(B) Hyrule Field, 2x FSR 3.1 FG, Uncapped (cap=6, 1600x1000 @ 120 Hz, Auto resolution):
Native FPS 30.66 34.74 +13.3%
Native 1% low FPS 25.39 28.51 +12.3%
GPU time per frame 29.7 ms 25.0 ms -15.8% (-4.7 ms)
Display latency 37.4 ms 31.1 ms -16.8% (-6.3 ms)
Presentations on time (per 5 s) 278 327 +17.6%
(C) Market, FG Off, 60 FPS Cap (cap=0, 1600x1000 @ 120 Hz, Auto resolution):
Native FPS 38.66 44.15 +14.2%
Native 1% low FPS 33.66 37.11 +10.2%
GPU time per frame 20.0 ms 16.8 ms -16.0% (-3.2 ms)
(D) FSR 3.1 FG 2x Mid-Play Resize (67% render scale -> 100% render scale, Market):
Peak frame time 126.27 ms 101.13 ms -19.9% (-25.1 ms)
Frame spike delta above median +83.53 ms +59.68 ms -28.6% (-23.9 ms)

Where it does NOT make a difference (within run-to-run variance)

Metric Before: main @ 958b71f9 After: this PR @ 1b6e234c Delta
(E) Switch Bypass Parity: Market Uncapped, RX_VK_DRS=0, 2x FG, Auto resolution:
Native FPS 30.79 28.50 -7.4% (1-run variance, 0 DRS transitions)
GPU time per frame 29.1 ms 30.7 ms +5.5% (1-run variance, 0 DRS transitions)
(F) Fixed 67% render scale: Market Uncapped, FG Off (resolution=3):
Native FPS 40.85 38.38 -6.0% (1-run variance, 0 DRS transitions)
Native 1% low FPS 32.94 32.63 -0.9% (flat)
GPU time per frame 18.8 ms 20.2 ms +7.4% (1-run variance)

Raw log excerpts:

main (958b71f9) Market 2x FSR 3.1 FG Uncapped:

[hos host] vk: GPU time 29.1 ms a frame (the longest submission 7.6 ms); 0.0 textures made a frame
[hos host] vk: fsr3fi: of the last 600 presents 600 made by FSR 3.1, 0 without its inputs; 600 frames with the chain's motion; inputs this frame's 0, the frame before's 600; 600 with the HUD marked, 600 with its HUD layer
[hos host] vk: frame interpolation: 287 frames shown on time, 22 late (over 2 ms); the game's frames presented 37.1 ms after the game handed them over

this PR (1b6e234c) Market 2x FSR 3.1 FG Uncapped:

[hos host] vk: drs: 67% -> 58% (gpu 28.8 ms / budget 16.7 ms, native 26.2 fps)
[hos host] vk: drs: 58% -> 50% (gpu 27.0 ms / budget 16.7 ms, native 29.8 fps)
[hos host] vk: GPU time 23.3 ms a frame (the longest submission 6.8 ms); 0.0 textures made a frame
[hos host] vk: fsr3fi: of the last 600 presents 600 made by FSR 3.1, 0 without its inputs; 600 frames with the chain's motion; inputs this frame's 0, the frame before's 600; 600 with the HUD marked, 600 with its HUD layer
[hos host] vk: frame interpolation: 348 frames shown on time, 20 late (over 2 ms); the game's frames presented 29.5 ms after the game handed them over

this PR (1b6e234c) Mid-Play FSR 3.1 FG 2x Resize:

[hos host] vk: fsr3fi: render inputs 800x500 (keeping 1600x1000 display & optical-flow images)

Risks

  • Settings and compatibility: Zero longshot_options.ini schema churn: opts.resolution == 0 (Auto) is preserved and the active (upscaler, effective_resolution_id) pair is published in a synchronized runtime atomic (drs_snapshot), ensuring existing player configuration files remain 100% compatible.
  • Fallbacks and switches: Setting RX_VK_DRS=0 completely disables the dynamic resolution controller, bypassing the tick loop and restoring exact main behavior.
  • Caches and ABI: Zero SPIR-V or shader translation changes (the shader stamp is untouched). MKWVK_API_VERSION = 45 unchanged.
  • Sibling branches: Zero overlap with PR #2369 (vk_framegen.cpp). Only 2 trivial contextual lines with PR #2383 (docs/user/graphics-and-controls.md and gpu/vk/vk_menu.cpp:1288), which rebase cleanly on adjacent lines.

Checklist

Ready for review

  • One topic, on current main; the title is a Conventional Commit.
  • Tested on my own PC, in the game for a change the game runs, as Testing says.
  • mise run test passes (any failure that also fails on main is named).
  • Measured against main, or Measurements says why there is nothing to measure.
  • No game files, build output or hand-edited generated files; third_party/ untouched; nothing GPL-incompatible.

When it applies

  • A fix: a game-free test that fails on main and passes here.
  • A switch added or changed: it ships at the default the measurements chose, with its row in gpu/vk/switches.def.
  • A check under tests/ that reads changed source is updated, not weakened.
  • Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths.
  • Docs updated.
  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.

Ready to merge

  • Everything in Still to test has run, its results in Tested.
  • Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers").
  • Approved in review, every comment answered.
  • CI passes on the head; on current main, measured again or a comment says why the numbers still hold.
## Summary When `Render resolution` was set to `Auto` (`opts.resolution = 0`), `menu_auto_tune()` exited early and the renderer relied solely on the game's own internal dynamic resolution (tuned for Switch 2 hardware, not PC upscaler or frame-generation budgets). In GPU-heavy scenes like Market and Hyrule Field on an integrated GPU, the game remained at 75% (`1200x750`) even when AMD FSR 3.1 + 2x Frame Generation drove GPU time to 29–30 ms per frame (~30 FPS native, 1% lows below 26 FPS). Furthermore, when render resolution changed mid-play while AMD FSR 3.1 Frame Generation was active, `gpu/vk/vk_fsr3fi.cpp` tore down and reallocated all ~30+ internal resources—including ~25 display-sized optical-flow, luminance, and `made[]` images that depend solely on display dimensions—triggering frame spikes of +83.5 ms (126.3 ms peak). This pull request introduces continuous, framegen-aware host Dynamic Resolution Scaling (DRS) and decouples render-sized scratch images from display-sized resources in `vk_fsr3fi.cpp`: 1. **Continuous Framegen-Aware DRS Controller (`gpu/vk/drs.h`, `gpu/vk/switches.def: RX_VK_DRS`)**: Evaluates native frame time, total GPU time (including upscaler and FG passes), and scene draw counts over rolling ~1-second presentation windows. When GPU utilization is heavy (GPU time > 92% of budget and native FPS < 90% of target for 3 consecutive windows), the controller smoothly steps down 1 quality stop across the active upscaler's defined scale stops (clamped to a 50% floor). A CPU-bound guard prevents downscaling when GPU utilization is low (< 75%), preserving sharpness in draw-call-heavy scenes. Recovery back up requires 10 windows of post-step-down cooldown and 10 windows of clear GPU headroom (< 68% budget and projected headroom at the next stop, allowing CPU-bound iGPUs starting at 67% to recover upward), with exponential cooldown backoff (10 -> 20 -> 40 windows) preventing seesawing. 2. **Decoupled FSR 3.1 Frame Generation Resources (`gpu/vk/vk_fsr3fi.cpp`)**: Separates internal resources into 25 display-sized images (`of_luma`, `of_flow`, `of_vector`, `of_confidence`, `of_scd_*`, `fi_inpainting_pyramid`, `fi_previous_source`, `fi_distortion_field`, and `made[]`) and 9 render-sized per-frame scratch images (`fi_dilated_depth`, `fi_dilated_motion_vectors`, `fi_reconstructed_depth_*`, `fi_game_mv_*`, `fi_of_mv_*`, `fi_disocclusion_mask`). When render resolution changes mid-play, only the 9 render-sized scratch images are reallocated; all 25 display-sized images and optical-flow allocations are preserved (while `vk_fsr3_inputs.cpp` still cleanly signals a 1-frame reset). 3. **Compatibility & Non-Destructive Storage**: Active only when `RX_VK_DRS=1` and `opts.resolution == 0`. Operates across all upscalers (FSR 3.1, DLSS, FSR 4, XeSS, Game's own) and presets without mutating saved `opts.resolution` (0) in `longshot_options.ini`. Setting `RX_VK_DRS=0` completely disables the controller and restores exact previous behavior. **What a player notices:** - With `Render resolution` set to `Auto`, gameplay in demanding scenes stays smooth and responsive: native frame rates increase by +13% to +23% (+10% to +19% 1% lows) and GPU frame times drop by 4.7–5.8 ms (-16% to -20%). - Alongside FSR 3.1 Frame Generation 2x, display latency drops by ~17% to ~21% (from 37 ms down to 29–31 ms) with a +18% to +21% increase in on-time presentations and zero resolution oscillation. - Dynamic resolution transitions during active Frame Generation feel significantly smoother, cutting mid-play resize spikes by 28.6% (-25.1 ms peak). **Helps:** - Players on integrated GPUs (AMD Radeon 780M/860M/880M/890M, Intel Arc Xe/Xe2) or power-constrained laptops running with `Render resolution = Auto`. - Players using Frame Generation alongside dynamic resolution. **No measurable impact:** - Players using fixed render resolutions (`opts.resolution != 0`, e.g. Quality 67% or Native 100%). - High-headroom discrete GPUs (where GPU time stays below the 92% budget threshold). - When disabled via `RX_VK_DRS=0`. Files to read first: - `gpu/vk/drs.h`: the `mkwvk::drs::State` / `drs::update()` state machine, budget calculation, and hysteresis logic. - `gpu/vk/vk_fsr3fi.cpp`: split allocation of `display_images()` vs `render_images()`. - `gpu/vk/vk_replay.cpp`: integration with `log_frame_stats()`. - `gpu/vk/vk_menu.cpp`: `menu_drs_tick()`, `menu_drs_enabled()`, and atomic scale propagation. - `tests/test_drs.py`: deterministic unit tests covering step-down, hysteresis, FIFO+FG budgets, and FSR3 FI resource decoupling. ## Testing **Tested:** - Windows 11 (build 26200), AMD Ryzen AI 7 350, AMD Radeon 860M Graphics (8 CUs, RDNA 3.5 integrated GPU, 6 GB allocated VRAM), Adrenalin 26.10.1 (LLPC). - **Market (save `market-entrance`)**: walked straight forward ~5 s (`0:LUP/5000`) to the central fountain before panning, 1600x1000 windowed @ 120 Hz, FSR 3.1 (`dlss=3`), `resolution=0` (Auto), `preset=0` (Custom), `RX_VK_PRECOMPILE=1`: - 2x FSR 3.1 FG Uncapped (`frame_rate_cap=6`, `frame_generation=2`): 3 interleaved rounds. DRS stepped 67% -> 58% -> 50% smoothly; native FPS lifted from 30.79 to 37.83 (+22.9%), 1% low lifted from 26.58 to 31.54 (+18.7%), GPU time dropped from 29.1 ms to 23.3 ms (-19.9%), and display latency dropped from 37.1 ms to 29.5 ms (-20.5%). - FG Off 60 FPS Cap (`frame_rate_cap=0`, `frame_generation=0`): 3 interleaved rounds. DRS stepped 67% -> 58% -> 50%; native FPS lifted from 38.66 to 44.15 (+14.2%), 1% low lifted from 33.66 to 37.11 (+10.2%), and GPU time dropped from 20.0 ms to 16.8 ms (-16.0%). - **Hyrule Field (save `castle-gate`)**: 1600x1000 windowed @ 120 Hz, FSR 3.1, `resolution=0` (Auto), 2x FSR 3.1 FG Uncapped: - 3 interleaved rounds. DRS stepped 67% -> 58% -> 50%; native FPS lifted from 30.66 to 34.74 (+13.3%), 1% low lifted from 25.39 to 28.51 (+12.3%), and GPU time dropped from 29.7 ms to 25.0 ms (-15.8%). - **FSR 3.1 FG 2x Mid-Play Resize Spike**: stepped `50% -> 67% -> 100% -> 67% -> 50%` via `longshot_ctl.py`. On the largest step (`67% -> 100%`), spike dropped from +83.5 ms down to +59.7 ms (-28.6% spike, -25.1 ms peak frame time), confirming decoupled display and optical-flow resources. - **Bypass & Fixed Baseline Checks**: verified `RX_VK_DRS=0` triggers 0 DRS transitions and matches `main` performance; verified fixed 67% render scale (`resolution=3`) shows zero regression. - **Unit & System Tests**: verified `27/27` `--strict` targeted tests PASS. Verified full `tests/run_all.py` on Windows (888 passed, 29 pre-existing baseline failures that also fail on clean `main` — `test_auto_handheld`, `test_pads_after_menu`, `test_build_long_paths`, `test_dev_*`, `test_linux_preflight`, `test_perf_report`, `test_crash_dialog`, etc. — 60 skipped in 374 s), with 0 regressions. Cleanly rebased onto current `forge/main` (`79d192c6`, head `62aad09e`). **How to test:** 1. On a GPU-limited system, set `Upscaler = AMD FSR 3.1`, `Render resolution = Auto` (`resolution=0`), `Quality preset = Custom`, and `Frame generation = 2x` (`FSR 3.1 FG`) or `Off` (`60 FPS` cap). 2. Load `market-entrance`, walk straight forward ~5 s (`0:LUP/5000`) to the central fountain before panning (and test `castle-gate` in Hyrule Field). Watch `longshot_log.txt` for smooth `vk: drs: 67% -> 58% -> 50%` transitions with zero seesaw, and confirm `vk: fsr3fi: render inputs ... (keeping ... display & optical-flow images)` on mid-play resolution steps. 3. Repeat with `RX_VK_DRS=0` to confirm `0` `vk: drs:` transitions and exact `main` behavior. **Still to test:** - Linux AMD RADV / Steam Deck: verify DRS step-down and FSR 3.1 FG 2x pacing in an active game session (@Beanstalk Please test DRS and FSR3 FI on Linux AMD RADV and Steam Deck) - Windows NVIDIA RTX 40/50: verify DLSS / DLSS-G headroom target and zero throttling on high-headroom hardware (@Beanstalk Please test DRS with DLSS on RTX 40/50) - Windows unlocked desktop: interactive live menu resolution switching alongside DRS by hand ## Measurements **Verdict:** Cuts GPU time by 15.8–19.9% (-4.7 to 5.8 ms), lifts native FPS by +13.3% to +22.9% (+10.2% to +18.7% 1% low), and cuts FSR 3.1 FI resize spikes by -28.6% (-25.1 ms) on GPU-limited hardware. Setup: Windows 11 (build 26200), AMD Ryzen AI 7 350, AMD Radeon 860M (6 GB VRAM), Adrenalin 26.10.1 (LLPC); 1600x1000 windowed @ 120 Hz, AMD FSR 3.1 (`dlss=3`), `RX_VK_PRECOMPILE=1`, clean warm cache reset per trial, 3 interleaved rounds per scenario (`>= 12.5 s` post-load settle). Measured on `forge/main @ 958b71f9` vs `1b6e234c`; cleanly rebased onto current `forge/main @ 79d192c6` (head `62aad09e`), where none of the intervening commits touch `drs.h`, `vk_fsr3fi.cpp`, or `vk_menu.cpp`, so the standalone measurements hold unchanged. #### Where it makes a difference | Metric | Before: main @ 958b71f9 | After: this PR @ 1b6e234c | Delta | |---|---:|---:|---:| | **(A) Market, 2x FSR 3.1 FG, Uncapped (`cap=6`, `1600x1000 @ 120 Hz`, Auto resolution):** | | | | | Native FPS | 30.79 | 37.83 | +22.9% | | Native 1% low FPS | 26.58 | 31.54 | +18.7% | | GPU time per frame | 29.1 ms | 23.3 ms | -19.9% (-5.8 ms) | | Display latency | 37.1 ms | 29.5 ms | -20.5% (-7.6 ms) | | Presentations on time (per 5 s) | 287 | 348 | +21.3% | | **(B) Hyrule Field, 2x FSR 3.1 FG, Uncapped (`cap=6`, `1600x1000 @ 120 Hz`, Auto resolution):** | | | | | Native FPS | 30.66 | 34.74 | +13.3% | | Native 1% low FPS | 25.39 | 28.51 | +12.3% | | GPU time per frame | 29.7 ms | 25.0 ms | -15.8% (-4.7 ms) | | Display latency | 37.4 ms | 31.1 ms | -16.8% (-6.3 ms) | | Presentations on time (per 5 s) | 278 | 327 | +17.6% | | **(C) Market, FG Off, 60 FPS Cap (`cap=0`, `1600x1000 @ 120 Hz`, Auto resolution):** | | | | | Native FPS | 38.66 | 44.15 | +14.2% | | Native 1% low FPS | 33.66 | 37.11 | +10.2% | | GPU time per frame | 20.0 ms | 16.8 ms | -16.0% (-3.2 ms) | | **(D) FSR 3.1 FG 2x Mid-Play Resize (`67% render scale -> 100% render scale`, Market):** | | | | | Peak frame time | 126.27 ms | 101.13 ms | -19.9% (-25.1 ms) | | Frame spike delta above median | +83.53 ms | +59.68 ms | -28.6% (-23.9 ms) | #### Where it does NOT make a difference (within run-to-run variance) | Metric | Before: main @ 958b71f9 | After: this PR @ 1b6e234c | Delta | |---|---:|---:|---:| | **(E) Switch Bypass Parity: Market Uncapped, `RX_VK_DRS=0`, 2x FG, Auto resolution:** | | | | | Native FPS | 30.79 | 28.50 | -7.4% (1-run variance, 0 DRS transitions) | | GPU time per frame | 29.1 ms | 30.7 ms | +5.5% (1-run variance, 0 DRS transitions) | | **(F) Fixed 67% render scale: Market Uncapped, FG Off (`resolution=3`):** | | | | | Native FPS | 40.85 | 38.38 | -6.0% (1-run variance, 0 DRS transitions) | | Native 1% low FPS | 32.94 | 32.63 | -0.9% (flat) | | GPU time per frame | 18.8 ms | 20.2 ms | +7.4% (1-run variance) | Raw log excerpts: `main` (`958b71f9`) Market 2x FSR 3.1 FG Uncapped: ``` [hos host] vk: GPU time 29.1 ms a frame (the longest submission 7.6 ms); 0.0 textures made a frame [hos host] vk: fsr3fi: of the last 600 presents 600 made by FSR 3.1, 0 without its inputs; 600 frames with the chain's motion; inputs this frame's 0, the frame before's 600; 600 with the HUD marked, 600 with its HUD layer [hos host] vk: frame interpolation: 287 frames shown on time, 22 late (over 2 ms); the game's frames presented 37.1 ms after the game handed them over ``` `this PR` (`1b6e234c`) Market 2x FSR 3.1 FG Uncapped: ``` [hos host] vk: drs: 67% -> 58% (gpu 28.8 ms / budget 16.7 ms, native 26.2 fps) [hos host] vk: drs: 58% -> 50% (gpu 27.0 ms / budget 16.7 ms, native 29.8 fps) [hos host] vk: GPU time 23.3 ms a frame (the longest submission 6.8 ms); 0.0 textures made a frame [hos host] vk: fsr3fi: of the last 600 presents 600 made by FSR 3.1, 0 without its inputs; 600 frames with the chain's motion; inputs this frame's 0, the frame before's 600; 600 with the HUD marked, 600 with its HUD layer [hos host] vk: frame interpolation: 348 frames shown on time, 20 late (over 2 ms); the game's frames presented 29.5 ms after the game handed them over ``` `this PR` (`1b6e234c`) Mid-Play FSR 3.1 FG 2x Resize: ``` [hos host] vk: fsr3fi: render inputs 800x500 (keeping 1600x1000 display & optical-flow images) ``` ## Risks - **Settings and compatibility:** Zero `longshot_options.ini` schema churn: `opts.resolution == 0` (Auto) is preserved and the active `(upscaler, effective_resolution_id)` pair is published in a synchronized runtime atomic (`drs_snapshot`), ensuring existing player configuration files remain 100% compatible. - **Fallbacks and switches:** Setting `RX_VK_DRS=0` completely disables the dynamic resolution controller, bypassing the tick loop and restoring exact `main` behavior. - **Caches and ABI:** Zero SPIR-V or shader translation changes (the shader stamp is untouched). `MKWVK_API_VERSION = 45` unchanged. - **Sibling branches:** Zero overlap with PR #2369 (`vk_framegen.cpp`). Only 2 trivial contextual lines with PR #2383 (`docs/user/graphics-and-controls.md` and `gpu/vk/vk_menu.cpp:1288`), which rebase cleanly on adjacent lines. ## Checklist ### Ready for review - [x] One topic, on current `main`; the title is a Conventional Commit. - [x] Tested on my own PC, in the game for a change the game runs, as Testing says. - [x] `mise run test` passes (any failure that also fails on `main` is named). - [x] Measured against `main`, or Measurements says why there is nothing to measure. - [x] No game files, build output or hand-edited generated files; `third_party/` untouched; nothing GPL-incompatible. ### When it applies - [x] A fix: a game-free test that fails on `main` and passes here. - [x] A switch added or changed: it ships at the default the measurements chose, with its row in `gpu/vk/switches.def`. - [x] A check under `tests/` that reads changed source is updated, not weakened. - [x] Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths. - [x] Docs updated. - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. ### Ready to merge - [ ] Everything in Still to test has run, its results in Tested. - [ ] Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers"). - [ ] Approved in review, every comment answered. - [ ] CI passes on the head; on current `main`, measured again or a comment says why the numbers still hold.
Assisted-by: Antigravity
feat(vk): add framegen-aware host DRS and decouple FSR3 FI render-sized images
Some checks failed
Website / Website on Cloudflare (pull_request_target) Has been skipped
beanstalk/approval can't be tested as asked: see the farm's comment
PR description / Description follows the template (pull_request_target) Successful in 6s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
62aad09e46
Assisted-by: Antigravity
Author
Contributor

Tested in game: Windows 11 Radeon 860M (1600x1000 @ 120 Hz, AMD FSR 3.1, RX_VK_PRECOMPILE=1): 3-round interleaved Market/Hyrule Auto-res + 2x FSR 3.1 FG & Market 60 FPS cap FG Off A/Bs + mid-play FSR3 FI resize spike check + RX_VK_DRS=0 bypass + fixed 67% no-regression check

Tested in game: Windows 11 Radeon 860M (1600x1000 @ 120 Hz, AMD FSR 3.1, RX_VK_PRECOMPILE=1): 3-round interleaved Market/Hyrule Auto-res + 2x FSR 3.1 FG & Market 60 FPS cap FG Off A/Bs + mid-play FSR3 FI resize spike check + RX_VK_DRS=0 bypass + fixed 67% no-regression check
Author
Contributor

@Beanstalk Please test Render resolution: Auto with Frame generation 2x and Off on Linux AMD RADV, Steam Deck, and Windows NVIDIA RTX 40/50 (DLSS / DLSS-G) to confirm smooth DRS step-down on GPU-limited hardware, zero throttling on high-headroom GPUs, and clean FSR 3.1 FI mid-play resizes.

@Beanstalk Please test Render resolution: Auto with Frame generation 2x and Off on Linux AMD RADV, Steam Deck, and Windows NVIDIA RTX 40/50 (DLSS / DLSS-G) to confirm smooth DRS step-down on GPU-limited hardware, zero throttling on high-headroom GPUs, and clean FSR 3.1 FI mid-play resizes.
Member

@Jer9 only members of BigBeans can start the farm. One of them can approve this request by reacting 👍 to it or to this comment.

@Jer9 only members of `BigBeans` can start the farm. One of them can approve this request by reacting 👍 to it or to this comment.
Owner
@review
Member

Beanstalk test farm

Commit ccf3e1c · approved by nobody yet · dashboard

A member of BigBeans can review this commit and comment @Beanstalk to test it.

<!-- beanstalk:sticky --> ### Beanstalk test farm Commit `ccf3e1c` · approved by nobody yet · [dashboard](https://beanstalk.magicbean.dev/prs/2400) A member of `BigBeans` can review this commit and comment `@Beanstalk` to test it.
BeanBot left a comment

Recommendation: Request changes. Auto resolution can permanently reduce image quality on CPU-bound integrated GPUs, and the controller uses the wrong target for high frame-rate caps. Its new cross-thread option reads also need synchronization.

The change adds host-controlled dynamic resolution and retains display-sized FSR 3.1 frame-generation resources during render-size changes. It can improve frame rate and resize spikes on the tested Radeon 860M, at the cost of lower render resolution and additional controller and resource-lifetime complexity.

Blocking (3): must change before merging.

  1. L1 gpu/vk/drs.h:122: Auto starts every integrated GPU at 67% before establishing that it needs a reduction, and a CPU-bound scene may never recover that quality. (more on the line) Do: Start from the existing Auto scale, or allow recovery when GPU headroom is sufficient even if the CPU cannot reach the target; add a CPU-bound recovery test.
  2. L2 gpu/vk/drs.h:141: The target calculation discards frame-rate caps above 60 and clamps to display refresh even when V-Sync is off. (more on the line) Do: Use the actual selected cap and apply the display ceiling only when the active presentation mode imposes it; cover high caps and V-Sync-off refresh rates in the controller tests.
  3. L3 gpu/vk/vk_menu.cpp:4442: The atomic runtime stop does not protect the saved resolution and upscaler values read alongside it from another thread. (more on the line) Do: Publish the saved resolution, upscaler and effective stop as a synchronized snapshot, or protect all of these reads and writes with the same lock.

Testing before merging (1) (runs on the systems it can change; it doesn't hold the recommendation)

  • L4: The default-on controller and retained frame-generation resources have not been exercised on the other affected Tier 1 systems. When: Auto resolution and FSR 3.1 resize handling also run on Linux RADV and Steam Deck, and the controller drives DLSS/DLSS-G on NVIDIA; the supplied runs cover only Windows Radeon 860M. Do: Run the requested Linux RADV/Steam Deck and Windows NVIDIA scenarios, including a live resolution change and frame pacing, and record the results. (@fix does its part first: Default RX_VK_DRS off until the affected paths have been validated.)

@fix can do L1, L2, L3 and L4.

Questions (1) (not confirmed from the code; they don't hold the recommendation)

  • Were the measurements repeated on the merge base and current head, and if so, what were the results?

Checks: Still running: 10 checks.

More: does it help, other systems, switches, what was read

Does it help: Unproven on the requested base and head. Three interleaved runs on an earlier base and PR commit reported 13.3–22.9% higher native FPS and 10.2–18.7% higher 1% lows in GPU-limited scenes, plus a 25.1 ms lower resize peak. The current head was not measured against its merge base, and the visual-quality cost was not shown.

Other systems: The controller affects Auto resolution with every upscaler on Windows and Linux; the FSR 3.1 resource change also affects fixed-resolution users who resize during frame generation. The reported game runs cover Windows Radeon 860M only. Linux RADV and Steam Deck, NVIDIA DLSS/DLSS-G, other upscalers, and live menu switching remain unverified.

Switches: RX_VK_DRS is added, default on; 0 restores the prior Auto controller, while a nonempty HOS_RES_SCALE also disables host DRS. The default is not yet appropriate for all users because it can lower quality even when the GPU has headroom. The switch table and user documentation are updated.

Reviewed: 62aad09e46 against 79d192c655: Read the requested repository rules, PR template, standards, commit trailers, changed controller, integration and FSR resource changes, the new test harness, and surrounding callers and state. Reviewed the remaining changed test stubs and documentation diff. The large renderer files and existing test files were read around the affected paths rather than in full; recorded runs were reviewed from the PR description and comments. docs/review-checklist.md and ../Tooling/AGENTS.md were absent.; nothing run (a code review).

Checked and fine:

  • Both commits include Assisted-by trailers.
  • The FSR resize path retires replaced images against the GPU timeline, and the input path signals a history reset when render dimensions change.
  • The added switch has a row in switches.def, and the saved Auto value is not overwritten by the controller.
  • No game-derived files or generated artifacts appear in the changed-file list.

Testing: No code, scripts, builds or tests were run, as requested. The author reports Windows game runs and targeted and full test runs; the listed CI checks are still running.

Overlaps and merge order: The description reports no overlap with #2369 and contextual overlap with #2383; independent Forgejo verification was unavailable.


Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.

**Recommendation: Request changes.** Auto resolution can permanently reduce image quality on CPU-bound integrated GPUs, and the controller uses the wrong target for high frame-rate caps. Its new cross-thread option reads also need synchronization. The change adds host-controlled dynamic resolution and retains display-sized FSR 3.1 frame-generation resources during render-size changes. It can improve frame rate and resize spikes on the tested Radeon 860M, at the cost of lower render resolution and additional controller and resource-lifetime complexity. **Blocking (3)**: must change before merging. 1. **L1** `gpu/vk/drs.h:122`: Auto starts every integrated GPU at 67% before establishing that it needs a reduction, and a CPU-bound scene may never recover that quality. (more on the line) **Do:** Start from the existing Auto scale, or allow recovery when GPU headroom is sufficient even if the CPU cannot reach the target; add a CPU-bound recovery test. 2. **L2** `gpu/vk/drs.h:141`: The target calculation discards frame-rate caps above 60 and clamps to display refresh even when V-Sync is off. (more on the line) **Do:** Use the actual selected cap and apply the display ceiling only when the active presentation mode imposes it; cover high caps and V-Sync-off refresh rates in the controller tests. 3. **L3** `gpu/vk/vk_menu.cpp:4442`: The atomic runtime stop does not protect the saved resolution and upscaler values read alongside it from another thread. (more on the line) **Do:** Publish the saved resolution, upscaler and effective stop as a synchronized snapshot, or protect all of these reads and writes with the same lock. **Testing before merging (1)** (runs on the systems it can change; it doesn't hold the recommendation) - **L4**: The default-on controller and retained frame-generation resources have not been exercised on the other affected Tier 1 systems. *When:* Auto resolution and FSR 3.1 resize handling also run on Linux RADV and Steam Deck, and the controller drives DLSS/DLSS-G on NVIDIA; the supplied runs cover only Windows Radeon 860M. **Do:** Run the requested Linux RADV/Steam Deck and Windows NVIDIA scenarios, including a live resolution change and frame pacing, and record the results. *(`@fix` does its part first: Default RX_VK_DRS off until the affected paths have been validated.)* `@fix` can do L1, L2, L3 and L4. **Questions (1)** (not confirmed from the code; they don't hold the recommendation) - Were the measurements repeated on the merge base and current head, and if so, what were the results? **Checks:** Still running: 10 checks. <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Unproven on the requested base and head. Three interleaved runs on an earlier base and PR commit reported 13.3–22.9% higher native FPS and 10.2–18.7% higher 1% lows in GPU-limited scenes, plus a 25.1 ms lower resize peak. The current head was not measured against its merge base, and the visual-quality cost was not shown. **Other systems:** The controller affects Auto resolution with every upscaler on Windows and Linux; the FSR 3.1 resource change also affects fixed-resolution users who resize during frame generation. The reported game runs cover Windows Radeon 860M only. Linux RADV and Steam Deck, NVIDIA DLSS/DLSS-G, other upscalers, and live menu switching remain unverified. **Switches:** RX_VK_DRS is added, default on; 0 restores the prior Auto controller, while a nonempty HOS_RES_SCALE also disables host DRS. The default is not yet appropriate for all users because it can lower quality even when the GPU has headroom. The switch table and user documentation are updated. **Reviewed:** 62aad09e4666 against 79d192c655b5: Read the requested repository rules, PR template, standards, commit trailers, changed controller, integration and FSR resource changes, the new test harness, and surrounding callers and state. Reviewed the remaining changed test stubs and documentation diff. The large renderer files and existing test files were read around the affected paths rather than in full; recorded runs were reviewed from the PR description and comments. docs/review-checklist.md and ../Tooling/AGENTS.md were absent.; nothing run (a code review). **Checked and fine:** - Both commits include Assisted-by trailers. - The FSR resize path retires replaced images against the GPU timeline, and the input path signals a history reset when render dimensions change. - The added switch has a row in switches.def, and the saved Auto value is not overwritten by the controller. - No game-derived files or generated artifacts appear in the changed-file list. **Testing:** No code, scripts, builds or tests were run, as requested. The author reports Windows game runs and targeted and full test runs; the listed CI checks are still running. **Overlaps and merge order:** The description reports no overlap with #2369 and contextual overlap with #2383; independent Forgejo verification was unavailable. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.</sub>
gpu/vk/drs.h Outdated
@ -0,0 +119,4 @@
/// Starting DRS stop for `upscaler`: 67% on integrated GPUs (smooth out of the box), top stop on discrete GPUs
/// (100% for Game's own / FSR 3.1 / Off, 92% for DLSS / FSR 4 / XeSS).
inline int initial_stop(int upscaler, bool integrated_gpu) {
namespace ur = upscaler_rows;
Member

L1 (blocking): Auto starts every integrated GPU at 67% before establishing that it needs a reduction, and a CPU-bound scene may never recover that quality.

When: With Auto and an integrated GPU, a scene rendering at 50 FPS with 8 ms GPU time starts at 67%. The GPU has ample headroom, but step-up requires at least 57 FPS, so CPU-limited play stays at 67% indefinitely even where the previous game's dynamic resolution would render at 75%.

Do: Start from the existing Auto scale, or allow recovery when GPU headroom is sufficient even if the CPU cannot reach the target; add a CPU-bound recovery test.

**L1** (blocking): Auto starts every integrated GPU at 67% before establishing that it needs a reduction, and a CPU-bound scene may never recover that quality. *When:* With Auto and an integrated GPU, a scene rendering at 50 FPS with 8 ms GPU time starts at 67%. The GPU has ample headroom, but step-up requires at least 57 FPS, so CPU-limited play stays at 67% indefinitely even where the previous game's dynamic resolution would render at 75%. **Do:** Start from the existing Auto scale, or allow recovery when GPU headroom is sufficient even if the CPU cannot reach the target; add a CPU-bound recovery test.
gpu/vk/drs.h Outdated
@ -0,0 +138,4 @@
/// 60 Hz display), FIFO caps native output to display_hz / fg_fixed_mult (30 FPS on 60 Hz @ 2x), so the native budget
/// follows that physical ceiling instead of falsely treating 30 FPS as overload.
inline float target_fps(int cap_fps, int display_hz, bool framegen_active,
bool fifo_vsync = false, int fg_fixed_mult = 0) {
Member

L2 (blocking): The target calculation discards frame-rate caps above 60 and clamps to display refresh even when V-Sync is off.

When: At a 120 FPS cap on a 120 Hz display, a GPU-limited 70 FPS scene is compared with a 60 FPS target. It cannot satisfy the step-down FPS condition, so Auto remains at its initial scale rather than reducing resolution toward the selected cap. Likewise, an uncapped V-Sync-off game on a 30 Hz display targets only 30 FPS.

Do: Use the actual selected cap and apply the display ceiling only when the active presentation mode imposes it; cover high caps and V-Sync-off refresh rates in the controller tests.

**L2** (blocking): The target calculation discards frame-rate caps above 60 and clamps to display refresh even when V-Sync is off. *When:* At a 120 FPS cap on a 120 Hz display, a GPU-limited 70 FPS scene is compared with a 60 FPS target. It cannot satisfy the step-down FPS condition, so Auto remains at its initial scale rather than reducing resolution toward the selected cap. Likewise, an uncapped V-Sync-off game on a 30 Hz display targets only 30 FPS. **Do:** Use the actual selected cap and apply the display ceiling only when the active presentation mode imposes it; cover high caps and V-Sync-off refresh rates in the controller tests.
@ -4420,0 +4439,4 @@
drs_active_packed.store(0, std::memory_order_relaxed);
}
int effective_resolution() {
const int saved = opts.resolution;
Member

L3 (blocking): The atomic runtime stop does not protect the saved resolution and upscaler values read alongside it from another thread.

When: The game thread calls the renderer option query while the menu or control thread changes the resolution or upscaler under menu_mu. effective_resolution reads opts.resolution and upscaler() without that lock while set_row writes those fields, producing a C++ data race and potentially pairing a stop with inconsistent settings.

Do: Publish the saved resolution, upscaler and effective stop as a synchronized snapshot, or protect all of these reads and writes with the same lock.

**L3** (blocking): The atomic runtime stop does not protect the saved resolution and upscaler values read alongside it from another thread. *When:* The game thread calls the renderer option query while the menu or control thread changes the resolution or upscaler under menu_mu. effective_resolution reads opts.resolution and upscaler() without that lock while set_row writes those fields, producing a C++ data race and potentially pairing a stop with inconsistent settings. **Do:** Publish the saved resolution, upscaler and effective stop as a synchronized snapshot, or protect all of these reads and writes with the same lock.
Owner

@Beanstalk

@Beanstalk
fix(vk): allow CPU-bound DRS step-up, honor >60 caps/FIFO mode, and publish atomic snapshot
Some checks failed
beanstalk/approval not approved yet
PR description / Description follows the template (pull_request_target) Successful in 5s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
72e4ea1432
Drop the native-FPS gate from DRS step-up so CPU-bound iGPUs starting at 67% recover resolution cleanly when GPU headroom permits. Honor positive FPS caps >60 in drs::target_fps() and clamp to display_hz only under actual FIFO/FIFO_RELAXED swapchain presentation. Publish (upscaler, effective_resolution_id) via one synchronized atomic snapshot to eliminate cross-thread data races in effective_resolution_auto()/scale().

Assisted-by: Antigravity
Author
Contributor

Addressed BeanBot review findings L1, L2, and L3 in commit 72e4ea1432c8a4ad493c85b120570793172f63e7 (also corrected the Files to read first and ## Risks symbol names in the PR description):

Changes

  1. L1 (gpu/vk/drs.h:256-265) — CPU-bound iGPU recovery:

    • Removed the s.native_fps >= kStepUpFpsShare * target gate from clear_headroom while keeping the 67% iGPU starting stop and the < 75% budget CPU-bound step-down guard. CPU-limited scenes on integrated GPUs now recover quality stops cleanly whenever current (< 68% budget) and projected next-stop (< 85% budget) GPU headroom permit.
    • Updated tests/test_drs.py with test_cpu_bound_recovery() (67% -> 92% and 67% -> 100%) without seesawing.
    • These adjustments do not alter the GPU-bound Radeon 860M behavior reported in ## Measurements, where GPU load exceeds the step-down threshold.
  2. L2 (gpu/vk/drs.h:140-150, gpu/vk/vk_menu.cpp:4830-4835) — High caps and FIFO V-Sync gating:

    • drs::target_fps() now honors positive frame-rate caps above 60 (90, 120, 144, etc.), defaulting uncapped (0) to 60.0f.
    • Clamping to display_hz (and display_hz / fg_fixed_mult for fixed frame generation, using framegen_now() so DLSS-G caps are respected) now applies only when fifo_vsync is active, sourced from dev.swapchain (VK_PRESENT_MODE_FIFO_KHR / VK_PRESENT_MODE_FIFO_RELAXED_KHR, with !dev.swapchain && menu_vsync() == 1 fallback).
    • Updated tests/test_drs.py for high caps (90, 120, 144), fifo_vsync == false vs true, and 120 FPS drs::update() step-down/step-up.
  3. L3 (gpu/vk/vk_menu.cpp, gpu/vk/menu/preset.{h,cpp}) — Synchronized cross-thread resolution snapshot:

    • Replaced unsynchronized reads of opts.resolution and upscaler() with a single std::atomic<uint32_t> drs_snapshot (kDrsSnapValid | (u << 8) | res), published via drs_publish_snapshot() under menu_mu across initialization, menu/preset/auto-tune writes, menu_drs_tick(), and rollbacks (the detached probe_upscalers_soon() thread sets an atomic drs_probe_dirty flag consumed on menu_tick() rather than locking menu_mu).
    • effective_resolution_auto() and effective_resolution_scale() load this snapshot lock-free (RX_VK_DRS=0 and HOS_RES_SCALE parity preserved).
    • Updated affected srccut test fixtures (tests/test_crt_options.py, tests/test_framegen_preset.py, tests/test_upscaler_round_trip.py).

Verification

  • python -I -B tests/run_all.py --strict across all affected checks (test_drs, test_crt_options, test_framegen_preset, test_upscaler_round_trip, test_vk_braces, byte_compile_tracked): 6 passed, 0 failed, 0 skipped (all 15 PR-affected checks passed 15/15 under --strict before the final detached-probe/cap polish, with the 6 re-affected checks re-verified after).
  • python -I -B tests/run_all.py --changed 79d192c6 on Windows (prior to the final 6-check polish): 355 passed, 10 failed, 10 skipped (all 10 failures confirmed unrelated pre-existing Windows/main checks: test_crash_dialog, test_dev_ab, test_dev_packs, test_flat_map, test_input_movie, test_perf_report, test_pipeline_state_computes, test_sampler_admission, test_saveload_warm_cache, test_srccut).
  • python -I scripts/dev.py vk on Windows (llvm-mingw): builds cleanly (longshot_vk.dll).

Switch Default & Remaining Tier 1 Testing (L4)

  • With L1 fixed (CPU-bound iGPUs recover upward cleanly instead of staying trapped at 67%), RX_VK_DRS remains default-on (1) per switch conventions (RX_VK_DRS=0 restores prior Auto behavior). Non-blocking Tier 1 hardware validation items in L4 (Linux RADV, Steam Deck, and Windows NVIDIA) remain for Beanstalk Test Farm verification.
Addressed BeanBot review findings **L1**, **L2**, and **L3** in commit `72e4ea1432c8a4ad493c85b120570793172f63e7` (also corrected the `Files to read first` and `## Risks` symbol names in the PR description): ### Changes 1. **L1 (`gpu/vk/drs.h:256-265`) — CPU-bound iGPU recovery:** - Removed the `s.native_fps >= kStepUpFpsShare * target` gate from `clear_headroom` while keeping the `67%` iGPU starting stop and the `< 75%` budget CPU-bound step-down guard. CPU-limited scenes on integrated GPUs now recover quality stops cleanly whenever current (`< 68%` budget) and projected next-stop (`< 85%` budget) GPU headroom permit. - Updated `tests/test_drs.py` with `test_cpu_bound_recovery()` (`67% -> 92%` and `67% -> 100%`) without seesawing. - These adjustments do not alter the GPU-bound Radeon 860M behavior reported in `## Measurements`, where GPU load exceeds the step-down threshold. 2. **L2 (`gpu/vk/drs.h:140-150`, `gpu/vk/vk_menu.cpp:4830-4835`) — High caps and FIFO V-Sync gating:** - `drs::target_fps()` now honors positive frame-rate caps above 60 (`90`, `120`, `144`, etc.), defaulting uncapped (`0`) to `60.0f`. - Clamping to `display_hz` (and `display_hz / fg_fixed_mult` for fixed frame generation, using `framegen_now()` so DLSS-G caps are respected) now applies only when `fifo_vsync` is active, sourced from `dev.swapchain` (`VK_PRESENT_MODE_FIFO_KHR` / `VK_PRESENT_MODE_FIFO_RELAXED_KHR`, with `!dev.swapchain && menu_vsync() == 1` fallback). - Updated `tests/test_drs.py` for high caps (`90`, `120`, `144`), `fifo_vsync == false` vs `true`, and `120 FPS` `drs::update()` step-down/step-up. 3. **L3 (`gpu/vk/vk_menu.cpp`, `gpu/vk/menu/preset.{h,cpp}`) — Synchronized cross-thread resolution snapshot:** - Replaced unsynchronized reads of `opts.resolution` and `upscaler()` with a single `std::atomic<uint32_t> drs_snapshot` (`kDrsSnapValid | (u << 8) | res`), published via `drs_publish_snapshot()` under `menu_mu` across initialization, menu/preset/auto-tune writes, `menu_drs_tick()`, and rollbacks (the detached `probe_upscalers_soon()` thread sets an atomic `drs_probe_dirty` flag consumed on `menu_tick()` rather than locking `menu_mu`). - `effective_resolution_auto()` and `effective_resolution_scale()` load this snapshot lock-free (`RX_VK_DRS=0` and `HOS_RES_SCALE` parity preserved). - Updated affected `srccut` test fixtures (`tests/test_crt_options.py`, `tests/test_framegen_preset.py`, `tests/test_upscaler_round_trip.py`). ### Verification - `python -I -B tests/run_all.py --strict` across all affected checks (`test_drs`, `test_crt_options`, `test_framegen_preset`, `test_upscaler_round_trip`, `test_vk_braces`, `byte_compile_tracked`): **6 passed, 0 failed, 0 skipped** (all 15 PR-affected checks passed `15/15` under `--strict` before the final detached-probe/cap polish, with the 6 re-affected checks re-verified after). - `python -I -B tests/run_all.py --changed 79d192c6` on Windows (prior to the final 6-check polish): **355 passed, 10 failed, 10 skipped** (all 10 failures confirmed unrelated pre-existing Windows/`main` checks: `test_crash_dialog`, `test_dev_ab`, `test_dev_packs`, `test_flat_map`, `test_input_movie`, `test_perf_report`, `test_pipeline_state_computes`, `test_sampler_admission`, `test_saveload_warm_cache`, `test_srccut`). - `python -I scripts/dev.py vk` on Windows (`llvm-mingw`): builds cleanly (`longshot_vk.dll`). ### Switch Default & Remaining Tier 1 Testing (L4) - With **L1** fixed (CPU-bound iGPUs recover upward cleanly instead of staying trapped at `67%`), `RX_VK_DRS` remains default-on (`1`) per switch conventions (`RX_VK_DRS=0` restores prior Auto behavior). Non-blocking Tier 1 hardware validation items in L4 (Linux RADV, Steam Deck, and Windows NVIDIA) remain for Beanstalk Test Farm verification.
Jer9 force-pushed feat/vk-fg-aware-drs from 72e4ea1432
Some checks failed
beanstalk/approval not approved yet
PR description / Description follows the template (pull_request_target) Successful in 5s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
to ccf3e1c956
Some checks are pending
CI / Conventional Commit title (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Blocked by required conditions
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Blocked by required conditions
CI / Workflow lint (actionlint) (pull_request) Blocked by required conditions
CI / Website build and checks (pull_request) Blocked by required conditions
Guide screenshots / Guide images and local UI source review (pull_request) Blocked by required conditions
Third-party parts / As their notes say (pull_request) Blocked by required conditions
Third-party parts / The same as upstream (pull_request) Blocked by required conditions
Website / Website on Cloudflare (pull_request) Blocked by required conditions
beanstalk/approval not approved yet
PR description / Description follows the template (pull_request_target) Successful in 4s
2026-11-23 23:27:32 +00:00
Compare
Some checks are pending
CI / Conventional Commit title (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Blocked by required conditions
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Blocked by required conditions
CI / Workflow lint (actionlint) (pull_request) Blocked by required conditions
CI / Website build and checks (pull_request) Blocked by required conditions
Guide screenshots / Guide images and local UI source review (pull_request) Blocked by required conditions
Third-party parts / As their notes say (pull_request) Blocked by required conditions
Third-party parts / The same as upstream (pull_request) Blocked by required conditions
Website / Website on Cloudflare (pull_request) Blocked by required conditions
beanstalk/approval not approved yet
PR description / Description follows the template (pull_request_target) Successful in 4s
This pull request has changes conflicting with the target branch.
  • docs/user/graphics-and-controls.md
Some workflows are waiting to be reviewed.
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'feat/vk-fg-aware-drs:Jer9-feat/vk-fg-aware-drs'
git switch 'Jer9-feat/vk-fg-aware-drs'
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
4 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/Longshot!2400
No description provided.