SDL: vsync when using OpenGL

Post Reply
KunaiTeam
Junior Member
Posts: 44
Joined: Thu Aug 14, 2008 9:37 pm

SDL: vsync when using OpenGL

Post 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.

Squall Leonhart
Posting Freak
Posts: 1223
Joined: Tue Mar 18, 2008 9:21 am

SDL: vsync when using OpenGL

Post 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.

KunaiTeam
Junior Member
Posts: 44
Joined: Thu Aug 14, 2008 9:37 pm

SDL: vsync when using OpenGL

Post 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.

Last edited by KunaiTeam on Tue Dec 23, 2008 1:36 pm, edited 1 time in total.
Squall Leonhart
Posting Freak
Posts: 1223
Joined: Tue Mar 18, 2008 9:21 am

SDL: vsync when using OpenGL

Post by Squall Leonhart »

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

Post Reply