mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-18 11:09:56 -04:00
Replay the game's queues in the order their events allow, so Link and the other characters are no longer drawn too dark.
Ocarina runs compute work on a second queue that trades results with the main one through events: the worker's command buffers wait (WaitEvent) for signals the main queue gives in its submission a few submits later, and the main queue waits for the worker's signals in turn. Replayed one submission after the other, the worker's steps ran before the work they wait for and read the previous frame's results, and the characters came out much too dark at any time of day (Kokiri Forest: about 13 waits a frame, 7 of them reached before their signal). A top-level wait whose condition does not hold in replay order now stops its submission: the rest is held, with private copies of its recordings and the queue's state, and the queue's later submissions line up behind it. After each replayed signal the held work whose wait now holds goes on inside the command buffer being recorded, between full barriers, with its own state swapped in. Work still held after 36 submissions goes on regardless, as before (counted in the NX2NAVI_TRACE=perf line). The queue reaches the back end as gfx_submit_queue. Only with the replay on the submitting thread; NX2NAVI_EVENT_ORDER=0 turns it off. Tested by play in adult Hyrule Field with the tree fix of the previous commit: Link lit normally at dusk and at noon, trees steady, lighting otherwise unchanged. The white specks in the grass remain (they predate both changes). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -136,6 +136,7 @@ typedef struct {
|
||||
void (*texture_release)(const tex_t *t);
|
||||
void (*program_release)(const prog_t *p);
|
||||
uint64_t (*submit)(const uint64_t *handles, int n); // replays; returns this submission's fence value
|
||||
// (gfx_submit_queue names the game's queue)
|
||||
int (*fence_wait)(uint64_t value, uint64_t timeout_ns); // 1 reached; caller has given its core up
|
||||
uint64_t (*fence_done)(void); // highest value whose side effects are written
|
||||
// Queues the present and returns at once; the host present goes out at at_ns (kern_now_ns clock), at once when that
|
||||
@@ -169,3 +170,7 @@ void rt_frame_presented(const tex_t *t, uint64_t n); // boot.c: --frames N
|
||||
void gfx_movie_frame(const uint8_t *rgba, int w, int h);
|
||||
void gfx_movie_frame_own(uint8_t *rgba, int w, int h); // the same, taking the malloc'd buffer (freed later)
|
||||
void gfx_movie_stop(void);
|
||||
|
||||
// The game's queue (NVNqueue address) of the submission this thread is handing to GfxBackend.submit, 0 when none
|
||||
// (probes). Set by nvnQueueSubmitCommands around the call; vk_exec.c orders queues by their events with it.
|
||||
extern _Thread_local uintptr_t gfx_submit_queue;
|
||||
|
||||
Reference in New Issue
Block a user