diff --git a/docs/agents/symptoms.md b/docs/agents/symptoms.md index 4a242b12..2938b6f9 100644 --- a/docs/agents/symptoms.md +++ b/docs/agents/symptoms.md @@ -40,6 +40,7 @@ GPU semantics behind the graphics rows: [maxwell.md](../maxwell.md). The method | a 30 Hz thread runs at 27 Hz, slow cutscenes | host sleep overshoot: Windows waitable timers wake 0.3-0.5 ms late | `TOTK_TRACE=sched` sleep asked versus took | | 20 fps after a scheduler change | a yield back-off that starts too early | yield handling against the console's | | in the Depths Link takes gloom damage and wears the gloom haze while standing on clean ground, some runs only; only with `sync_ahead = 1` | the game read a GPU result of the frame it was told is done before the GPU wrote it: its one-pixel readbacks go through a buffer per request, which then holds zeros or an answer from the ring's last round (fixed: `vk_memory.c` `vk_mem_shadow_read` waits at the invalidate) | `sync_ahead = 0`; the shadow log line's "the game waited for a GPU write it reads" count | +| in shrines the lamps' reflections on the floor go out for single frames, every other frame at some camera angles; only with `sync_ahead = 1`, more with DLAA (the GPU runs further behind) | the game reads its depth query results two frames later and refuses them unless their frame number is exactly the counter - 2; with sync_ahead it is the counter - 3 on frames where the GPU is behind (fixed: patch set `qstamp` in `recomp/patches-v143.txt` also takes the counter - 3) | `sync_ahead = 0`; a `--capture` run with `TOTK_SYNC_AHEAD` on, counting one-frame drops in floor regions | | climbing or movement wrong only above some fps | game code that assumes a fixed step count per frame | compare at 30, 60 and the failing rate | ## Threads and crashes diff --git a/recomp/patches-v143.txt b/recomp/patches-v143.txt index e9313391..8ecb5d7b 100644 --- a/recomp/patches-v143.txt +++ b/recomp/patches-v143.txt @@ -1185,6 +1185,21 @@ set report TOTK_REPORT_GUARD 1 site report main a22d8 2a010571 2a010571 37f80341 # orr w17, w11, w1, lsl #1; tbnz w1, #31, 0xa2340 site report main a2310 531f7821 530f7c24 531f7821 35000184 # lsr w4, w1, #15; lsl w1, w1, #1; cbnz w4, 0xa2340 +# Depth query results one frame older (TOTK_SYNC_AHEAD). A compute pass at the start of each frame samples the scene +# depth for the world queries and writes their results, with the frame number of the request, into a 23232-byte +# CPU-cached buffer that main+0x6e1220 invalidates and reads two frames later. It takes the results as this frame's +# (bit 2 of obj+0x10) only when the number at buffer +0x58e4 is exactly the frame counter (obj+0x14) - 2. With +# sync_ahead the game's frame wait covers the frame before, so on frames where the GPU runs behind the number read is +# the counter - 3 (the frame after it has not come back yet) and the results were refused: in shrines the reflections +# of the lamps on the floor went out on those frames, every other frame where the GPU was slow, which looked like +# flicker at some camera angles. The set also accepts the counter - 3: d = counter - 2 - number, unsigned d <= 1. +# Waiting for that frame when the buffer is invalidated (vk_memory.c vk_mem_shadow_read) also ends the flicker, but +# gives back the frame rate sync_ahead brings (63 against 86 fps on a field macro at 4K). +# w11 is loaded again on both paths at 0x6e1340 before any read; x8, the number's address, stays for 0x6e1420. +set qstamp TOTK_SYNC_AHEAD 0 +site qstamp main 6e1320 6b0b015f 4b0b014b 7100057f # cmp w10, w11 -> sub w11, w10, w11; cmp w11, #1 +site qstamp main 6e1324 540000c1 540000c8 # b.ne 0x6e133c -> b.hi 0x6e133c + # Function-entry hooks (FN_ENTER, runtime/cpu.h): only these functions check g_fnprof on entry, the others carry no # hook. main+0x585bd0 sets the render size (runtime/resolution.c SET_RENDER_SIZE): res_fn_hit takes the renderer from # the game's own call at start, so a DLSS mode can change while the game runs.