[SDL] glSDL backend

Koshmaar koshmaar at poczta.onet.pl
Fri Jan 7 09:20:04 PST 2005


> And now I got some questions about hardware surfaces. I never bothered
> to use them since I read somewhere they can be slower than software
> surfaces in some cases. Since I'd like get the best of both worlds, is
> it okay to just test if we got an hardware surface for the screen, and
> if it's the case use hardware surfaces everywhere, and if it's not use
> software surface everywhere? Or are there other pitfalls with hardware
> surfaces?

Using hardware surfaces probably will be much slower when you do much surface <-> surface blitting, which AFAIR in OpenGL (in our case: glSDL) must* be implemented using glCopyPixels(), which is really slow operation if you're blitting SWSURFACE's to HWSURFACE since CPU gets involved (?) in sending data from system memory to video card, also AGP is not that fast etc. bottlenecks. So, in this case it's much better to blit SWSURFACE <-> SWSURFACE, and made all surfaces that won't be blitted on anything other than framebuffer, HWSURFACE, so that they would need to be only once sent to video card (but blitting HWSURFACE <-> HWSURFACE probably would be much faster, because CPU is not involved in this task, no data is sent through AGP, only video card has workout - and in normal 2D games it's not working very hard :-))

Hmmm, I assumed that SWSURFACE's exist in system memory, and hardware ones, in video card's. If it's not true with glSDL (as I'm thinking now) then forgot what I've written :-]

* - but there are some extensions, pbuffers etc. which can help.


Koshmaar





More information about the SDL mailing list