[SDL] Better performance needed - am I doing this right?

Eddy L O Jansson eddy at klopper.net
Wed Jun 6 10:25:35 PDT 2007


On Wed, 06 Jun 2007 19:18:53 +0200, Colin Tuckley <colin at tuckley.org> wrote:

>> SDL_HWSURFACE normaly is faster then SDL_SWSURFACE.
>
> Unfortunately that isn't an option, I'm in an XWindows environment on Linux
> and can't use HWSURFACE.

  Wasn't a good idea anyhow, seeing how you modify the surface for each character you output.

>> SDL_Flip works nice with doublebuffer active. If you dont have double
>> buffer active, try to use SDL_UpdateRects way.
>
> The docs say that calling SDL_Flip is equiv to calling
> SDL_UpdateRect(screen, 0, 0, 0, 0) for non HW surfaces.

  Maybe you should use a dirty-rectangle approach over flipping (use UpdateRects over the regions that changed _only_), but it depends on how much of the screen actually change (I get the impression that it isn't much). You'd be helped to get some timings and figure out where the time is actually spent. I'd wager flips.

  If we ignore screen updates for a minute, I'd probably try the glyph strip (vertical, for cache-reasons) using a paletted SWSURFACE and then use SDL_SetColors() to get the color right before using a normal surface-to-surface blit. Can't swear it'd faster though, because we are talking about very small blits here, and you'd incur a conversion hit too.

-- 
"There is no fitness function for 'fun'" -- John Hancock
Eddy L O Jansson     |     http://gazonk.org/~eloj


More information about the SDL mailing list