Hand the draw context down in the replay state instead of reading it from a thread-local at every call.

Reading the thread-local pointer in the functions that run per binding and per descriptor cost about 0.3 ms of
replay a frame in Hyrule Field (45.0 against 45.8 fps). VkExec.dc now names the context; the draw and look-ahead
entry points fill it from the calling thread's on first use, the functions that hold the state read it from there and
the few helpers without it take it as a parameter. A replay worker's copy of the state carries the worker's context.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
epicmeme546
2026-11-11 15:25:00 -05:00
committed by chrg6
parent 3010a637bf
commit 4fc32e8d84
3 changed files with 63 additions and 58 deletions

View File

@@ -45,6 +45,8 @@ void vk_exec_cond_why(const p_render_cond *c, char *buf, size_t cap); // NX2NA
// the next. The "per command buffer" fields are reset by vk_exec_record.
typedef struct VkExec {
// ---- per command buffer
struct DrawCtx *dc; // vk_exec_draw.c: the draw context this state records with (NULL until a
// draw op names it: the calling thread's, vk_exec_draw_ctx_use)
VkCommandBuffer cb; // being recorded
uint64_t fence; // timeline value the submission signals (vk_completion_add)
int recorded; // Vulkan commands recorded so far; every handler adds the ones it records