mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-20 08:19:56 -04:00
Keep samples-passed counters inside parallel groups, and lock the shared tables only while a chunk records.
Samples-passed resets and reports ended most groups in Hyrule Field (the game reports twice without a reset there, so counting stays on): the front pass now replays them in the order of the stream, makes each occlusion segment and queues its completion callback in that order, and each worker follows the counting from its chunk's first op and adds the queries it closes to the segment the stream gives them. Per-object motion takes a lock instead of waiting for the earlier chunks: its list's order does not change the picture. The locks the chunks share are taken only inside a chunk, as outside groups the submitting thread alone replays; taken always, they cost the replay about 1 ms a frame. The perf line counts the draws by what ended their group. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -435,13 +435,14 @@ static PlatMutex drop_lock = PLAT_MUTEX_INIT; // the replay workers' shaders w
|
||||
|
||||
void vk_usnap_drop(uint64_t addr, uint64_t n) {
|
||||
if (!U.mode || !n) return;
|
||||
plat_mutex_lock(&drop_lock);
|
||||
int lk = vk_exec_in_chunk();
|
||||
if (lk) plat_mutex_lock(&drop_lock);
|
||||
if (U.nwr == U.cwr) U.wr = grow(U.wr, &U.cwr, sizeof *U.wr);
|
||||
U.wr[U.nwr++] = (Wrote){addr, addr + n, U.fence};
|
||||
if (U.on)
|
||||
for (int i = first_above(addr); i < U.nreg && U.reg[i].lo < addr + n; i++)
|
||||
if (!U.reg[i].dropped) U.reg[i].dropped = 1, U.drops++, __atomic_add_fetch(&U.gen, 1, __ATOMIC_RELAXED);
|
||||
plat_mutex_unlock(&drop_lock);
|
||||
if (lk) plat_mutex_unlock(&drop_lock);
|
||||
}
|
||||
|
||||
uint64_t vk_usnap_gen(void) { return U.gen; }
|
||||
|
||||
Reference in New Issue
Block a user