Why not just use VSync?
If I am not too much mistaken, because on some hardware (mobile), there is no vsync feedback.
vsync feedback support has to be queried (look at vulkan API/wayland API). Usually it is called "presentation" something.
Re:Minimal Cross-Platform Graphics
by abainbridge on Tuesday January 24, 2023 @08:34AM
(#34503329)
How would I do that? I think there is any such function in the Win32 API.
Yes, I think you basically have to use a DirectX swap chain to get vsync presentation.
Re:Minimal Cross-Platform Graphics
by formerly_proven on Tuesday January 24, 2023 @08:21AM
(#34503195)
> Issues a flush call that blocks the caller until the next present, when all of the Microsoft DirectX surface updates that are currently outstanding have been made.
DWM always runs with vsync so presents never happen more frequently than screen refreshes.
To be able to call that function, I LoadLibrary("dwmapi.dll"), and then GetProcAddress(dwm, "DwmFlush").