Mesh emulation: cut the part at a pass's first emulated draw instead of splitting it, so the texture pool set stays.

A split hands the part to the queue and seals its texture pool set; the next part takes another set of the ring and
refreshes its entries first. The splits for the mesh stages made 5 parts a submission and 6 set switches a frame at
2.3 ms of replay each (Kokiri Forest on 0.7.1, an RX 580: replay 32-38 ms a frame, the replay thread blocked on fences
26-35% of the time, 79 waits for a set the GPU still used). A cut (vk_sync_cut) ends the command buffer without
submitting it: the part and its pre-pass command buffer wait in a chain and go to the queue, in order, with the next
part that does, so the set is the same one throughout.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Tobim6
2026-11-12 16:22:37 +01:00
parent 55ab90c66e
commit 38a3824b8f
5 changed files with 77 additions and 15 deletions

View File

@@ -753,6 +753,9 @@ void vk_sync_worker_end(VkCommandBuffer cb);
// The part's pre-pass command buffer: submitted right before the part being recorded (after its mirror prologue), begun
// with a full barrier at the first call of a part; VK_NULL_HANDLE when it cannot be made. Replay thread, sub_lock held.
VkCommandBuffer vk_sync_pre(void);
// Ends the part being recorded without handing it to the queue (it goes with the next part that does, in order) and
// returns the command buffer the replay continues in; VK_NULL_HANDLE when no more parts can wait. Replay thread.
VkCommandBuffer vk_sync_cut(void);
extern int vk_sub_in_frame; // replay: the submission being recorded is the frame's n-th (0 the first; vk_backend.c)
// Runs fn(arg) on the completion thread once fence is done on the GPU (event writes, counter reports, sync state).
// Callbacks run in the order they were added, after those of earlier values; a value already done runs at once there.