Pace presents at the back edge, just before the host present

The pacer gave each frame its display time but the present thread queued vkQueuePresentKHR as soon as the game
handed the frame over, so every present shifted with the frame's replay time: at 60.0 fps mean, 17-18 ms intervals
alternated with 15-16 ms ones. The present thread now submits the blit at once (vk_present_blit, so
vk_present_drain and queue order are unchanged) and holds the host present until the pacer's slot
(vk_present_flip). Acquire keeps waiting until the image's slot plus one period, which is now the time the next
frame really goes out.

TOTK_TRACE=present logs one line per present: host interval, the game's present-call interval, wait and lateness.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Valiantsin DzerakhandClaude Opus 5.5 committed 2026-10-23 23:26:43 +03:00
1 parent 2d714537e7
commit ebdba400df
9 files changed
+97 -26

No files matched your search

+1 -1
View File
@@ -128,7 +128,7 @@ static int test_present(const GfxBackend *b, uint8_t *guest, int *w_out, int *h_
uint64_t frames = gfx_stats().frames;
vk_present_capture(1);
const int crop[4] = {0, 0, TEX_W, TEX_H};
b->present(&t, crop);
b->present(&t, crop, 0);
b->finish(); // the queued present is submitted and, with capture on, read back
const uint8_t *px;
int w, h;