SDL slow in fullscreen (not directx/displayformat issue)

Started by
4 comments, last by Kylotan 16 years ago
Hello, I realise this question has been asked a million times but none of the solutions I found apply to my problem, I think... My old machine crashed so I had to get a new one. I got a _much_ better machine (proc+video). After compiling/running my game I noticed that fullscreen performance was much worse compared to my old machine, around 20 fps vs. 60 ( = vertical refresh). Old video card is Geforce6, new one a GF8800.. The weird thing is that when changing the driver to windib (gdi) the performance increased a lot. The windib driver 'should' not outperform directx, right? I am developing on windows with VS2005, using sdl 1.2.13. I check what SetVideoMode is actually giving me, which is a hardware double-buffered surface. I use SDL_DisplayFormat on my surfaces and I do not do any alpha. Does anyone have an idea what might be causing this? I cannot show any code because I'm at work (I do have time to post ;-) ). Since I changed the machine and did not change the code at all, I am suspecting it might not be the code.. I am using a beta-nvidia driver though. Could that be giving a problem. (It's the first thing i'll try when I get back home) (edit: subject of email seems wrong to me now, it should be: not a change-windib-to-directx-issue)
Advertisement
When SDL says it's using DirectX, it's using DirectDraw. And unfortunately DirectDraw is no longer hardware accelerated in new versions of Windows. This would probably account for the loss in performance.
Thanks for your reply,

That would explain a lot. My previous machine was windows 2000 prof and now I am using winxp prof (sp2). Is windows xp 'new' enough to not have hardware accelerated directdraw? (I think both had directx 9 (b/c))

If this is the case, how do most people handle this in their games? Given that you want to support older machines (and older OSes)? Just always use software surfaces with a dirty rectangle approach? I always though that on older machines it really pays of to have hardware support (with double buffered flipping). IsS there away to detect the best settings? Or is everybody taking the SDL/OpenGL route?
Yeah in XP DirectDraw is definitely *not* hardware-accelerated, since by then it was deprecated and most of its functionality was moved into D3D9. I'd say that for most cases using software rendering is probably good enough, and it actually makes things easier on you if you're doing a lot of Locks for direct pixel access. Otherwise I'd probably just have the app check the version of Windows its running on (using GetVersionEx) and then set the SDL environment variable if it's earlier than XP. There's probably a way to query DirectDraw itself to see if its hardware-accelerated, but I've never used that library so I don't know how to do it.
You may have had the same problem as me. http://www.gamedev.net/community/forums/topic.asp?topic_id=487881
Quote:Original post by MJP
Yeah in XP DirectDraw is definitely *not* hardware-accelerated, since by then it was deprecated and most of its functionality was moved into D3D9.


Unlikely, given that DirectX 9 was out for a year before XP even was. I was of the distinct impression that XP has 2D acceleration for DirectDraw. Is there a reference confirming or refuting this?

This topic is closed to new replies.

Advertisement