3 ms·
I used to use a timer to limit the frame rate to 60 Hz too. But on Windows, I found that DwmFlush() seems to act like WaitVSync(), so I've been using that in pr
by abainbridge 4y ago
I used to use a timer to limit the frame rate to 60 Hz too. But on Windows, I found that DwmFlush() seems to act like WaitVSync(), so I've been using that in preference for years now. I think this is undocumented behaviour. I guess what it actually does is wait until the compositor is ready for another frame.
To be able to call that function, I LoadLibrary("dwmapi.dll"), and then GetProcAddress(dwm, "DwmFlush").
- suby 4y agoWhy not just use VSync?
- sylware 4y agoIf 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.
- abainbridge 4y agoHow would I do that? I think there is any such function in the Win32 API.
- formerly_proven 4y ago> 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.