Page 1 of 1

SDL: vsync when using OpenGL

Posted: Mon Dec 22, 2008 6:09 pm
by KunaiTeam

I recently tried playing a plain-old DMG game on vbam for the first time and found the graphics to be really choppy. I did not experience this when playing GBA games or when rendering through SDL. This is because on OS X SDL_Flip() automatically waits for monitor vsync. (IIRC, it does not do this on some systems.) I went in and added a line to make OpenGL do the same, and it made a world of difference. The game was unplayable before, but it worked perfectly after that. Patch is attached.


SDL: vsync when using OpenGL

Posted: Tue Dec 23, 2008 4:07 am
by Squall Leonhart

You shouldn't be limiting to vsync anyway, since v-refresh differs, Sync directly to audio will give you the best performance.


SDL: vsync when using OpenGL

Posted: Tue Dec 23, 2008 1:36 pm
by KunaiTeam

Yes, I know it's not a great solution, however, it's no different than how the SDL renderer does it currently. IIRC, SDL_Flip() (which is called once per frame) waits for vsync when SDL_HWSURFACE is used. (Except, perhaps, in the X11 driver.) And considering that it made DMG games, which were unplayable on my system, playable, I decided to upload the patch.

 

I'm willing to look into sync to audio, if you could provide more details as to how that works. It might also be worthwhile to include vsync as an option in the SDL port since it seems to me that syncing to audio wouldn't necessarily prevent tearing.


SDL: vsync when using OpenGL

Posted: Tue Dec 23, 2008 5:35 pm
by Squall Leonhart

hah, thats something you'd be better asking Spacy,