mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-17 09:19:58 -04:00
Read occlusion query results in batches, and wait in the submit call for the game's signal that the frame's data is written.
Both are about the time between two frames. Ocarina waits for the previous frame's fence before it lets the next frame's GPU work start: its main thread signals an event from the CPU, and the main queue's commands begin with a wait for it. The completion thread ran a submission's callbacks before it let the submission's waiters go, and the occlusion counts were among them: one vkGetQueryPoolResults and one vkResetQueryPool per reported query, about a hundred queries a frame in Hyrule Field. On an RX 7900 XT (26.10.1) each call goes into the kernel, 3.9 ms of every frame, so the fence was reached 4 to 6 ms after the GPU had finished with every game thread waiting. Slots come from the ring in order, so one call now reads up to 256 slots from the one asked for, the available results are kept for the segments that follow, and the slots taken are reset in runs (vk_exec_xfer.c oq_take, NX2NAVI_OQ_BATCH). Standing in Hyrule Field at 3440x1440 with FSR: 52.7 fps against 44.6, the longest frame of the measured minute 46 ms against 55; the completion thread spends 0.3 ms a frame in the callback. When the CPU's signal came a millisecond or two after the main queue's submit call, the submission took its copies, stopped at the wait and was held; the render thread polled the event, presented, and the present replayed the frame under a value the game's fence does not stand for. The next frame then skipped its wait for the GPU and was replayed inside its submit call, and frames of 23 and 15 ms took turns. A submission that begins with a wait for an event the CPU has signalled before now waits for the signal in the submit call, before its copies are taken, 10 ms at most (vk_exec.c vk_exec_gate_wait, NX2NAVI_GATE_WAIT_MS): 54.5 fps and a longest frame of 33 ms in the same place, 58.6 fps with the recorder thread on. With a camera sweep the pictures went out 21.0 ms apart on average with a 99th percentile of 55 ms, against 25.4 and 64. A village went from 48.6 to 53.7 fps and a graveyard from 56.5 to 64.2. 900 consecutive frames of a still scene show no dark or changed frame, with the recorder thread and without. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
@@ -242,6 +242,11 @@ extern int vk_exec_signalled; // set by every replayed SignalEve
|
||||
// Events the CPU signals (vk_exec_xfer.c "events the CPU signals").
|
||||
void vk_exec_event_cpu(const void *event); // any thread: nvnEventSignal is about to write the event's value
|
||||
void vk_exec_event_sync(int begin); // vk_exec_record: its mirror sync and uniform copy are taken now / it ends
|
||||
int vk_exec_event_cpu_known(const void *event); // the CPU has signalled this event before
|
||||
int vk_exec_event_holds_now(const void *payload); // an OP_WAIT_EVENT's condition on the value in memory now
|
||||
// vk_backend.c submit_sync, before a submission is recorded: waits for the CPU's signal when the submission begins
|
||||
// with a wait for it (vk_exec.c "the gate").
|
||||
void vk_exec_gate_wait(const uint64_t *handles, int n);
|
||||
int vk_exec_event_at_sync(void); // NX2NAVI_EVENT_AT_SYNC
|
||||
uint64_t vk_exec_event_late_take(void); // waits only a CPU signal after the copies would have passed, since the last call
|
||||
// Since the last call, which resets them: waits, waits reached before their signal, those of them a later replayed
|
||||
|
||||
Reference in New Issue
Block a user