Crash in SDL_SetVideoMode (1.3)

I know it’s only in 1.3 for compatibility, and I’m going to change this anyway, but the following code crashes:

SDL_putenv(‘SDL_VIDEODRIVER=dummy’);
if (SDL_Init(SDL_INIT_VIDEO) <> 0) or (SDL_SetVideoMode(1, 1, 32, 0) = nil) then

I got a bit lost tracing through all the assembly code, but somewhere inside the SDL_SetVideoMode call, it calls SDL_CreateRGBSurfaceFrom. This returns correctly. The next function call it makes is to SDL_Flip, which calls SDL_FillRect, which attempts to dereference a null pointer. Oops.

This may or may not be the problem, but does anyone have any idea why it’s trying to call SDL_Flip on a dummy video driver?

I got a bit lost tracing through all the assembly code, but somewhere inside the SDL_SetVideoMode call, it calls SDL_CreateRGBSurfaceFrom. This returns correctly.
The next function call it makes is to SDL_Flip, which calls SDL_FillRect, which attempts to dereference a null pointer. Oops.

I ran into this elsewhere, and did a bit more tracing. I’m not 100%
certain, but the problem appears to be in SDL_FillRect1SSE, which looks
like it’s been inlined. I don’t quite understand what it’s trying to
do, (and the but here’s the first assembly code instruction from the
routine:

6816270D 0F2845D8 movaps xmm0,dqword ptr [ebp-$28]

And EBP-$28 is 00000000.

Not sure exactly what’s going on, but apparently DECLARE_ALIGNED is
trying to dereference a null pointer on the stack… or something like
that. Someone with a bit more knowledge of what’s going on is going to
have to take over from here.>----- Original Message ----

From: Mason Wheeler <@Mason_Wheeler>
Subject: [SDL] Crash in SDL_SetVideoMode (1.3)

I tried to reproduce this. I set both 32 bpp and 8 bpp modes which do go
into SDL_FillRect4SSE() and SDL_FillRect1SSE(), but they don’t actually
run any SSE code since there’s only one pixel that’s filled.

Can you build SDL without optimizations (configure CFLAGS=-g) and see
what’s going on?

See ya!
-Sam Lantinga, Founder and President, Galaxy Gameworks LLC

That’s the problem. I can’t build it at all. I keep banging my head against the language. As strange as this may sound, Delphi does a better job of talking to C DLLs than C does. Terms like “.lib file” and “undefined external” are simply not in my vocabulary, and I don’t have the experience to resolve such issues. All I need to talk to any DLL written in any language is a header file, written in plain-text Delphi code, containing a list of function prototypes and the name of the DLL that implements them. That’s it. The compiler takes care of the rest. And that’s the problem I’m having with building SDL: I keep hitting “undefined external” linker errors, and my attempts to work around it either trades those ones in for other undefined externals or produces a DLL that won’t load.

I could probably duplicate the work you did if I had the right information. Could you reply with the name and version of the compiler you used to create the DLL you posted on the site, and attach a batch file that’ll build it? I want to learn how the process works, but I need to start from some sort of principles that I already understand. I see some sort of arcane gibberish like “Run ‘./configure; make; make install’” and it may as well be Swedish Chef-speak. :stuck_out_tongue:

Thanks,
Mason>----- Original Message ----

From: Sam Lantinga
Subject: Re: [SDL] Crash in SDL_SetVideoMode (1.3)

I tried to reproduce this. I set both 32 bpp and 8 bpp modes which do go
into SDL_FillRect4SSE() and SDL_FillRect1SSE(), but they don’t actually
run any SSE code since there’s only one pixel that’s filled.

Can you build SDL without optimizations (configure CFLAGS=-g) and see
what’s going on?

There’s nothing that cryptic about ‘./configure; make; make install’. They are just Linux or Cygwin/Mingw scripts that automate most of the compiling process, as long as you have all the right libraries (and ./configure checks to ensure they are installed)

You can read more about it here, if you’re interested:

Of course, it won’t help you much with your current problem.

Pat> ----- Original Message -----

From: masonwheeler@yahoo.com (Mason Wheeler)
To: A list for developers using the SDL library. (includes SDL-announce)
Sent: Thursday, February 26, 2009 7:31:26 AM
Subject: Re: [SDL] Crash in SDL_SetVideoMode (1.3)

That’s the problem. I can’t build it at all. I keep banging my head against the language. As strange as this may sound, Delphi does a better job of talking to C DLLs than C does. Terms like “.lib file” and “undefined external” are simply not in my vocabulary, and I don’t have the experience to resolve such issues. All I need to talk to any DLL written in any language is a header file, written in plain-text Delphi code, containing a list of function prototypes and the name of the DLL that implements them. That’s it. The compiler takes care of the rest. And that’s the problem I’m having with building SDL: I keep hitting “undefined external” linker errors, and my attempts to work around it either trades those ones in for other undefined externals or produces a DLL that won’t load.

I could probably duplicate the work you did if I had the right information. Could you reply with the name and version of the compiler you used to create the DLL you posted on the site, and attach a batch file that’ll build it? I want to learn how the process works, but I need to start from some sort of principles that I already understand. I see some sort of arcane gibberish like “Run ‘./configure; make; make install’” and it may as well be Swedish Chef-speak. :stuck_out_tongue:

Thanks,
Mason

----- Original Message ----

From: Sam Lantinga
Subject: Re: [SDL] Crash in SDL_SetVideoMode (1.3)

I tried to reproduce this. I set both 32 bpp and 8 bpp modes which do go
into SDL_FillRect4SSE() and SDL_FillRect1SSE(), but they don’t actually
run any SSE code since there’s only one pixel that’s filled.

Can you build SDL without optimizations (configure CFLAGS=-g) and see
what’s going on?


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

There’s nothing that cryptic about ‘./configure; make; make install’. They are just Linux or
Cygwin/Mingw scripts that automate most of the compiling process, as long as you have
all the right libraries (and ./configure checks to ensure they are installed)

I tried Mingw. Didn’t work. When I try to run the terminal, it goes berserk. Opens about 200 terminal windows all over my desktop, then closes them all again. Didn’t bother with Cygwin. From what I’ve read, it’s the same thing as Mingw, only without some special tweaks the Mingw people put in to make it usable by non-Linux people like myself.>----- Original Message ----

From: Patryk Bratkowski
Subject: Re: [SDL] Crash in SDL_SetVideoMode (1.3)