mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-20 21:09:57 -04:00
Wake the recorder once per sleep, stop its idle spinning, and skip per-draw work in the replay that repeats.
From the replay review of a profiled session: - vk_rec.c: the producer set the wake event for every packet until the recorder had cleared its sleeping flag, a system call per packet on the submit thread for as long as the recorder took to wake; it now takes the flag back itself and sets the event once. A sleep that ended with nothing new was followed by another 4096-pause spin, every 2 ms for as long as the game was idle or paused; the recorder now sleeps again at once. head, tail and the producer's words are on cache lines of their own, and the producer reads tail only when the ring looks full by the value it last saw. - vk_exec_draw.c c0_info: a vertex or fragment bank depends on the storage slots and the base instance alone, so those are compared directly instead of clearing, filling and comparing a 1.8 KiB record on every draw. - vk_exec_draw.c bind_vertex_buffers: a draw that changes no vertex stream returns before the 17 streams are rebuilt and compared. - vk_exec_draw.c bind_resources: the texture lock is taken at the first texture descriptor that has to be resolved, not for every texture binding whose descriptors are all kept. - vk_usnap.c vk_usnap_find: the region the last lookup hit is tried before the binary search. None of this changes what is recorded. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> (cherry picked from commit 8eac567e2a9a353f894f3c66e3fc20fd2c0d295d)
This commit is contained in:
@@ -313,7 +313,11 @@ static int first_above(uint64_t a) {
|
||||
|
||||
int vk_usnap_find(uint64_t addr, uint64_t n, uint64_t align, VkDescriptorBufferInfo *out) {
|
||||
if (!U.on || !n) return 0;
|
||||
int i = first_above(addr);
|
||||
// Consecutive bindings mostly name the region the last one did: that one is tried before the binary search. The
|
||||
// regions are sorted and disjoint, so the region that holds addr is the one first_above finds.
|
||||
static int hint;
|
||||
int i = hint;
|
||||
if (i >= U.nreg || addr < U.reg[i].lo || addr >= U.reg[i].hi) i = first_above(addr);
|
||||
if (i >= U.nreg) return 0;
|
||||
const Reg *r = &U.reg[i];
|
||||
if (r->dropped || addr < r->lo || addr + n > r->hi) return 0;
|
||||
@@ -321,6 +325,7 @@ int vk_usnap_find(uint64_t addr, uint64_t n, uint64_t align, VkDescriptorBufferI
|
||||
if (off % align) return 0;
|
||||
*out = (VkDescriptorBufferInfo){U.arena->buf, off, n};
|
||||
U.hits++;
|
||||
hint = i;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user