VanguardEngine
VanguardEngine copied to clipboard
Increased timer precision
When waiting for a frame deadline, just sleeping until the objective is varyingly imprecise. A better solution is to modify the timer resolution, sleep until some small unit of time before the deadline, and then spin wait for the remaining time segment. This will significantly reduce frame time variations.
Maybe new win32 api, CreateWaitableTimer with CREATE_WAITABLE_TIMER_HIGH_RESOLUTION? Reportedly 500us precision. Reference: https://discord.com/channels/590611987420020747/590965902564917258/952643195580317747