[SDL] Precise behavior of SDL_flip() and hardware buffers.
Bob Pendleton
bob at pendleton.com
Tue May 20 12:50:01 PDT 2003
The documentation for SDL_Flip() (http://sdldoc.csn.ul.ie/sdlflip.php)
states:
> On hardware that supports double-buffering, this function sets up a
> flip and returns. The hardware will wait for vertical retrace, and
> then swap video buffers before the next video surface blit or lock
> will return.
To me that means that the call returns immediately but the next action
that locks the buffer will be forced to wait until after the next
vertical retrace before the lock can complete. But, when I test this
function on my machine I see that SDL_Flip() does not return
immediately. It appears to return after the next vertical retrace. My
guess is that the documentation is correct for some platforms and wrong
for others. My guess is that depending on the platform the actual
behavior of SDL_Flip() is *all* of the following:
1) The display pointer changes immediately, you may get tearing,
SDL_Flip() returns instantly.
2) The flip takes place at the next video retrace, but SDL_Flip()
returns immediately. Possibly returning before the flip has happened.
3) The Flip takes place at the next video retrace, and SDL_Flip()
returns after the flip has happened.
Can someone please confirm or deny my guesses? To write portable code it
is necessary to know all the different ways that SDL_Flip() behaves.
Thanks!
Bob Pendleton
--
+-----------------------------------+
+ Bob Pendleton: independent writer +
+ and programmer. +
+ email: Bob at Pendleton.com +
+-----------------------------------+
More information about the SDL
mailing list