Hold each frame's start in the driver while low latency is on, and let that keep the frame limit.

The driver's sleep sits where the game's frame starts: at its first pad read or window image acquire after a present,
whichever comes first, before the input is sampled. The frame's number, the count of the game's presents, goes with
its work: the guest thread marks the simulation and the first submission, the replaying thread tags its queue
submissions and marks their end, and the present thread marks the host present, which carries the number too. The
window's swapchain is made with the latency mode while NVIDIA's path is on, and remade when the setting changes.

While the mode is in effect the pacer holds nothing, so a picture goes out as soon as it is drawn and the limit is
kept by the driver before the pad is read; RivaTuner Statistics Server is kept out as with frame generation. The pacer
takes the limit back while a movie plays, while no host present goes out, and for the rest of the run when the frames
show the driver does not hold it. With the mode off every hook returns at its first check.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
chrg6
2026-11-12 22:28:32 -05:00
parent 2f30f1a2e5
commit c37fb7dc40
8 changed files with 86 additions and 5 deletions

View File

@@ -172,6 +172,14 @@ typedef struct {
// and the GPU's): the back end may hold it longer (vk_dlssg.c vk_dlssg_frame_start, Reflex's sleep for DLSS Frame
// Generation). NULL: nothing to do.
void (*frame_start)(void);
// The game is about to read its pad (ov_input.c npad_states), several times a frame: where the pad read is the
// first thing a frame does, the back end holds the frame's start here, before the input is sampled (vk_lowlat.c
// vk_lowlat_frame_start). NULL: nothing to do.
void (*input_read)(void);
// nvnQueuePresentTexture, with the pacer's period in ns (0: it holds nothing): 1 when the back end holds the next
// frame's start to that period itself (vk_lowlat.c vk_lowlat_pace, a driver's low-latency sleep), so the pacer
// waits for neither the present's slot nor the window image. NULL: never.
int (*frame_paced)(uint64_t period_ns);
void (*finish)(void);
void (*read_texels)(const tex_t *t, const view_t *v, const NVNcopyRegion *r, uint8_t *dst, uint64_t row, uint64_t img);
void (*write_texels)(const tex_t *t, const view_t *v, const NVNcopyRegion *r, const uint8_t *src, uint64_t row, uint64_t img);