RX_VK_CAPTURE_WAIT=0 takes OoT from ~31 to 60 fps on an RTX 3080 (late-page wait every frame) #2655
Labels
No labels
accessibility
autorelease: pending
autorelease: tagged
bug
dependencies
documentation
duplicate
enhancement
github_actions
good first issue
help wanted
invalid
question
testing wanted
wontfix
No milestone
No assignees
2 participants
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Hookshot#2655
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Hookshot version
v2.1.0
What kind of problem
Low fps or stutter
What happened
Setup
Problem
In heavy areas the game drops from 60 fps to 31-34 fps. The log shows the replay waiting for the GPU on one capture every frame:
In areas running at 60 fps it's 0-1 of 600 takes, memory sync ~0.9 ms and submit ~10 ms. GPU-bound wait is ~0, so the GPU isn't the limit. The CPU and GPU end up taking turns.
RX_VK_CAPTURE_WAIT results
Likely cause
The exposure-meter late-page wait in take_capture (gpu/vk/vk_memory.cpp) serializes the CPU and GPU once a frame. Could the late pages' copy be done on the GPU after the write-back lands (in queue order) instead of on the CPU after a timeline wait? That would avoid both the stall and the stale data.
Log from a session with the slowdown attached (hookshot_log.4.txt).
Where in the game
Hyrule Field
How often
Every time
Graphics card and driver version
NVIDIA GeForce RTX 3080 10 GB, driver 0x9b404000
CPU, RAM and operating system
Windows 10 Pro 22H2, 64 GB RAM
Changes from the defaults
No response
Other software hooked into the game
No, nothing hooked in
hookshot_log.txt
hookshot_log.4.txt
Screenshots or video
No response
Before you send it
I tried the GPU-side copy suggested here, and in its simple form it flashes. Notes, so nobody has to repeat it.
What I tried (branch on
mainba005ca4, not opened as a PR):capture_makestill finds the late pages, but leaves them out of the capture's copy and does not wait. With no capture entry,mirror_synccopies those pages live from guest memory into the mirror (p.buffertop.mirror). That copy runs in the upload command buffer, after itsfull_barrier, so the write-back that came before has landed by then.Result (Windows 11, RTX 3070 8 GB, Kokiri Forest, Hyrule Field and the Market, 4 runs of each, alternated):
RX_VK_CAPTURE_WAIT=2.My reading: a live copy reads guest memory when the GPU gets there, not as it was at the capture. The CPU runs ahead and has by then written the exposure page for a later frame, so the GPU adds into the wrong sums. So the copy needs the capture's CPU bytes merged over the landed write-back (word by word, against the write-back diff's shadow), not the page as it is at that point. That is a bigger change, and I have not tried it.
Also: on this card with default settings, the wait is rare (6-30 of 600 takes), and
RX_VK_CAPTURE_WAIT=0gave no fps gain at the Market either (50.8 / 50.6 against 51.6 / 47.2). The every-frame wait in this issue probably needs the game to run ahead of the GPU, as on your 3080.The attached
hookshot_log.4.txtcontains only shader preparation followed by a normal close; it does not include the gameplay capture-wait lines quoted above. Could you attach the log from the slow gameplay session? Please keep the normal capture-wait setting for that run; disabling it can produce the flashes already reported here.