mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-19 04:19:57 -04:00
Let the wait after a frame's first submission write the results the game reads before it returns.
That wait ends when the GPU has run the submission's own commands (wb_split = 1). The completion thread was then still at the last frame's submissions, so the occlusion counts, counter reports and event values the game reads next reached its memory after it had gone on. A player's capture in Hyrule Field shows the result: trees, ground and walls lose their direct light for single frames about every 36 frames, 57 of 1,800 frames, and with the fence's wait (wb_split = 0) the same place showed none. The fence's wait also covers the rest of what the completion thread does for those submissions, 0.23 to 0.40 ms a frame of page stamps the game does not read. So those results now have a queue of their own (vk_completion_add_result), and the waiter runs the ones due for its submission and the ones before it as soon as the GPU's signal is there; the completion thread runs them the same way, ahead of its other callbacks, one runner at a time and in the order they were queued. wb_split = 3 is the bare wait as it was, to measure against. Checked: it builds, the launcher tests and the address table check pass, and the player's hand test of this wait at that place showed no such frame. Not measured: no scripted run of it was made (the one scripted run with the bare wait in that field shows 1,170 occlusion counts a frame written late and no dark frame, so the script does not reproduce the fault), and its cost against the bare wait is not known. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
@@ -700,6 +700,9 @@ extern int vk_sub_in_frame; // replay: the submission being recorded is the fr
|
||||
// Runs fn(arg) on the completion thread once fence is done on the GPU (event writes, counter reports, sync state).
|
||||
// Callbacks run in the order they were added, after those of earlier values; a value already done runs at once there.
|
||||
void vk_completion_add(uint64_t fence, void (*fn)(void *), void *arg);
|
||||
// The same for a side effect the game's CPU reads (an occlusion count, a counter report, an event value): run before
|
||||
// the others, and by the wait after a frame's first submission itself (vk_sync.c "the executed timeline").
|
||||
void vk_completion_add_result(uint64_t fence, void (*fn)(void *), void *arg);
|
||||
// gfx_vulkan_backend (vk_backend.c): presents go to a present thread and run after the submissions made before them.
|
||||
void rdoc_init(void); // runtime/rdoc.c: NX2NAVI_RDOC debug capture; before vkCreateInstance
|
||||
int rdoc_active(void);
|
||||
|
||||
Reference in New Issue
Block a user