Re: Uneven V-sync

Rainer Deyke <[email protected]> Sun, 22 Jan 2017 14:15:10 +0100
Newsgroups gmane.comp.lib.sdl
Message-ID <[email protected]>
On 21.01.2017 13:10, rtrussell wrote:
>
> Rainer Deyke wrote:
>> - On RenderPresent, the system does this: - Optionally wait for the
>> enqueued bit to be cleared...
>
> Surely, when SDL_RENDERER_PRESENTVSYNC is set, SDL_RenderPresent must
> wait.  That's the only thing which synchronises the app's rendering
> to the hardware display rate.  If it didn't wait the total number of
> calls to SDL_RenderPresent could exceed the total number of frames
> displayed!

It's a matter of definitions.  Vsync means that the enqueued spare 
buffer and the screen buffer are only exchanged during the "vertical 
retrace" when a whole screen buffer has been presented to the screen, 
thereby preventing the "tearing" that happens when half of the screen is 
from one frame and the other half comes from a different frame.  It is 
the act of exchanging buffers which is synchronized, not the rendering 
in the game.  Dropping whole frames does not cause tearing, so it is 
compatible with vsync as defined above.  Another definition of vsync is 
basically "as above, but no dropped frames allowed", in which case 
dropping frames is obviously not allowed.

As for what SDL_RENDERER_PRESENTVSYNC actually does, I would assume that 
depends on the underlying OS, graphics driver, and hardware.  I don't 
think SDL is required to honor SDL_RENDERER_PRESENTVSYNC at all, if the 
underlying system doesn't support it.


-- 
Rainer Deyke - [email protected]