From d4cf889a912884d1eb4e495e45a458e38f5689d2 Mon Sep 17 00:00:00 2001 From: chrg6 Date: Tue, 10 Nov 2026 11:48:22 -0500 Subject: [PATCH] Do not count a stale texture pool slot as left for later. A slot whose storage is unmapped has nothing to make, but with the creation budget at 0 the lookup noted it as left before asking whether its storage can be read. In a busy frame, once the frame's creation time was spent, about a thousand stale slots were noted at once, and the pool refresh took that for an area load: up to 274 times a minute in one session's log, each time lifting the count budget and the frame's creation time for the rest of the frame. Co-Authored-By: Claude Fable 5.2 --- runtime/vk_texture.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/runtime/vk_texture.c b/runtime/vk_texture.c index 2f2f2723..e9fc6390 100644 --- a/runtime/vk_texture.c +++ b/runtime/vk_texture.c @@ -2693,8 +2693,13 @@ static Tex *slot_resolve(TexSlot *s, view_t *view, int *has_view) { // evicted by disuse: the pool refresh keeps the stand-in, without spending the creation budget on it if (pool_ctx && holds.n && nvn_hm_get(&holds, &k)) resolve_held = 1; else if (create_budget < 0) e = entry_of(&s->t); + // Unmapped storage first: such a slot has nothing to make, now or later. Asked after the budget, every stale + // slot a refresh met with the budget at 0 was noted as left: in a busy frame (its creation time spent) that + // was about a thousand slots at once, which vk_exec_draw.c pool_sync_entries took for an area load, several + // times a second in some places, and each time lifted the count budget and the frame's creation time. + else if (!mem_readable((uint64_t)(uintptr_t)s->t.mem, s->t.L.size)) e = NULL; else if (!create_budget && !(s->cwant && want_take())) create_deferred = 1; - else if (mem_readable((uint64_t)(uintptr_t)s->t.mem, s->t.L.size)) { + else { e = entry_of(&s->t); if (create_budget > 0) create_budget--; }