fix(dlssfg): pace generated frames from when the first one is made (FSR / DLSS / MVFG judder) #186

Manually merged
github merged 1 commit from github-bot/gh-186 into main 2026-12-05 21:05:11 +00:00 AGit
Owner

@⁠OliWoly on GitHub · 2026-12-05 20:53 UTC · original
OliWoly:pr/fg-pace-made → main · +49 −0 · 2 files · 1 commits · merged 2026-12-05 21:04 UTC

Problem

With frame generation on (seen with FSR FG 2x at a 30 fps base), the counter shows a steady 60 but motion looks choppy.

At the title's present, dlssfg::present records the generation, presents the first generated picture at once, and queues the title's own picture (and any further generated ones) at now + step * k. But the first generated picture is presented while the card is still making it: it only reaches the screen a generation's GPU time after now. The title's own picture is ready long before its slot and goes out on time. So on screen the gaps alternate:

  • generated → title's own: step − generation time (e.g. ~13 ms)
  • title's own → next generated: step + generation time (e.g. ~20 ms)

An external limiter such as MangoHud's cannot even this out, because the unevenness is in when the pacer presents each picture.

Change

Presenting keeps an anchor: our fence value behind the first generated picture's list, and the title's present time. Before showing anything else, the pacer thread waits until the fence passes that value (polling every 0.5 ms through the existing condvar), then moves every waiting picture's due time by the time that took. Each picture then follows the one before by a whole step, measured from when the generated one is actually made.

  • The wait and the shift are capped at a quarter of the title's frame time, so the title's own picture stays ahead of its next present (catch_up behaves as before).
  • catch_up and before_resize clear the anchor.
  • LARP_FG_PACE_MADE=0 restores the old timing (documented in docs/environment-variables.md).
  • Applies to all three generators, since they share the pacer.

Tested

Linux, RX 7900 XTX, RADV, Proton (GE-Proton10-34) with vkd3d-proton, KDE Wayland, 165 Hz with VRR. Series X, FSR quality, LARP_FRAME_RATE=30, FSR frame generation 2x. Driving in the city: visible judder before, smooth after. Not tested on Windows or with DLSS FG / MVFG. Built with cargo xwin build --release -p larp.

🤖 Generated with Claude Code

**@⁠OliWoly** on GitHub · 2026-12-05 20:53 UTC · [original](https://github.com/gamingwithhomie/larp/pull/186) `OliWoly:pr/fg-pace-made` → `main` · +49 −0 · 2 files · 1 commits · merged 2026-12-05 21:04 UTC ## Problem With frame generation on (seen with FSR FG 2x at a 30 fps base), the counter shows a steady 60 but motion looks choppy. At the title's present, `dlssfg::present` records the generation, presents the first generated picture at once, and queues the title's own picture (and any further generated ones) at `now + step * k`. But the first generated picture is presented while the card is still making it: it only reaches the screen a generation's GPU time after `now`. The title's own picture is ready long before its slot and goes out on time. So on screen the gaps alternate: - generated → title's own: `step − generation time` (e.g. ~13 ms) - title's own → next generated: `step + generation time` (e.g. ~20 ms) An external limiter such as MangoHud's cannot even this out, because the unevenness is in when the pacer presents each picture. ## Change `Presenting` keeps an `anchor`: our fence value behind the first generated picture's list, and the title's present time. Before showing anything else, the pacer thread waits until the fence passes that value (polling every 0.5 ms through the existing condvar), then moves every waiting picture's due time by the time that took. Each picture then follows the one before by a whole step, measured from when the generated one is actually made. - The wait and the shift are capped at a quarter of the title's frame time, so the title's own picture stays ahead of its next present (`catch_up` behaves as before). - `catch_up` and `before_resize` clear the anchor. - `LARP_FG_PACE_MADE=0` restores the old timing (documented in `docs/environment-variables.md`). - Applies to all three generators, since they share the pacer. ## Tested Linux, RX 7900 XTX, RADV, Proton (GE-Proton10-34) with vkd3d-proton, KDE Wayland, 165 Hz with VRR. Series X, FSR quality, `LARP_FRAME_RATE=30`, FSR frame generation 2x. Driving in the city: visible judder before, smooth after. Not tested on Windows or with DLSS FG / MVFG. Built with `cargo xwin build --release -p larp`. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
At a present the first generated picture is presented at once, but the
card is still making it: it reaches the screen a generation's GPU time
after the present. The title's own picture is ready long before its
time and is presented at present + step. On screen the gaps alternated
short and long (for example about 13 and 20 ms at 30 fps 2x), which
reads as judder although the counter shows an even 60.

The pacer now waits (polling our fence every half millisecond) until the
card has made the first generated picture and moves the pictures that
wait by the time that took, so each follows the one before by a whole
step. At most a quarter of the title's frame time is waited for or
added, so the title's own picture stays ahead of its next present.
LARP_FG_PACE_MADE=0 restores the old timing.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-05 20:59:02 +00:00
github-bot referenced this pull request from a commit 2026-12-05 21:05:10 +00:00
github manually merged commit 6ec5cf2419 into main 2026-12-05 21:05:11 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.