NVIDIA Reflex: latency markers and low latency mode (Streamline PCL or NvAPI), feasibility and phases #729
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/fxceless--victory-fork#729
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@Revens2 on GitHub · 2026-11-25 05:48 UTC · original
Problem
NVIDIA Reflex reduces the time between an input and the frame it changes by pacing the CPU against the GPU queue (low latency mode, an optional boost, and a sleep placed before the simulation of a frame) and by letting the driver and tools see latency markers. The title is a console game and has no Reflex calls. The fork owns the host D3D12 device, queue, present and the frame clock the title waits on, so it could add Reflex itself. This issue studies whether that is worth doing and how, in phases.
Related work (checked 2026-11-25; searches: reflex, latency, streamline, nvapi, low latency)
No issue or PR in this repository mentions Reflex, NvAPI or Streamline's PCL. Related upstream work (Marvisak/VIctory, not this repository):
VICTORY_DLSS_DIR; manual hooking on the host device; swap chain made through Streamline's proxy factory.VICTORY_DLSS_FGthere are no markers and no Reflex. So Reflex exists there only as a requirement of frame generation, not as a feature of its own.If #1704 is ported to this fork, Streamline will already be loaded and Reflex becomes a small addition; if not, NvAPI alone is enough. This issue should be coordinated with the upscaling issue so the two do not each load their own copy of the NVIDIA runtime.
Current state of the code (
origin/mainat310c6eb)Points where markers and a sleep could attach, all in
crates/:victory-gpu/src/frame.rs,waitfor event kind 0 (origin) hands out the frame token (FRAMEcounter) and returns when the title may start a frame. This is the natural place for a Reflex sleep, because the title already blocks there.victory-gpu/src/queue.rsreceives the title's command lists and executes them on the host queue;host.rshas the first/last submission of a frame (FINISHEDcounter,settle_now).host.rs,Presenter::present(copy into the back buffer,Present(0, 0)), thenMeter::frame.victory-hle/src/modules/gameinput.rsreads XInput andGetAsyncKeyStatein a polling loop (POLL= 8 ms) and hands the readings to the title when it asks. That is where an input marker would be taken.Host'sdeviceandqueue); nothing in the tree loadsnvapi64.dll,sl.interposer.dllor any NVIDIA runtime today.What the fork cannot see: which of the title's threads simulates, which renders, and when the simulation of frame N ends. It sees the origin wait, the command lists and the present. Markers for simulation start/end would therefore be approximations (origin wait end, first submission), not the title's real simulation window.
Two ways in
A. Streamline (PCL + Reflex plugins). Public NVIDIA SDK on GitHub; its headers are reported MIT-licensed in Marvisak/VIctory#1704's description (not re-verified here). Runtime
sl.interposer.dlland plugins loaded from a user-provided folder, not shipped in the tree. Requires the Streamline initialisation and, for markers to be consumed correctly, the manual-hooking path (slSetD3DDevice, proxy swap chain), which #1704 already had to solve. Heavier, but shared with DLSS.B. NvAPI directly.
NvAPI_D3D_SetSleepMode,NvAPI_D3D_Sleep,NvAPI_D3D_SetLatencyMarker,NvAPI_D3D_GetLatencyon the host device, resolved from the driver'snvapi64.dll(installed with the NVIDIA driver, so nothing to ship). Smaller and independent of upscaling. The licence of the NvAPI headers needed for bindings is not verified; a hand-written minimal binding of the few entry points (queried throughnvapi_QueryInterface) avoids the question but would need review.Both are NVIDIA-only. The host already identifies the adapter (see #261 for adapter selection, a PR); the feature must be a no-op on other vendors.
Proposal, in deliverable phases
nvapi64.dllon the host, callSetSleepModeon the host device in a test (thevictory-gputests already create a real device), report which calls succeed on which driver. Output: a short table in this issue.VICTORY_REFLEX=markers): input sample, simulation start (origin wait end), render submit start/end, present start/end, with the frame token as the frame id. Observable throughNvAPI_D3D_GetLatencyor PCLStats-compatible tools. No pacing change.VICTORY_REFLEX=on):SetSleepMode(low latency on, boost off) andSleepplaced inframe::waitfor the origin event, so the title's own wait absorbs it. Never sleep on a timed poll (timeout_ms == 0); only on the blocking wait.Risks
frame::waitchanges the title's cadence. The intro movie is already sensitive to presents without a flip wait (#457, #602); movies and menus should be excluded or tested separately.nvapiheaders are not verified; nothing in the tree may be added before that is clear.Acceptance criteria (measurable)
NvAPI_D3D_GetLatency(or PCLStats) returns frame reports for at least 95 % of the presented frames of a 60 s run in the menu; withVICTORY_REFLEXunset the build and behaviour are identical to main (frame count and present interval within noise).device removedover a 10 minute run;cargo test --workspace --lockedstays green; non-NVIDIA hosts unchanged.Not verified
Next step
Phase 0 is a small spike and can be a PR of tests only. A PR will follow if the spike works; phases 1 and 2 wait for the decision on Streamline vs NvAPI.
@Revens2 on GitHub · 2026-11-25 05:48 UTC · original
Sibling issues opened together: #727 (settings/menu), #728 (frame pacing and latency), #729 (Reflex), #730 (upscaling), #731 (frame generation). Overlaps are named in each body; this set should stay split by subject.