Reflex: one present ID per frame from its start to its present; mode again on a new swapchain; presentId feature

The latency markers and the present carried different present IDs: g_reflex_present_id went up only in flip_locked, so
frame k's simulation, input and submits had ID k and its present k+1 (and with frame_queue or replay_async frames could
share one). Each frame now gets its ID once, when the game acquires its window texture (SIMULATION_START,
vk_reflex_frame_begin), and carries it: INPUT_SAMPLE and SIMULATION_END take the game's current frame, a submission
the frame of the thread that submits it (the game thread's, or the one the replay thread got with its ReplayItem, or
the present thread's from its PresentJob), and the present the frame of its blit (PresentJob.pid -> g_flip_pid). A
present without a frame ID takes the next value, as present IDs must grow on a swapchain.

From the review: a new swapchain sets the sleep mode again (it starts with low latency off), Reflex is off without the
presentId feature, REFLEX sorted in known[], and the ru and pt-BR descriptions name the Boost option as the menu does.

TOTK_TRACE=perf logs every 600 presents the frame start to present time, and with Reflex on how many of the driver's
reports (vkGetLatencyTimingsNV) came back with every marker and their simulation start to GPU render end.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
itaskaev2andClaude Opus 5.5 committed 2026-11-10 18:20:16 +01:00
1 parent 41623cec85
commit 6d6b66461b
9 files changed
+123 -31

No files matched your search

+3 -3
View File
@@ -477,7 +477,7 @@ uint64_t vk_sync_submit(const uint64_t *handles, int n) {
VkLatencySubmissionPresentIdNV lsid = {
.sType = VK_STRUCTURE_TYPE_LATENCY_SUBMISSION_PRESENT_ID_NV,
.pNext = NULL,
.presentID = vk_reflex_current_present_id()
.presentID = vk_reflex_submit_id()
};
VkSubmitInfo2 si = {.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO_2,
.pNext = (c->has_nv_reflex) ? &lsid : NULL,
@@ -485,9 +485,9 @@ uint64_t vk_sync_submit(const uint64_t *handles, int n) {
.pCommandBufferInfos = pro ? cbi : cbi + 1, .signalSemaphoreInfoCount = 1,
.pSignalSemaphoreInfos = &sig};
ts_submitted();
if (recorded && c->has_nv_reflex) vk_reflex_marker(2); // VK_LATENCY_MARKER_RENDERSUBMIT_START_NV
if (recorded && c->has_nv_reflex) vk_reflex_marker(2, lsid.presentID); // VK_LATENCY_MARKER_RENDERSUBMIT_START_NV
VkResult r = rec_submit(&si); // by the recorder when it recorded the part
if (recorded && c->has_nv_reflex) vk_reflex_marker(3); // VK_LATENCY_MARKER_RENDERSUBMIT_END_NV
if (recorded && c->has_nv_reflex) vk_reflex_marker(3, lsid.presentID); // VK_LATENCY_MARKER_RENDERSUBMIT_END_NV
if (r != VK_SUCCESS) {
vk_device_fault_report(r);
rt_fatal("vk: vkQueueSubmit2 of value %llu failed (%d)", (unsigned long long)fence, (int)r);