FSR 3: interpolate against measured present cadence, not title cadence #144
Loading…
Reference in a new issue
No description provided.
Delete branch "TheStonedGamer/Darner:fsr-flicker-fix"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
FSR 3 frame_time_delta was the title's upscale cadence (~18 ms / ~54 fps)
while real presents were ~50 ms (~20 fps). Interpolating at the wrong rate
made bright lights flicker. Use the measured present-to-present interval
(DARNER_FRAMEGEN_FRAME_MS to force), falling back to the title's value;
reset interpolation history on large cadence jumps.
Contributor role (optional)
What it changes
How it was tested
Checklist
main.docs/asset-policy.md.Checked for overlap
Thanks for this, the idea of using the measured present interval looks right to me. One thing I think I see when reading it:
measured_frame_ms()is called twice inbefore_presentincrates/darner-gpu/src/streamline/fsr.rs: at line 882 (let _ = measured_frame_ms();) and at line 967 (let measured = measured_frame_ms();). Both calls are in the same present, and each one stores "now" inLAST_PRESENT. So the second call measures the time since the first call, which is only the few microseconds of code in between. That is below the4.0..=200.0clamp, so the filter turns it intoNone.Effect, as I read it: without
DARNER_FRAMEGEN_FRAME_MS,frame_msfalls back toinputs.frame_ms. That is the old behaviour, soframe_time_deltastays at the title's value.cadence_jumpthen comparesframe_mswithtitle_ms, which are the same number, so it never fires. With the env override set, the forced value is used and the jump check can fire.A fix could be to call it once per present, keep the value, and use it at both places. For example, take
let measured = measured_frame_ms();at line 882, and use that variable at line 967. This also keeps the measurement running while generation is held off.This is from reading the code at
48945a9. I have not built or run it.We are interested because we are looking at FSR 3 frame generation ghosting on moving objects, with DLSS upscaling plus FSR frame generation on an RTX 2070 SUPER.
Drafted with AI assistance (Claude Code).
Holding this for now. Jesper-A's reading is right:
measured_frame_ms()runs twice in one present, so the second call measures a few microseconds, gets filtered toNone, andframe_time_deltastays the title's value.A second problem shows up once that is fixed (measure once per present and reuse the value):
cadence_jumpcompares the measured interval with the title's. In the case the PR describes (the title says ~18 ms, real presents ~50 ms) that ratio is about 2.8 on every frame, soresetwould be set on every present and FSR would drop its history each frame. That throws away the interpolation instead of fixing it.A reset only when the measured cadence itself jumps between consecutive presents (for example this interval more than 2x the previous one, after a stall or a load) would keep the history in steady play. Comparing against the title's value can stay as a log line.
With both changes, an A/B in game would show whether the flicker goes: same spot, FG on, with and without the PR, and the log's
title_frame_msand measured values.i'm trying to fix an issue where any bright lights strobe really bad whenever fsr3 is active
I tested a patch on top of this PR’s head,
48945a9db1, for the two timing issues above. It samples once per rendered present, including while generation is held off. It compares successive measured intervals for a slowdown greater than 2× and keeps a pending history reset until prepare and configure both succeed. The forced frame-time override still takes priority.With synthetic 50 ms presents and an 18 ms title delta, the candidate passes 50 ms after the first frame and keeps its history. I also used a 43.455 → 426.530 → 85.061 ms sequence from an archived run with FG off. The candidate rejects the 426.530 ms as an SDK delta, requests one reset, and accepts 85.061 ms on recovery. A first measured gap above 200 ms also requests a reset because the first frame may already have prepared with the title delta.
On Windows, all eight tests passed with
cargo test --locked --offline -p darner-gpu --lib streamline::fsr::tests, including four new timing regressions. The staged asset-policy check passed. The patch applies directly to48945a9db1. I haven’t tested the bright-light scene with FG enabled, so the visual result is still open.Test result on this PR's topic. At a base rate of about 10 fps (RTX 2070 SUPER 8 GB, Series S profile, DLSS Performance, FSR 3 frame generation 2X), a local test switch that sets
frame_time_deltato the measured interval between real frames did not remove the frame generation ghosting on moving objects. One run, no statistics.Build: release-profile build on main
40ed13b91(2026-12-03) plus our commits 9b36226d9 (DARNER_FSR_FG_MEASURED_DT, ours) and 460e7de9a (DARNER_FSR_FG_SNAPSHOT, ours), and other local commits. Not this PR's code. The maintainer's 23:19 comment says the PR's measured value was read twice per present; our local switch measures once per prepare and is not the PR's code.The log's
frame time to FGlines (title value and measured value, in windows about ten seconds apart, with frame generation on; at 01:40:00 and 01:41:03 only 39 and 41 presents had it on, the rest were off):The two values are within about 1 to 5 ms in 3 of 7 windows, 17 to 32 ms apart in three, and 88 ms apart at 01:40:53. At this base rate both are far above the ~18 ms vs ~50 ms mismatch this PR describes, so this run does not show whether the PR's change helps in that case.
Log:
darner-play-20261204-013806. We will attach it with the Windows user name removed (line 1 holds it); say if you want it.Spec dependence: a base rate of about 10 fps is specific to our 8 GB Turing setup (the host is the limit). Not tested: this PR's code, the bright-light flicker, other GPUs. The rest of our ghosting tests are in #178.
Drafted with AI assistance (Claude Code).
48945a9db1to870f9262ddView command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.