More accurate target framerate is needed
The current implementation of targeting a render framerate using sleeps is so inaccurate it causes unacceptable visual jumps. This implementation needs to be revamped, potentially with a mixture of sleep + spinlocks, or maybe other native solutions, in order to work in an acceptable manner.
Another potential solution is to remove this feature entirely and just rely on hardware vsync. This would be the easiest solution, but, would be less flexible in terms of targeting whatever framerate the user wants.
Relevant links
https://blat-blatnik.github.io/computerBear/making-accurate-sleep-function/
https://learn.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-createwaitabletimerexw
https://hero.handmade.network/forums/game-discussion/t/8612-what_does_timebeginperiod_actually_do#27120
https://github.com/MicrosoftDocs/win32/blob/docs/desktop-src/directcomp/compositor-clock/compositor-clock.md
Seems more accurate than before. Only tested on my laptop so far, which has some wild sleep times and still manages locking in fairly well.
https://github.com/RandyGaul/cute_framework/commit/a49a9843904c77661189ffafb305df495444ac5d