Log in

View Full Version : SDL_SetVideoMode() crash on Radeon


StAn
02-10-2004, 02:25 AM
(sorry if you're reading flipcode too, it's the same post I made there. I tried posting this to the SDL ML but without success, hence this post.)

I'm writing a program that uses SDL 1.2.6 (precompiled DLL) + OpenGL
under Windows 98. On my previous S3 ProSavage 4, it worked fine, but
I've just installed a Radeon 9200 SE 128MB and now SDL_SetVideoMode()
crashes (parachute thingy).

Here's the code I'm using:

SDL_Surface *screen = NULL;
const SDL_VideoInfo *info = NULL;
int bpp;

if( SDL_InitSubSystem( SDL_INIT_VIDEO ) < 0 ) {
printf( "Error initializing video: %s\n", SDL_GetError() );
return FALSE;
}

info = SDL_GetVideoInfo();
if( !info ) {
printf( "Video query failed: %s\n", SDL_GetError() );
Display_Exit();
return FALSE;
}

bpp = info->vfmt->BitsPerPixel;

SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 5 );
SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 5 );
SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, 5 );
SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 8 );
SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );

SDL_Surface *surf = IMG_Load( "perle_1a.png" );
if( surf ) {
SDL_WM_SetIcon( surf, NULL );
SDL_FreeSurface( surf );
}

screen = SDL_SetVideoMode( g_Width, g_Height, bpp, SDL_OPENGL );

g_Width is 640 and g_Height is 480. The bpp returned by GetVideoInfo is
32, but I've tried 24 and 0 and it still crashes.

Am I doing anything wrong ? Any clue about what could be done to avoid
the crash ? Note that Quake 3 works fine, so OpenGL _should_ be working...

Thanks

princec
02-10-2004, 03:22 AM
Assuming you've got the very very latest drivers... where does it crash, exactly? At
screen = SDL_SetVideoMode( g_Width, g_Height, bpp, SDL_OPENGL );
or before it?

Depth of 8 is an "unusual" figure btw... you'd normally choose 16. I wouldn't put it past ATI that they never tested 8 bit depth buffers...

Cas :)

StAn
02-10-2004, 04:03 AM
It crashes in SDL_SetVideoMode(). I can see the window frame appearing on the desktop, but then poof, the exe exits with "SDL parachute deployed" or something like that in stderr.txt.

No, I haven't installed the lastest drivers. I have installed the drivers provided on the CD with the Radeon card. My thoughts are that if Quake3 works, then OpenGL should work with these drivers, and people who try my game will think it's bugged if other OpenGL games do work on their system...

I'll try asking for a 16 bits depth buffer instead of 8, thanks for the suggestion. (though theorically this is only a minimum requirement; if no 8 bits modes are available SDL should choose a 16 bits mode I think).

I'll also try fullscreen just in case.

Matthijs Hollemans
02-10-2004, 04:36 AM
You do SDL_InitSubSystem() -- did you also do an SDL_Init() before? It doesn't show up in the sample code, so I'm asking just to be sure. In any case, you should.

Also, if you are using Visual C++ you may want to initialize with the SDL_INIT_NO_PARACHUTE flag. If you don't do this, you may not be able to use the debugger to tell what's going on.

Hope it helps...

ggambett
02-10-2004, 05:09 AM
SDL_INIT_NOPARACHUTE also works in linux so you can gdb it.

I don't see anything particularly wrong, but you're freeing the icon surface after the call to SDL_WM_SetIcon. What if you try releasing it at least after the call to SDL_SetVideoMode?

princec
02-10-2004, 05:15 AM
And one more thing - the drivers ATI generally supply on their CDs are absolutely the pits and the main reason why I can't recommend ATI hardware to anyone who asks me. (A video card without working drivers is like an Englishman without trousers - an embarrassing object of riducule that can't do anything useful!) Try the code with the latest drivers from ATI and see if it's all right.

Cas :)

patrox
02-10-2004, 05:41 AM
You should use lwjgl (http://www.lwjgl.org/) instead of SDL ;)

p.

Henrik
02-10-2004, 07:04 AM
There's no such thing as an 8-bit depth buffer on any graphics card i've ever heard of. The standard size is 16 bits though modern cards also offer 24 bits (with or without an extra 8 bits of stencil per pixel).

princec
02-10-2004, 07:09 AM
In theory the GL driver is supposed to treat the request for an 8-bit depth buffer as the minimum it should supply (it's free to give you more) but I expect ATI's, as usual, barfs.

Cas :)

Fenix Down
02-10-2004, 08:10 AM
Try a 16 bit depth buffer as others said. Worked for me when I was doing OpenGL stuff with SDL (with otherwise the same settings as you).

GBGames
02-11-2004, 05:13 PM
Actually I have a Radeon 8500 on my system, and I recently got the latest drivers. Orbz and Alchemist Wizard inconsistently work. Sometimes I can run the game without an issue. Sometimes I get flicker or weird ghost effects, like having a character's image not get redrawn properly so there are now two of them.

Oddly enough, RTCW:ET works just fine. As does AvP 2.


So part of me thinks that it has to be the games, but Orbz used to work just fine. I know ATI's drivers don't exactly have a great reputation, but I find it odd that the indie 3d games I have don't work while the mainstream 3d games do. It can't be OpenGL since they all use it, and what's weirder is that it will work perfectly fine only sometimes.

And in the end, everyone can always say that the fact I use Windows 98SE is the problem.

Larry Hastings
02-11-2004, 07:01 PM
Originally posted by GBGames
I find it odd that the indie 3d games I have don't work while the mainstream 3d games do.There's nothing odd about that. Mainstream games get lots more QA, and (not to knock indie programmers) have dedicated graphics programmer specialists who work on this stuff all day long. They also get more support from the graphics card manufacturers, which is to say any support at all.

StAn
02-12-2004, 07:51 AM
Ok, well, nothing new so far. I tried the 16 bits depth buffer, 8 bits color depth for each component, fullscreen, all without success.

Yes, I'm calling SDL_Init() before :-). I haven't changed anything in the source code since the last time it worked on the ProSavage4.

Thanks for the help.