Queued presents: the title's present goes into its queue's line and returns; our thread shows the frame in order, at most N waiting (VICTORY_PRESENT_QUEUED=1|2, off by default) #1136
No reviewers
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!1136
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1136"
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?
@exotiquee on GitHub · 2026-11-25 21:23 UTC · original
exotiquee:pr/present-queued→main· +1050 −102 · 2 files · 2 commits · openBranch
pr/present-queuedonmainc36971b, two commits:release_held_now's loop becomeswalk(&Queues, all, joining)over a smallLinestrait. The trait covers the lines, fences, memory values, the host's send / run / present, and signals.Queuesis the code that was inline, unchanged, diagnostics included. Tests can now run the walk on lines of their own and record what left them, in which order.VICTORY_PRESENT_QUEUED=1|2).Why this is not
VICTORY_ASYNC_PRESENTThe README notes that putting presents behind the line changed nothing.
VICTORY_ASYNC_PRESENT=1lets only one present wait behind the line: the next present finds it still there and runs the lines on the title's thread the old way, so the title still stands at every second present, and the other queues are not ordered behind the frame. This change lets up to N presents wait (marks in every other line keep the frame order) and never runs the lines on the title's thread; the measured present wait below is the difference.What it does
With
VICTORY_ASYNC_SUBMIT=1+VICTORY_JOIN_PARTS=1, a profile showed the title's render thread on a processor only 4 % of the time. It stood about 42 ms of each frame inpresent -> present_now -> release_held_now -> the one-releaser lock. The present ran the lines itself, so it waited until our thread had prepared and sent the whole frame. Our thread meanwhile sat idle about as long (39 ms a frame inqueue::worker). The two threads took turns.With
VICTORY_PRESENT_QUEUED=N:queue_presentputs a mark (Held::Mark(frame)) into every other line that holds anything. It then putsHeld::Presentinto the present's own line, wakes the worker and returns. If N presents are already in the lines, the call stands until the oldest has been shown (aSHOWNcondvar, like a swap chain's frame latency).marks):forces()).VICTORY_ASYNC_PRESENT=1is left as it was.Switch
VICTORY_PRESENT_QUEUED=1or2(the bound), off by default. It needsVICTORY_ASYNC_SUBMIT=1and presents sent ahead (the relay, orVICTORY_LATE_WAIT=3). Without them it logs a warning and stays off. With the switch off, every path is as before.How it was tested
cargo +1.98.1 test --locked -j 4 -p victory-gpu(WARP and RTX 5080 tests run automatically): 193 passed, 0 failed, 5 ignored. With--features diagnostics: 210 passed, 0 failed, 6 ignored (several runs).New tests (
queue::join_tests, the walk on lines of its own):VICTORY_JOIN_MOSTparts go together;a_queued_present_runs_and_shows_what_the_present_ran_and_showed. 10,000 things in 110 rounds, with 1-4 queues and over 1,000 presents: parts, signals, fence waits, value waits met by earlier parts, and waits nothing meets. Queued presents give exactly the runs, signals and present sequence of the present that ran the lines itself.queued_presents_keep_the_frame_order_and_the_bound. The title runs ahead (lines run now and then, joined or not, bound 1 and 2, 200 rounds). Checked:Known flaky upstream test, also on plain
main:indirect::tests::warp_budget_saturates_without_wraparound_and_preserves_draw_fields, a WARP race between the budget's two groups. It failed in some runs here and passed on rerun, as it does onmain.One
--features diagnosticsrun printed no result line (the test process seems to have ended early). It did not happen again in 7 reruns, and the cause is unknown.What we measured (RTX 5080, Ryzen 7 9800X3D)
Measured in our own tree (fork base plus our other switches, including a send station that is not part of this PR), not on this exact branch:
So the measured effect is the title's present wait (42 → 0.5 ms). The frame rate effect is not established beyond scene variance.
Risks
🤖 Generated with Claude Code
@UwUCammie on GitHub · 2026-11-25 21:55 UTC · original
I tried queue depth 1 on an RX 7900 XT (RADV 26.3.1, Wine 11.22). In the first room the host meter counted 639 presents in 73.27 seconds, or 8.72 FPS at 4,864 draws per frame. The same route with the preceding build and synchronous presents averaged 9.11 FPS at 4,832 draws per frame. One pass each.
The queue was active throughout. In the last 256-frame report all 256 went through the queue, with one frame in flight at most. The title spent 4.3 ms per frame in the present call, almost all of it waiting for the earlier frame. The shorter call didn’t translate into higher throughput in this run.
@Filip722 on GitHub · 2026-11-26 18:07 UTC · original
I tested a local port of #1136 on Bazzite 44, RTX 5060 Laptop 8 GB, NVIDIA 615.78.08, GE-Proton11-14, and vkd3d-proton 3.2.0 (cae8353ed7959c4+). The two Series S runs used the same executable, initial caches, offline checkpoint, async submission and relay. The only launch difference was VICTORY_PRESENT_QUEUED=1. Both counts use the frame identifier of the completed DXGI Present.
These are single-run measurements from the same stationary view and elapsed window with median pending pipelines at zero. Startup differed before that window, so I would treat the early timing and VRAM difference as observations. The nine focused queue tests passed under Proton. Depth 2 remains untested on this laptop.
Assisted by Codex (GPT-6.2-Sol High).
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.