Skip to content

GPU: a present waits for the previous frame's submissions, not its own - #5

Closed
Jitheswar wants to merge 1 commit into
wbkepler:gpu/async-submissionsfrom
Jitheswar:claude/595-present-frame-lag
Closed

Jitheswar wants to merge 1 commit into
wbkepler:gpu/async-submissionsfrom
Jitheswar:claude/595-present-frame-lag

Conversation

@Jitheswar

@Jitheswar Jitheswar commented Nov 24, 2026 •

Copy link
Copy Markdown

For Marvisak#595 (Marvisak/VIctory), on top of your dfac3b4. One commit.

What: Host::present waits for the previous frame's submissions instead of draining all of them after Present. It settles the newest submission recorded at the last present (that frame's copy included) before it resets and reuses the copy list, then leaves the current frame running.

  • ResizeBuffers still drains.
  • A saved capture (VICTORY_CAPTURE) settles its frame before the read-back.
  • The copy list now keeps the presented texture, because the title may release it while the copy is still running. Before, the drain hid this.
  • Diagnostics: the black-frame probe is read at the next present, once its frame has finished, and blinks reports it with that frame's own number, resource and draws.

Why: this is the condition in the shortcut: comment. The title waits for its fences, not for the present. Its submission thread (+0x2481e90) calls ExecuteX, then PresentX, then Signal, and only after that returns ring slots to the producers main waits on (traced in Marvisak#1118, comment). With the drain, that thread sat in PresentX for the frame's whole GPU time, so the Marvisak#1118 stall moved from ExecuteX to PresentX.

Test: host::submissions::a_present_waits_for_the_previous_frame_not_its_own holds a submission on the GPU with your Gate. It checks that "presenting" the frame leaves the submission running with its bottom-of-pipe write not yet done, and that the next frame's present finishes it. It drives the two helpers present uses (frame_done, previous_frame), because present itself needs a swap chain.

Checked on RTX 3050 6 GB Laptop, Linux, Proton 11.0 (vkd3d-proton), real device:

Reviewed by a second agent before opening; it caught the texture lifetime and the blinks pairing.

🤖 Generated with Claude Code (with Codex and Antigravity). No game data included.

Grand Theft Auto VI submits from one thread: for each batch it calls
ExecuteX, PresentX and Signal, and only then gives its ring slots back
to the producers its main thread waits on (Marvisak#1118). With submissions
asynchronous, `Host::present` still drained every submission after
`Present`, so that thread waited for the frame's whole GPU time inside
PresentX. The title waits for its fences, not for the present, so the
shortcut's condition holds: a present now finishes the previous
frame's submissions (and its copy, whose list it reuses) before it
records this frame's, and leaves this frame's running. ResizeBuffers
still drains; a saved capture settles its frame before reading it back.
The copy list now holds the presented texture, since the title may
release it while the copy still runs.

Diagnostics: the black-frame probe of a frame is read at the next
present, once that frame's work has finished, and reported with that
frame's own number, resource and draws.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant