mirror of
https://github.com/InstanceBrick/nightcap.git
synced 2026-10-25 12:01:06 +01:00
Every frame the CPU waited for the GPU to finish Roblox's whole frame in the desktop mirror, then again for the eye copy, so CPU and GPU work never overlapped. The mirror blit now consumes the guest's present semaphores and signals a per-image semaphore that the present waits on. Present preparation hands remaining waits to the GPU the same way. Eye copies are submitted from a small ring of command buffers and fences and rely on queue order, so the CPU only waits when the GPU is three frames behind or the guest destroys an image a copy still reads. On Monado at 120 Hz with 1280x1440 eyes this removed 2 to 5 ms of waiting per frame and kept the frame rate at 118 to 119 fps instead of 103 to 118. Also free the copy resources when the guest device goes away without a session, so a later device never reuses stale handles.