Incorrect frame pacing when using sub-frames
Is there an existing issue for this?
- This is a bug in RetroArch frontend
- I have searched the existing issues
Description
When enabling any feature that subdivides a frame into subframes, like shader sub-frames or BFI, the Vulkan driver (and possibly others) does not properly paces the subframes so that they are sent evenly to the display. This happens regardless of any other synchronization method.
When V-Sync is enabled with a FRR, the frames end up being paced correctly if content FPS * subframes is close to the display refresh rate. But if using "Sync to Exact Content Rate" on a VRR monitor, the pacing varies wildly. This happens whether the new "Threaded Video" option is enabled or not.
Quickly hacking the Vulkan driver so that it waits between subframes help, but it still didn't result in pacing comparable to a FRR display with V-Sync. If using subframes with a CRT Beam Simulator shader, some flicker is still visible even when the pacing (measured externally with Mangohud) looks fine.
I added two videos captured at 240 fps that demonstrate the difference between vanilla and the hack. They were made using 4 sub-frames.
Vanilla: https://github.com/user-attachments/assets/b7558bd2-cc22-4efb-847f-bb58f4251321
Pacing hack: https://github.com/user-attachments/assets/48292458-bb91-4f01-9a88-dbc441913dec
Expected behavior
When there are subframes enabled, "Sync to Exact Content Rate" should pace then properly by presenting one every content frametime / subframe.
Steps to reproduce the bug
- Enable "Shader Sub-Frames"
- Enable "Sync to exact content rate"
- Load a CRT Beam Simulator shader
Version/Commit
1.22.2 (Git fd54097b79)
Bisect Results
No response
Present in the nightly version
Yes, this is reproduced in the nightly build
Platform & operating system
Linux x86-64
Affected Cores
No response
Environment information
- Window manager: Wayland
- Driver: Vulkan
Relevant log output
Source: libretro/RetroArch