Make the replay's Vulkan calls on a recorder thread: each vkCmd* into the replay command buffer becomes a packet in a ring that the recorder makes in order, every other command buffer is called at once, and the submit waits for the ring to empty. Town on an RX 9070: replay 9.98 -> 8.29 ms a frame (in-launch A/B), no new validation messages, same picture

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Valiantsin DzerakhandClaude Opus 5.5 committed 2026-10-28 16:41:46 +03:00
1 parent 48dfe0cfdf
commit 3fb4b8d4b9
10 files changed
+756 -12

No files matched your search

+6
View File
@@ -290,6 +290,7 @@ static VkCommandBuffer prologue(VkCtx *c, uint64_t fence) {
VkCommandBuffer vk_sync_split(void) {
VkCtx *c = vk_ctx();
VkCommandBuffer cb = slots[cur_slot].cb;
rec_end(); // every command of the part is in cb
ts_end(cb, cur_fence);
vkEndCommandBuffer(cb);
vk_upload_flush(0); // the uploads this part asked for precede it in queue order
@@ -308,6 +309,7 @@ VkCommandBuffer vk_sync_split(void) {
.flags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT};
vkBeginCommandBuffer(s->cb, &bi);
ts_begin(s->cb);
rec_begin(s->cb);
return s->cb;
}
@@ -335,8 +337,10 @@ uint64_t vk_sync_submit(const uint64_t *handles, int n) {
uint64_t t0 = perf_begin();
vkBeginCommandBuffer(s->cb, &bi);
ts_begin(s->cb);
rec_begin(s->cb);
int recorded = vk_exec_record(s->cb, handles, n, fence);
s = &slots[cur_slot]; // the last part (vk_sync_split)
rec_end();
if (recorded) ts_end(s->cb, fence);
else ts_drop();
vkEndCommandBuffer(s->cb);
@@ -363,6 +367,8 @@ uint64_t vk_sync_submit(const uint64_t *handles, int n) {
__atomic_store_n(&issued, fence, __ATOMIC_RELEASE);
WakeAllConditionVariable(&cv_work);
ReleaseSRWLockExclusive(&st_lock);
static unsigned subs;
if (++subs % 4096 == 0) rec_stats_log();
ReleaseSRWLockExclusive(&sub_lock);
return fence;
}