Performance & symbols

Sam Lantinga slouken at devolution.com
Fri Apr 17 18:20:52 PDT 1998


> On Fri, 17 Apr 1998, Sam Lantinga wrote:

> > > ... performance is ... disappointing. I just remembered why
> > > I used to like writing against DirectDraw. It seems Windows users
> > > are simply destined to get better gaming experience; currently my
> > > engine manages about 15 fps under SDL/x11, whereas the original
> > > (straight DirectDraw/Input) version easily managed 80-90 fps. :( !
> > 
> > Have you actually tried the engine under SDL/DirectX?  You should get
> > similar performance to what you expect.

> Nope, I haven't because of the link problem I mentioned. But 0.6g
> just flew down the line, so I'll by trying that in a moment.

> > 
> > Tips for speed under SDL:
> > 
> > A.  Set the SDL_HWSURFACE flag on SDL_SetVideoMode() -- UNLESS you are
> >     going to be directly writing to the surface pixels, in which case
> >     most newer video cards are faster using SDL_SWSURFACE and accelerated
> >     blits.

> Done.

> > B.  Make sure you set a high-speed video mode.  SDL_GetVideoMode() is
> >     a very useful function.

> Hm... I sort of "know" that I need 640x480x8; is there any point in
> "looking" for that mode? Now I just set it and let that be the end of
> it.

Under X11, if you're running > 8 bit, SDL can't set the display to 8-bit,
so it's emulated with a shadow surface.  This is relatively slow.

> > C.  Convert all your artwork to the surface format of the display surface.
> >     If you are using SDL surfaces, use SDL_DisplayFormat() to convert them.

> I always do.

> > B.  Set the SDL_RLEACCEL flag in colorkeyed blits.  This is a huge speedup
> >     when doing colorkeying on software surfaces.

> I do that, too. Can it ever cause surfaces *not* to be blitted by the
> hardware, if they are HWSURFACEs?

Nope.  If hardware acceleration is available, it's used.

> > C.  Don't use alpha blending every frame - it's cool, but slow.

> I never use it. Pure color keying is enough right now...

> > D.  Update only those areas which have actually changed.  Important!

> Arg. That's the one I can't comply to. My app uses full-screen
> scrolling, and thus rebuilds the entire screen from scratch every
> frame. :(

That's fine. :)

> > There is however one method of X11 setup that I don't currently use:
> > 
> > 	XFree86 Direct Graphics Access
> > 
> > With this, you shove the X Server aside and directly access the display
> > video memory.  You still don't get hardware acceleration (last I heard)
> > but you get to scribble all over video memory to your heart's content.
> > Unfortunately, your app requires root priviledges.

> Yeah, I've seen some DGA programs around. It's fairly cool, but as
> you say wouldn't gain much in raw performance. It's nice to be able
> to switch to a lower resolution, though (I generally think games gain
> from being run full-screen).

I will definitely support DGA, I just haven't gotten around to it yet.

See ya!
	-Sam Lantinga				(slouken at devolution.com)

--
Author of Simple DirectMedia Layer -
	http://www.devolution.com/~slouken/SDL/
--



More information about the SDL mailing list