[SDL] Problem with frame rate

David Olofson david at olofson.net
Wed Mar 12 15:01:04 PST 2003


On Wednesday 12 March 2003 23.02, Glenn Maynard wrote:
> On Wed, Mar 12, 2003 at 03:32:11PM -0600, Tyler Montbriand wrote:
> > Every time you call SDL_Flip(), it blits the ENTIRE contents of
> > the backbuffer to the physical video memory.  At 800*600*16bpp,
> > that's nearly a megabyte of data per frame.  So, to get a nice
> > 80FPS, you'd need a constant 80MB/s throughput.  That IS possible
> > on some setups, but a real waste.  :)
>
> That's silly.

Yeah, I couldn't agree more - but even so, it's the only way to do it 
on some platforms.

That's just the way it is. In some cases, it's because no one is paid 
to fix it, and in other cases, it's because no one has been motivated 
enough to fix it so far.

Another thing to keep in mind is that rendering directly into VRAM 
isn't always optimal. If you're using heavy blending effects and 
can't have them h/w accelerated, you get the slideshow effect if you 
work directly in VRAM. In that case, s/w back buffer is vastly 
superior, whether or not you use it together with a h/w pageflipping 
double or triple buffered display.


...or just do what the hardware is designed for: Use OpenGL. ;-)

(Actually, some OpenGL implementations do "blit flips" as well, even 
in fullscreen modes. However, then it's indeed all in VRAM and fully 
accelerated, so it's not that much of a performance issue. An extra 
fullscreen blit per frame doesn't kill a modern accelerator, although 
it certainly is a waste.)


//David Olofson - Programmer, Composer, Open Source Advocate

.- The Return of Audiality! --------------------------------.
| Free/Open Source Audio Engine for use in Games or Studio. |
| RT and off-line synth. Scripting. Sample accurate timing. |
`-----------------------------------> http://audiality.org -'
   --- http://olofson.net --- http://www.reologica.se ---





More information about the SDL mailing list