Present queue: VICTORY_PACE shows every frame for the same number of refreshes (on top of #1988) #2201
No reviewers
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
good first issue
help wanted
input
INTEL
invalid
lighting
linux-proton
memory
needs-info
needs-logs
needs-rebase
NVIDIA
performance
pr-diagnostics
pr-docs
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
rendering
report
series-s
shaders
spam
startup
upstream
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/trustno1-coder--VIctory-NVIDIA!2201
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2201"
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?
@Anorak-314 on GitHub · 2026-11-29 10:27 UTC · original
Anorak-314:present-pace→main· +644 −7 · 1 files · 3 commits · openStacked on #1988. This branch is #1988's branch (updated to main at
829188e9) plus two commits, and only those two are new:9057375f(a trace of the presents) and30018655(the pace). It needs the present queue, because the pace is kept by the thread that presents.What it changes
What was wrong. With the swap chain on a queue of its own (#1988), a frame is presented when the card has drawn it, and frames come out of the card at uneven times: on an RTX 5090 at a 3840x2160 scene, every 28 ms at the median, 24 ms at the fifth percentile and 35 ms at the ninety-fifth. A display without variable refresh shows each frame for as many refreshes as that happens to take (at 240 Hz, five to nine of them), which reads as judder although the average is higher than before. I noted that in #1988 after it was opened; this is the answer to it.
The change (
crates/victory-gpu/src/host.rs, modulepresent_aside; nothing changes without the variables):VICTORY_PACE=<n>: every frame of the scene is shown fornrefreshes of the display. The thread that presents waits for the card to have drawn the frame, then presents it right after the refreshnafter the one of the present before, with a present that cannot tear. A frame that is late is presented at once and the count goes on from it. The thread that submits waits for the present before, as it does without a pace, so the title is held to that rate. Frames of fewer than 200 draws (menus, loading screens) are not paced.VICTORY_PACE=auto: the count is chosen while running. It starts at the count nearest 30 frames a second and looks every 192 frames: more than a quarter of them late, one refresh more (the stutters at a change of scene are fewer than that); now and then it tries one refresh fewer, keeps it if no more than a sixth of the frames are late, and otherwise goes back and waits twice as long before the next try.VICTORY_PRESENT_TRACE=<file>: one line a present (frame, handed over, the wait for the present before, the copy begun,Presentcalled and returned, the swap chain's present and refresh counts), in microseconds. The frame-times line counts the submitting thread's hand-over, which with the present queue is not when the frame is presented; the numbers below are from this trace.How it differs from the frame clock (
VICTORY_FRAME_INTERVAL_US, #269, #2077): that sets when the title's frames begin; this sets when finished frames are shown, counted in refreshes of the display, and it finds the count the frames keep up with.What it costs. The average. A pace is the next whole number of refreshes the frames keep up with, so the frame rate goes down to it (here from about 32 to 29 a second). It does not remove the long frames at a change of scene either; those are presented late and the count goes on.
How it was tested
VICTORY_PRESENT_QUEUE=1in every run.829188e9, two runs each:Presentreturned every (median; 5th to 95th percentile)VICTORY_PACE=auto)autokept 8 in both runs; it went to 9 only for the changes of scene at the start.auto: 30.0 frames a second, 99 % of the frames on the screen for exactly 8 refreshes,Presentreturned every 33.3 ms (33.1 to 33.5, the longest 34.6), against 34.8 frames a second unpaced with frames 23.6 to 34.7 ms apart;autoexists;auto: it settles on 7 refreshes, 33.4 frames a second, 85 % exact, against 38.0 frames a second unpaced with frames 23.5 to 31.8 ms apart. A fixed pace of 6 (40 a second) does not hold there.cargo testpassed for the crates it touches: all but two tests that fail now and then on main as well.cargo test --release -p victory-gpu, three full runs here: 913, 913 and 914 of 915 passed. The failures arehost::card_steps::tests::shared_scratch_eliminates_flight_settle_end_to_endand...::places_written_after_sending_are_learned(counts read back from the card). On main at829188e9alone the first of them failed in one of two full runs, and each passes 3 of 3 times when run by itself on this branch.cargo clippy -p victory-gpureports nothing in the module.Not tested: displays at 60, 120 or 144 Hz (
autotakes its start from the refresh it measures), variable refresh, HDR output, frame generation (the present queue is left out there, and the pace with it), and moving the window to another display while running (the display is asked once for each swap chain).Checked for overlap
🤖 Generated with Claude Code
d8441650c8' into present-pace f216cf31efView command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.