[pr-fix][frame-generation] FSR frame generation without the line of submissions #139

Manually merged
TrustNo1 merged 0 commits from dutchmega/Darner:fsr-framegen-without-line into main 2026-12-04 02:14:07 +00:00
Contributor

Contributor role (optional)

  • Fluxer ID: 1575942915249680389

What it changes

FSR frame generation only ran with the line of submissions (queue::line_on()), which needs DARNER_RELAY>=1. On AMD the loss guard sets DARNER_RELAY=0 unless the player sets it, so with the PC FidelityFX upscaler (DARNER_PC_FSR=1) frame generation stayed off. Without the line, the states of depth and motion vectors at the present are not known.

With this change, when the line is off, the PC FidelityFX upscaling copies depth and motion vectors at the upscaling (the existing FgSnapshot path), and frame generation reads those copies. The host list that runs frame generation keeps the copies until it has run. With the line on, nothing changes.

  • streamline.rs: Inputs carries the snapshot; record_host_upscale asks for a snapshot when the line is off.
  • streamline/fsr.rs: before_present takes the HostList, runs frame generation without the line when the inputs are snapshots, and keeps the snapshot on that list.
  • host.rs: passes the HostList to before_present.

How it was tested

  • Tested revision: 4f7aa95
  • Commands and results (on 4f7aa95):
    • cargo clippy --workspace --all-targets --locked -- -D warnings: passes.
    • cargo clippy --workspace --all-targets --all-features --locked -- -D warnings: passes.
    • cargo test --workspace --locked: darner-gpu --lib exits with STATUS_ACCESS_VIOLATION (0xc0000005). The same happens on main (57dea7f), so it is not from this change. The other crates' tests pass.
  • Gameplay: AMD RX 9070, DARNER_RELAY=0, DARNER_PC_FSR=1, FSR 4 upscaler, FSR frame generation 2x. Over 10 s windows: 105–110 presents with a generated frame, and 0 failed prepares. Before this change frame generation did not run with these settings.
  • Coverage gaps: the cost of the copies was not measured. Frame generation image quality was not judged separately. Not tested on NVIDIA or Intel, or with DARNER_RELAY>=1 (that path is unchanged). The base frame rate with relay 0 was about 10 fps, far below what frame generation is meant for.

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: none cover the same problem. Same files: #113 (streamline/fsr.rs, the swap-chain format check; another part of the file), #48 and #47 (streamline.rs, XeSS).
## Contributor role (optional) - Fluxer ID: 1575942915249680389 ## What it changes FSR frame generation only ran with the line of submissions (`queue::line_on()`), which needs `DARNER_RELAY>=1`. On AMD the loss guard sets `DARNER_RELAY=0` unless the player sets it, so with the PC FidelityFX upscaler (`DARNER_PC_FSR=1`) frame generation stayed off. Without the line, the states of depth and motion vectors at the present are not known. With this change, when the line is off, the PC FidelityFX upscaling copies depth and motion vectors at the upscaling (the existing `FgSnapshot` path), and frame generation reads those copies. The host list that runs frame generation keeps the copies until it has run. With the line on, nothing changes. - `streamline.rs`: `Inputs` carries the snapshot; `record_host_upscale` asks for a snapshot when the line is off. - `streamline/fsr.rs`: `before_present` takes the `HostList`, runs frame generation without the line when the inputs are snapshots, and keeps the snapshot on that list. - `host.rs`: passes the `HostList` to `before_present`. ## How it was tested - Tested revision: 4f7aa95 - Commands and results (on 4f7aa95): - `cargo clippy --workspace --all-targets --locked -- -D warnings`: passes. - `cargo clippy --workspace --all-targets --all-features --locked -- -D warnings`: passes. - `cargo test --workspace --locked`: `darner-gpu --lib` exits with `STATUS_ACCESS_VIOLATION` (0xc0000005). The same happens on `main` (57dea7f), so it is not from this change. The other crates' tests pass. - Gameplay: AMD RX 9070, `DARNER_RELAY=0`, `DARNER_PC_FSR=1`, FSR 4 upscaler, FSR frame generation 2x. Over 10 s windows: 105–110 presents with a generated frame, and 0 failed prepares. Before this change frame generation did not run with these settings. - Coverage gaps: the cost of the copies was not measured. Frame generation image quality was not judged separately. Not tested on NVIDIA or Intel, or with `DARNER_RELAY>=1` (that path is unchanged). The base frame rate with relay 0 was about 10 fps, far below what frame generation is meant for. ## Checklist - [x] This PR contains one change based on `main`. - [x] The diff follows `docs/asset-policy.md`. - [x] I recorded this PR's dependencies below. - Depends on: none ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. - Related PRs: none cover the same problem. Same files: #113 (`streamline/fsr.rs`, the swap-chain format check; another part of the file), #48 and #47 (`streamline.rs`, XeSS).
With DARNER_RELAY=0 (the default on AMD cards) the line of submissions does not start, so the states darner tracks for depth and motion at the present are not known and FSR frame generation stayed off. The PC upscaler now snapshots both where the title's upscaling reads them; the present list keeps the snapshot until it has run.

RX 9070, FG type fsr4, DARNER_RELAY=0, frame generation 2x: 105-110 presents a 10 s with a generated frame, 0 prepare dispatches failed (was 0 with it on).
Contributor

I reproduced a snapshot lifetime problem on 4f7aa95d33 with an RTX 4060 8 GB, NVIDIA driver 621.40, Windows 11 build 26300, and Rust 1.98.1. The test ran with DARNER_RELAY=0 DARNER_ASYNC_SUBMIT=0 DARNER_THIN=0 DARNER_FG_RECT=auto DARNER_FG_BARS_CLEAR=0.

The automatic bar detector records its depth and motion copies in live.bars.before_prepare before FidelityFX reports the prepare result. The present command list keeps the FgSnapshot only when prepare succeeds. If prepare fails, a later submitted upscale can replace the source in SUBMITTED and recycle the slot before that command list is submitted.

I ran the following sequence with synthetic textures and the real D3D12 queue. Fill the first snapshot with 0x1b and record before_present without submitting it. Replace the submitted upscale and queue a fill of 0xb7 from a subsequent snapshot acquisition. Then submit the older present list and map the actual motion readback from the bar detector. The fixture keeps independent COM references to the original resources, so the readback isolates reuse of the slot's contents.

Revision Prepare outcome Slot reused First readback byte
PR head Success No, 3/3 0x1b, 3/3
PR head Error Yes, 3/3 0xb7, 3/3
PR head + guard moved Success No, 3/3 0x1b, 3/3
PR head + guard moved Error No, 3/3 0x1b, 3/3

Moving the existing if let Some(snapshot) = &inputs.snapshot { host_list.keep_fg_snapshot(snapshot.clone()); } immediately above live.bars.before_prepare(...) fixed the error case. The list then owns the snapshot as soon as it records a copy from it. The existing FSR, auto bar detector, and submitted snapshot tests also passed (18 tests) with cargo test --locked -p darner-gpu --lib and their respective filters.

The fixture injected the SDK prepare result. Snapshot allocation, the bar detector, command submission, and the mapped readback ran on hardware. The observed failure was incorrect synthetic readback data.

I reproduced a snapshot lifetime problem on 4f7aa95d33ed6f16a851be81ead80350f01086e7 with an RTX 4060 8 GB, NVIDIA driver 621.40, Windows 11 build 26300, and Rust 1.98.1. The test ran with `DARNER_RELAY=0 DARNER_ASYNC_SUBMIT=0 DARNER_THIN=0 DARNER_FG_RECT=auto DARNER_FG_BARS_CLEAR=0`. The automatic bar detector records its depth and motion copies in `live.bars.before_prepare` before FidelityFX reports the prepare result. The present command list keeps the `FgSnapshot` only when prepare succeeds. If prepare fails, a later submitted upscale can replace the source in `SUBMITTED` and recycle the slot before that command list is submitted. I ran the following sequence with synthetic textures and the real D3D12 queue. Fill the first snapshot with 0x1b and record `before_present` without submitting it. Replace the submitted upscale and queue a fill of 0xb7 from a subsequent snapshot acquisition. Then submit the older present list and map the actual motion readback from the bar detector. The fixture keeps independent COM references to the original resources, so the readback isolates reuse of the slot's contents. | Revision | Prepare outcome | Slot reused | First readback byte | |---|---|---|---| | PR head | Success | No, 3/3 | 0x1b, 3/3 | | PR head | Error | Yes, 3/3 | 0xb7, 3/3 | | PR head + guard moved | Success | No, 3/3 | 0x1b, 3/3 | | PR head + guard moved | Error | No, 3/3 | 0x1b, 3/3 | Moving the existing `if let Some(snapshot) = &inputs.snapshot { host_list.keep_fg_snapshot(snapshot.clone()); }` immediately above `live.bars.before_prepare(...)` fixed the error case. The list then owns the snapshot as soon as it records a copy from it. The existing FSR, auto bar detector, and submitted snapshot tests also passed (18 tests) with `cargo test --locked -p darner-gpu --lib` and their respective filters. The fixture injected the SDK prepare result. Snapshot allocation, the bar detector, command submission, and the mapped readback ran on hardware. The observed failure was incorrect synthetic readback data.
Owner

Confirmed by reading before_present: the bar detector records copies from the snapshot before the prepare result is known, and the list only kept the snapshot on success. Your move (keep the snapshot right above live.bars.before_prepare, drop it from the success branch) is applied on our side.

Confirmed by reading `before_present`: the bar detector records copies from the snapshot before the prepare result is known, and the list only kept the snapshot on success. Your move (keep the snapshot right above `live.bars.before_prepare`, drop it from the success branch) is applied on our side.
TrustNo1 manually merged commit 3142daea1c into main 2026-12-04 02:14:07 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
3 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!139
No description provided.