Jump to content
  • Advertisement
Sign in to follow this  
Nightbird1225

SDL in windowed mode: performance poor

This topic is 4860 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello all, My app runs at ~50-60 fps in fullscreen mode and only ~15-20 in windowed mode. Anyone have any ideas as to why this might be happening? I am using software surfaces and I notice the performance is the same on my friends' laptops.

Share this post


Link to post
Share on other sites
Advertisement
Try hardware surfaces and see what happens.

I'm thinking maybe SDL is having a problem with software rendering with windowing using DirectDraw, so it falls back on GDI (as far as i know)..so yeah it would be molasses slow.

Try hardware surfaces in full and windowed mode and post your framerates.

Share this post


Link to post
Share on other sites
Already tried (sorry should have mentioned it). I started with the textures in HWSURFACES and my frame rate was about 10% higher in Full and 2%(maybe) in windowed. I switched over to software thinking that somehow I had too much GDI in the video card frame buffer to allow effective Hardware surfaces. It turns out not to make much difference. Thanks for the hint though, it is exactly what I would have thought too. I am trying to nail this down before I put in any more of the complex systems, and I am trying to run it with Software surfaces now to target the low end systems.

-Nightbird

Share this post


Link to post
Share on other sites
If you're running in windowed mode and use a different display mode (bit depth, etc) than your desktop, every time the screen is updated, the data on your window has to be converted to the same format as your desktop. That is a very time consuming.

If you want windowed mode to run fast too, then you have to set it to the same bit depth as your desktop.
screen = SDL_SetVideoMode(640, 480, 0, SDL_SWSURFACE);
does it for you (note the bpp=0). Then do SDL_DisplayFormat for all your surfaces that are going to be blitted.

That should give you a small speed increase.

-Richardo

Share this post


Link to post
Share on other sites
I don't have a problem with hardware surfaces in window mode. I'll try again and see if I can re-create the problem.

Share this post


Link to post
Share on other sites
I guess that's why I didn't say 100% :)

Check out this article where it says:
Quote:
The options tell SDL that I want a full screen (SDL_FULLSCREEN), double buffered (SDL_DOUBLEBUF), hardware surface (SDL_HWSURFACE). The part that isn't obvious is that on my desktop system if I want a hardware surface, it has to be full screen. I can't get a hardware surface for a window. This is one of those things that is operating system and device driver specific. Some systems let you have a hardware surface for a window. Even if you can get a hardware surface for a window, you may not be able to get a double buffered hardware surface for a window.


The article is for Linux but I have the problem in Windows XP Pro, Radeon 9600 256 (not XT, not PRO). I cannot get a hardware surface in a window. Googling gives pages of results where people are having the same issue. I think it's safe to assume that it's a bad idea to do hardware/double buffering with SDL in a Window if you plan on distributing your game.

Share this post


Link to post
Share on other sites
Well thanks for the reply and the article. Now I can prove to the boss-man that a windowed game won't work. I originally spec'ed the game out to be fullscreen as default anyhow. I just wish I knew why even with software textures the windowed and fullscreen modes have such a different frame rate. I guess that could be attributed to the (likely) lack of getting Double Buffering in a window, but I wish I knew for sure.

Thanks
-Nightbird

Share this post


Link to post
Share on other sites
You could still give the user a choice. If the user wants to play in Windowed mode then use software surfaces.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!