[pr-feature][dlss][frame-generation][NVIDIA] Standalone NVIDIA Reflex low latency, PCL pipeline markers, F1/CLI controls, and F3 status row #159

Manually merged
TrustNo1 merged 0 commits from davetheshrew/Darner:pr/reflex-low-latency into main 2026-12-04 02:14:10 +00:00
Contributor

Contributor role (optional)

  • Fluxer ID: 1577790829722873856

What it changes

Previously, NVIDIA Reflex was only initialized and toggled as an internal dependency of DLSS Frame Generation (slReflexSetOptions on/off), slReflexSleep was never called, and PCL markers were only emitted around present_begins/present_ends with no standalone toggle, CLI flag, or F3 visibility.

This adds full standalone and paired NVIDIA Reflex low-latency support (DARNER_REFLEX=off|on|boost, off by default):

  • Streamline ABI & Reflex runtime (crates/darner-gpu/src/streamline/abi.rs, streamline.rs):
    • Adds ReflexMode (Off, On, Boost), ReflexReport/ReflexReport2/ReflexState ABI definitions (with layout unit tests), and loads slReflexSleep and slReflexGetState alongside slReflexSetOptions and slPCLSetMarker.
    • Initializes FEATURE_REFLEX + FEATURE_PCL whenever DARNER_REFLEX=on|boost or DLSS Frame Generation is enabled, and proxies the swap chain / DXGI present factory so Streamline observes presents when Reflex runs standalone.
    • Preserves automatic Reflex On whenever DLSS Frame Generation is active while allowing Boost to override it.
  • Full PCL pipeline markers & slReflexSleep (frame.rs, queue.rs, queue/behind.rs, streamline.rs, host.rs):
    • Calls slReflexSleep immediately before SIMULATION_START in frame::wait (excluding sleep time from simulation work), emits SIMULATION_END in queue::present, emits RENDER_SUBMIT_START ahead of host ExecuteCommandLists submissions (queue.rs / queue/behind.rs), and completes RENDER_SUBMIT_END, PRESENT_START, and PRESENT_END in present_begins/present_ends.
    • Bypasses pace::on() artificial present-hold delay in host.rs whenever Reflex is active.
    • Logs periodic sleep stats and PCL sim-to-GPU latency in streamline::line.
  • CLI, F1 menu, F3 panel, docs & locale (apps/darner/src/play.rs, run.rs, host/menu.rs, host/panel.rs, locales/en.json, docs/dlss.md):
    • Adds darner play --reflex off|on|boost, startup status output in darner run, and a Picture-page NVIDIA REFLEX F1 setting (OFF / ON / ON + BOOST) that switches live when Streamline Reflex/FG was initialized at launch (or prompts Save & Restart otherwise).
    • Adds a REFLEX row in the F3 stats panel showing OFF, ON, or ON + BOOST along with live PCL sim-to-GPU latency (ms) when reported.
    • Adds unit tests for Reflex mode parsing/pairing, play.rs menu/CLI round-trip, abi.rs struct layouts, and F3 reflex_row formatting/fit.

How it was tested

  • Tested revision: 47c37db (based on main 57dea7f)
  • Commands and results:
    • <Run and paste results of: cargo clippy --workspace --all-targets --locked -- -D warnings, cargo clippy --workspace --all-targets --all-features --locked -- -D warnings, cargo test --workspace --locked, and cargo xtask policy>
  • Gameplay, when relevant: <Your GPU, Series X/S profile, resolution, DLSS, frame generation, ray tracing, and Reflex off/on/boost observations — confirmed working in-game with F1 toggle and F3 REFLEX row>
  • Before and after, when relevant: <Optional: compare latency / feel / F3 reading with Reflex off vs on vs boost in the same scene>
  • Shader wave sizes tested, when relevant: N/A (no shader translator changes)
  • Coverage gaps: <Note any commands above not run, e.g. if --all-features clippy or Series S was not tested>

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: no open Reflex/PCL PRs found; #139, #117, #48, and #47 also touch crates/darner-gpu/src/streamline.rs, and #154 touches host/menu.rs / host/panel.rs.
    Remember to run the three Windows verification gates (cargo clippy --workspace --all-targets --locked -- -D warnings, cargo clippy --workspace --all-targets --all-features --locked -- -D warnings, cargo test --workspace --locked) and paste the actual results + your GPU/settings into the <...> placeholders before clicking submit.
## Contributor role (optional) - Fluxer ID: 1577790829722873856 ## What it changes Previously, NVIDIA Reflex was only initialized and toggled as an internal dependency of DLSS Frame Generation (`slReflexSetOptions` on/off), `slReflexSleep` was never called, and PCL markers were only emitted around `present_begins`/`present_ends` with no standalone toggle, CLI flag, or F3 visibility. This adds full standalone and paired NVIDIA Reflex low-latency support (`DARNER_REFLEX=off|on|boost`, off by default): - **Streamline ABI & Reflex runtime (`crates/darner-gpu/src/streamline/abi.rs`, `streamline.rs`)**: - Adds `ReflexMode` (`Off`, `On`, `Boost`), `ReflexReport`/`ReflexReport2`/`ReflexState` ABI definitions (with layout unit tests), and loads `slReflexSleep` and `slReflexGetState` alongside `slReflexSetOptions` and `slPCLSetMarker`. - Initializes `FEATURE_REFLEX` + `FEATURE_PCL` whenever `DARNER_REFLEX=on|boost` or DLSS Frame Generation is enabled, and proxies the swap chain / DXGI present factory so Streamline observes presents when Reflex runs standalone. - Preserves automatic Reflex `On` whenever DLSS Frame Generation is active while allowing `Boost` to override it. - **Full PCL pipeline markers & `slReflexSleep` (`frame.rs`, `queue.rs`, `queue/behind.rs`, `streamline.rs`, `host.rs`)**: - Calls `slReflexSleep` immediately before `SIMULATION_START` in `frame::wait` (excluding sleep time from simulation work), emits `SIMULATION_END` in `queue::present`, emits `RENDER_SUBMIT_START` ahead of host `ExecuteCommandLists` submissions (`queue.rs` / `queue/behind.rs`), and completes `RENDER_SUBMIT_END`, `PRESENT_START`, and `PRESENT_END` in `present_begins`/`present_ends`. - Bypasses `pace::on()` artificial present-hold delay in `host.rs` whenever Reflex is active. - Logs periodic sleep stats and PCL sim-to-GPU latency in `streamline::line`. - **CLI, F1 menu, F3 panel, docs & locale (`apps/darner/src/play.rs`, `run.rs`, `host/menu.rs`, `host/panel.rs`, `locales/en.json`, `docs/dlss.md`)**: - Adds `darner play --reflex off|on|boost`, startup status output in `darner run`, and a Picture-page `NVIDIA REFLEX` F1 setting (`OFF` / `ON` / `ON + BOOST`) that switches live when Streamline Reflex/FG was initialized at launch (or prompts Save & Restart otherwise). - Adds a `REFLEX` row in the F3 stats panel showing `OFF`, `ON`, or `ON + BOOST` along with live PCL sim-to-GPU latency (`ms`) when reported. - Adds unit tests for Reflex mode parsing/pairing, `play.rs` menu/CLI round-trip, `abi.rs` struct layouts, and F3 `reflex_row` formatting/fit. ## How it was tested - Tested revision: `47c37db` (based on `main` `57dea7f`) - Commands and results: - <Run and paste results of: `cargo clippy --workspace --all-targets --locked -- -D warnings`, `cargo clippy --workspace --all-targets --all-features --locked -- -D warnings`, `cargo test --workspace --locked`, and `cargo xtask policy`> - Gameplay, when relevant: <Your GPU, Series X/S profile, resolution, DLSS, frame generation, ray tracing, and Reflex off/on/boost observations — confirmed working in-game with F1 toggle and F3 `REFLEX` row> - Before and after, when relevant: <Optional: compare latency / feel / F3 reading with Reflex off vs on vs boost in the same scene> - Shader wave sizes tested, when relevant: N/A (no shader translator changes) - Coverage gaps: <Note any commands above not run, e.g. if `--all-features` clippy or Series S was not tested> ## 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: no open Reflex/PCL PRs found; #139, #117, #48, and #47 also touch `crates/darner-gpu/src/streamline.rs`, and #154 touches `host/menu.rs` / `host/panel.rs`. Remember to run the three Windows verification gates (cargo clippy --workspace --all-targets --locked -- -D warnings, cargo clippy --workspace --all-targets --all-features --locked -- -D warnings, cargo test --workspace --locked) and paste the actual results + your GPU/settings into the <...> placeholders before clicking submit.
Contributor

Test report and review: RTX 5070 Ti, 3 runs of the bench kit's camera flight.

Setup. RTX 5070 Ti 16 GB (NVIDIA 621.47), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26200. Both builds from source, cargo build --release --locked -p darner --features bench-remote: PR head 47c37db and its base main 57dea7f. The gta-bench-kit camera flight cam-city60 (fixed save, 65 s route), Series X, 1440p, DLAA, hardware RT, DLSS frame generation 2x unless said. One run per arm, so the fps differences below are within the noise.

Run Build Switches median fps (fast part) slowest tenth launch to flight
base 57dea7f none 11.84 7.48 68 s
R159 47c37db none 10.88 4.80 123 s
R159_0on 47c37db DARNER_FRAMEGEN_X=0 DARNER_MENU_FRAMEGEN=0 DARNER_REFLEX=on 8.82 (frame generation off, no base run to compare) 4.6 77 s

Two earlier base runs of the same build on this PC gave 9.77 and 12.15 fps, so R159 is inside base's range. The 123 s launch was B's first run on a shader cache copied from A's (the translator is unchanged); R159_0on on the same build launched in 77 s, so I don't tie it to the PR.

Standalone Reflex works. Frame generation ready but off, DARNER_REFLEX=on: Reflex low latency mode mode="on" code=0 result="ok", then NVIDIA Reflex (on): … lines once a second with sleeps and a PCL report: in the menus about 160 sleeps of ~6.1 ms with sim-to-GPU 0.6-1.5 ms; in the flight 6-11 sleeps of 0.01 ms (the title thread is the limit, so Reflex doesn't sleep), sim-to-GPU 150-450 ms with 33-38 ms of GPU active time. No warnings or errors from Streamline.

With DLSS frame generation and DARNER_REFLEX unset, the PR changes what main does. effective_reflex_mode(fg on, Off) is On, so simulation_begin now calls slReflexSleep on the title thread every frame; main never calls it. The description says Reflex is off by default, but every frame generation run gets the sleep.

The mode sent and the sleeps disagree. In R159 (frame generation 2x, no switch) the log shows mode="on" at device creation, then mode="off" one second later (present_begins asks effective_reflex_mode(fg_active && on, …), and on is false until the first upscaled frame), and the sleeps go on all the same:

Streamline: Reflex low latency mode mode="off" code=0 result="ok"
NVIDIA Reflex (off): 160 sleeps (5.97 ms/sleep)
NVIDIA Reflex (off): 161 sleeps (6.12 ms/sleep)

simulation_begin decides with reflex_active() → effective_reflex_now() → fg_will_be_on(), which does not look at calls.reflex_mode. So slReflexSleep runs, ~6 ms a call, while Reflex was set off. One source of truth (sleep only when the mode last sent is on or boost) would fix it. Once the flight starts it goes back to (on) with 0.01 ms sleeps.

Other things I saw reading it:

  • RENDER_SUBMIT_START takes its frame from PRESENT_BEGUN_FRAME + 1 (the host's presents), and SIMULATION_START/SIMULATION_END from the title's present count. With the line of submissions, the host's present count is behind the title's, so the markers of one frame id may come from different title frames. I haven't checked whether this is what makes sim-to-GPU 150-450 ms in the flight.
  • This rewrites present_begins, where #139 also changes how FgSnapshot is kept (applied on the maintainer's side): expect a conflict there.
  • "How it was tested" still has the template placeholders.

Gates on 47c37db: cargo clippy --workspace --all-targets --locked -- -D warnings and the same with --all-features: both passed. cargo test --workspace not run.

Not tested: boost, the F1 setting switched live, the F3 row on screen, frame generation off without Reflex, Series S, latency with an outside tool, cargo test --workspace.

Test report and review: RTX 5070 Ti, 3 runs of the bench kit's camera flight. **Setup.** RTX 5070 Ti 16 GB (NVIDIA 621.47), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26200. Both builds from source, `cargo build --release --locked -p darner --features bench-remote`: PR head `47c37db` and its base `main` `57dea7f`. The gta-bench-kit camera flight `cam-city60` (fixed save, 65 s route), Series X, 1440p, DLAA, hardware RT, DLSS frame generation 2x unless said. One run per arm, so the fps differences below are within the noise. | Run | Build | Switches | median fps (fast part) | slowest tenth | launch to flight | |---|---|---|---|---|---| | base | `57dea7f` | none | 11.84 | 7.48 | 68 s | | R159 | `47c37db` | none | 10.88 | 4.80 | 123 s | | R159_0on | `47c37db` | `DARNER_FRAMEGEN_X=0 DARNER_MENU_FRAMEGEN=0 DARNER_REFLEX=on` | 8.82 (frame generation off, no base run to compare) | 4.6 | 77 s | Two earlier base runs of the same build on this PC gave 9.77 and 12.15 fps, so R159 is inside base's range. The 123 s launch was B's first run on a shader cache copied from A's (the translator is unchanged); R159_0on on the same build launched in 77 s, so I don't tie it to the PR. **Standalone Reflex works.** Frame generation ready but off, `DARNER_REFLEX=on`: `Reflex low latency mode mode="on" code=0 result="ok"`, then `NVIDIA Reflex (on): …` lines once a second with sleeps and a PCL report: in the menus about 160 sleeps of ~6.1 ms with sim-to-GPU 0.6-1.5 ms; in the flight 6-11 sleeps of 0.01 ms (the title thread is the limit, so Reflex doesn't sleep), sim-to-GPU 150-450 ms with 33-38 ms of GPU active time. No warnings or errors from Streamline. **With DLSS frame generation and `DARNER_REFLEX` unset, the PR changes what `main` does.** `effective_reflex_mode(fg on, Off)` is `On`, so `simulation_begin` now calls `slReflexSleep` on the title thread every frame; `main` never calls it. The description says Reflex is off by default, but every frame generation run gets the sleep. **The mode sent and the sleeps disagree.** In R159 (frame generation 2x, no switch) the log shows `mode="on"` at device creation, then `mode="off"` one second later (`present_begins` asks `effective_reflex_mode(fg_active && on, …)`, and `on` is false until the first upscaled frame), and the sleeps go on all the same: ``` Streamline: Reflex low latency mode mode="off" code=0 result="ok" NVIDIA Reflex (off): 160 sleeps (5.97 ms/sleep) NVIDIA Reflex (off): 161 sleeps (6.12 ms/sleep) ``` `simulation_begin` decides with `reflex_active()` → `effective_reflex_now()` → `fg_will_be_on()`, which does not look at `calls.reflex_mode`. So `slReflexSleep` runs, ~6 ms a call, while Reflex was set off. One source of truth (sleep only when the mode last sent is on or boost) would fix it. Once the flight starts it goes back to `(on)` with 0.01 ms sleeps. **Other things I saw reading it:** - `RENDER_SUBMIT_START` takes its frame from `PRESENT_BEGUN_FRAME + 1` (the host's presents), and `SIMULATION_START`/`SIMULATION_END` from the title's present count. With the line of submissions, the host's present count is behind the title's, so the markers of one frame id may come from different title frames. I haven't checked whether this is what makes sim-to-GPU 150-450 ms in the flight. - This rewrites `present_begins`, where #139 also changes how `FgSnapshot` is kept (applied on the maintainer's side): expect a conflict there. - "How it was tested" still has the template placeholders. **Gates on `47c37db`:** `cargo clippy --workspace --all-targets --locked -- -D warnings` and the same with `--all-features`: both passed. `cargo test --workspace` not run. **Not tested:** `boost`, the F1 setting switched live, the F3 row on screen, frame generation off without Reflex, Series S, latency with an outside tool, `cargo test --workspace`.
Owner

Both findings are right. With DLSS frame generation and DARNER_REFLEX unset, effective_reflex_mode(true, Off) is On, so reflex_active() slept the title thread every frame, which main never did. And reflex_active() decided from fg_will_be_on(), not from the mode last sent, so it slept while Streamline had been told off.

Fixed on our main on top of the merge (c88549fc, not pushed yet):

  • reflex_active() (the slReflexSleep calls and the pace bypass) is now true only when Reflex was asked for (DARNER_REFLEX or F1) and the mode last passed to slReflexSetOptions is on or boost. The sent mode is kept in an atomic, so it is read without CALLS.
  • Frame generation alone still sets the driver's low-latency mode on, because it needs that, but there are no sleeps, as on main.
  • render_submit_begin now takes its frame id from queue::presented() + 1, the same count simulation_begin uses, instead of the host's last present + 1. That count runs behind the title's with the relay. A frame id's markers now come from one title frame.
Both findings are right. With DLSS frame generation and `DARNER_REFLEX` unset, `effective_reflex_mode(true, Off)` is On, so `reflex_active()` slept the title thread every frame, which main never did. And `reflex_active()` decided from `fg_will_be_on()`, not from the mode last sent, so it slept while Streamline had been told off. Fixed on our main on top of the merge (c88549fc, not pushed yet): - `reflex_active()` (the `slReflexSleep` calls and the pace bypass) is now true only when Reflex was asked for (`DARNER_REFLEX` or F1) **and** the mode last passed to `slReflexSetOptions` is on or boost. The sent mode is kept in an atomic, so it is read without `CALLS`. - Frame generation alone still sets the driver's low-latency mode on, because it needs that, but there are no sleeps, as on main. - `render_submit_begin` now takes its frame id from `queue::presented() + 1`, the same count `simulation_begin` uses, instead of the host's last present + 1. That count runs behind the title's with the relay. A frame id's markers now come from one title frame.
TrustNo1 manually merged commit cabbb1ce29 into main 2026-12-04 02:14:10 +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!159
No description provided.