FSR 3: interpolate against measured present cadence, not title cadence #144

Open
TheStonedGamer wants to merge 1 commit from TheStonedGamer/Darner:fsr-flicker-fix into main
First-time contributor

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)

  • Fluxer ID:

What it changes

How it was tested

  • Tested revision:
  • Commands and results:
  • Gameplay, when relevant: GPU, Series X or S profile, resolution, DLSS, frame generation, ray tracing.
  • Before and after, when relevant: compare the same scene, settings and hardware.
  • Shader wave sizes tested, when relevant: 32 and/or 64 lanes.
  • Coverage gaps:

Checklist

  • This PR contains one change based on main.
  • The diff follows docs/asset-policy.md.
  • I recorded this PR's dependencies below.
    • Depends on: none

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches.
  • Related PRs:
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. <!-- Thanks for the pull request. Please label it (pr-fix, pr-feature, pr-performance, pr-diagnostics, pr-refactor, pr-docs or pr-tests, plus the area labels), or put the label in the title, like [pr-fix]. --> <!-- Use Fixes #N for a complete fix or Refs #N for a partial change. --> ## Contributor role (optional) - Fluxer ID: <!-- Type !myid in the Darner Fluxer server and paste the number here. When this is merged, you get the Contributor role there. --> ## What it changes <!-- What was wrong, and what this does about it. --> ## How it was tested - Tested revision: - Commands and results: - Gameplay, when relevant: GPU, Series X or S profile, resolution, DLSS, frame generation, ray tracing. - Before and after, when relevant: compare the same scene, settings and hardware. - Shader wave sizes tested, when relevant: 32 and/or 64 lanes. - Coverage gaps: ## Checklist - [ ] This PR contains one change based on `main`. - [ ] The diff follows `docs/asset-policy.md`. - [ ] I recorded this PR's dependencies below. - Depends on: none <!-- Replace the indented item above with one item per prerequisite using "- Depends on #N (reason)". Keep this PR in draft while any prerequisite is unmerged. Add the same PRs in CodeFloe's Dependencies panel if you can edit it. --> <!-- Address review feedback in this PR. Open a new PR for follow-up work. --> ## Checked for overlap - [ ] I searched the open pull requests for the same issue and for the files this touches. - Related PRs: <!-- List #N or write "none found". -->
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

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 in before_present in crates/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" in LAST_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 the 4.0..=200.0 clamp, so the filter turns it into None.

Effect, as I read it: without DARNER_FRAMEGEN_FRAME_MS, frame_ms falls back to inputs.frame_ms. That is the old behaviour, so frame_time_delta stays at the title's value. cadence_jump then compares frame_ms with title_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).

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 in `before_present` in `crates/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" in `LAST_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 the `4.0..=200.0` clamp, so the filter turns it into `None`. Effect, as I read it: without `DARNER_FRAMEGEN_FRAME_MS`, `frame_ms` falls back to `inputs.frame_ms`. That is the old behaviour, so `frame_time_delta` stays at the title's value. `cadence_jump` then compares `frame_ms` with `title_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).
Owner

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 to None, and frame_time_delta stays the title's value.

A second problem shows up once that is fixed (measure once per present and reuse the value): cadence_jump compares 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, so reset would 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_ms and measured values.

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 to `None`, and `frame_time_delta` stays the title's value. A second problem shows up once that is fixed (measure once per present and reuse the value): `cadence_jump` compares 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, so `reset` would 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_ms` and measured values.
Author
First-time contributor

i'm trying to fix an issue where any bright lights strobe really bad whenever fsr3 is active

i'm trying to fix an issue where any bright lights strobe really bad whenever fsr3 is active
First-time contributor

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 to 48945a9db1. I haven’t tested the bright-light scene with FG enabled, so the visual result is still open.

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 to 48945a9db1. I haven’t tested the bright-light scene with FG enabled, so the visual result is still open.
Contributor

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_delta to 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 FG lines (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):

Time (UTC, 2026-12-04) title measured
01:40:00 100.0 ms 82.6 ms
01:40:11 93.2 ms 88.0 ms
01:40:21 71.8 ms 39.8 ms
01:40:31 92.1 ms 111.0 ms
01:40:42 93.1 ms 91.5 ms
01:40:53 123.6 ms 211.1 ms
01:41:03 84.5 ms 83.2 ms

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).

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_delta` to 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 FG` lines (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): | Time (UTC, 2026-12-04) | title | measured | |---|---|---| | 01:40:00 | 100.0 ms | 82.6 ms | | 01:40:11 | 93.2 ms | 88.0 ms | | 01:40:21 | 71.8 ms | 39.8 ms | | 01:40:31 | 92.1 ms | 111.0 ms | | 01:40:42 | 93.1 ms | 91.5 ms | | 01:40:53 | 123.6 ms | 211.1 ms | | 01:41:03 | 84.5 ms | 83.2 ms | 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).
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'fsr-flicker-fix:TheStonedGamer-fsr-flicker-fix'
git switch 'TheStonedGamer-fsr-flicker-fix'

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.

git switch 'main'
git merge --no-ff 'TheStonedGamer-fsr-flicker-fix'
git switch 'TheStonedGamer-fsr-flicker-fix'
git rebase 'main'
git switch 'main'
git merge --ff-only 'TheStonedGamer-fsr-flicker-fix'
git switch 'TheStonedGamer-fsr-flicker-fix'
git rebase 'main'
git switch 'main'
git merge --no-ff 'TheStonedGamer-fsr-flicker-fix'
git switch 'main'
git merge --squash 'TheStonedGamer-fsr-flicker-fix'
git switch 'main'
git merge --ff-only 'TheStonedGamer-fsr-flicker-fix'
git switch 'main'
git merge 'TheStonedGamer-fsr-flicker-fix'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
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
TrustNo1/Darner!144
No description provided.