SDL_Flip not waiting for retrace in DirectX hardware surface mode, testsprite.c bug, SDL Parachute

  1. In testsprite.c: main(), I changed
    videoflags = SDL_SWSUFACE|SDL_ANYFORMAT;
    to
    videoflags = SDL_HWSURFACE|SDL_FULLSCREEN|SDL_DOUBLEBUF|SDL_ANYFORMAT;

However I’m getting serious tearing and a frame rate
vastly exceeding the monitor refresh rate which. A printf
debug statement confirms SDL_Flip() is being executed.

My environment is Windows 2000 Professional, libSDL 1.1.8 for MinGW,
and DirectX 8 (which shouldn’t matter right?).

  1. In the course of exploring this, I also discovered what
    may be a bug in testsprites.c when using the -fast flag.
    In FastestFlags(),

SDL_Surface *screen = SDL_GetVideoSurface();

puts NULL in *screen causing a crash when attempting to
read screen->h and screen->pitch. At this point,
SDL_SetVideoMode in main() has not yet been executed, could
this be the cause?

  1. What is the SDL Parachute and how can it be of help?

  2. libSDL rocks! Even if it were only a DirectX wrapper, it
    would already be a very welcome alternative to that @##%!#
    API, the fact that it’s cross-platform just blows my mind!
    Keep up the good work!

  1. In testsprite.c: main(), I changed
    videoflags = SDL_SWSUFACE|SDL_ANYFORMAT;
    to
    videoflags = SDL_HWSURFACE|SDL_FULLSCREEN|SDL_DOUBLEBUF|SDL_ANYFORMAT;

In the examples I’ve seen, they usually set both SDL_SWSURFACE and
SDL_HWSURFACE, rather than one or the other. I’m not sure if there’s any
good reason behind that, but might be something worth trying. Maybe I should
look at the source and see what’s going on…

However I’m getting serious tearing and a frame rate
vastly exceeding the monitor refresh rate which. A printf
debug statement confirms SDL_Flip() is being executed.

My environment is Windows 2000 Professional, libSDL 1.1.8 for MinGW,
and DirectX 8 (which shouldn’t matter right?).

What is this MinGW I keep hearing about? From the context you are using it,
it sounds like some alternative to Win32 or something.

  1. In the course of exploring this, I also discovered what
    may be a bug in testsprites.c when using the -fast flag.
    In FastestFlags(),

SDL_Surface *screen = SDL_GetVideoSurface();

puts NULL in *screen causing a crash when attempting to
read screen->h and screen->pitch. At this point,
SDL_SetVideoMode in main() has not yet been executed, could
this be the cause?

That definately does sound like a bug. Any time you get a pointer back from
any function, you should always check it for NULL before attempting to
dereferencing it.

  1. What is the SDL Parachute and how can it be of help?

I think it’s a crash guard system designed to clean up the state of things if
the program crashes, like for example, switching you back to Windows mode
instead of leaving you in DirectX mode even though the program isn’t running
anymore. For me in linux, it only seems to get in the way by not allowing
the system to produce a core dump. Made it impossible to debug my
application. Luckily I found out about the SDL_NOPARACHUTE option. :slight_smile:

  1. libSDL rocks! Even if it were only a DirectX wrapper, it
    would already be a very welcome alternative to that @##%!#
    API, the fact that it’s cross-platform just blows my mind!
    Keep up the good work!

Yes, seems pretty cool so far. It’s the only library I’ve seen that allows
full screen mode under X. Doesn’t seem to switch to 8 bit mode, though. I’m
guessing this isn’t currently possible due to an X limitation. If that’s not
the case, could someone explain to me how I can get this working?

Anyway, I haven’t tried playing with it under Windows yet, but eventually I
will.On Tuesday 06 March 2001 03:40, you wrote:

Yes, seems pretty cool so far. It’s the only library I’ve seen that allows
full screen mode under X. Doesn’t seem to switch to 8 bit mode, though. I’m
guessing this isn’t currently possible due to an X limitation. If that’s not
the case, could someone explain to me how I can get this working?

The X VidMode extension doesn’t support changing display depth.

m.On Tue, Mar 06, 2001 at 12:41:44PM -0800, Jason Hoffoss wrote:


“Ha ha.” “Ha ha.” “What are you laughing at?”
“Just the horror of being alive.”
– Tony Millionaire

In the examples I’ve seen, they usually set both SDL_SWSURFACE and
SDL_HWSURFACE, rather than one or the other. I’m not sure if there’s any
good reason behind that, but might be something worth trying. Maybe I
should
look at the source and see what’s going on…

Just tried it. Didn’t make a difference.

What is this MinGW I keep hearing about? From the context you are using
it,
it sounds like some alternative to Win32 or something.

MinGW means Minimal Gnu for Win32/64. Used to be called mingw32,
but now that the Win API may go to 64-bit…

What it is is a set of header files plus some more stuff (I think)
that basically allows you to use gcc to compile straight Win32
executables without using the cygwin.dll posix/unix compatibility
layer, replacing that instead by using msvcrt.dll (more modern) and/or
wincrt.dll for OS related calls. Cygwin.dll makes compiling posix/unix
stuff virtually transparent but adds considerable overhead making
your apps slower.

With MinGW, you basically get executables that are equivalent to windoze
apps you would compile using traditional Windoze compilers like Borland
and MS Visual C++, except you’re using the excellent gcc compiler.

Yes, seems pretty cool so far. It’s the only library I’ve seen that
allows
full screen mode under X. Doesn’t seem to switch to 8 bit mode, though.
I’m
guessing this isn’t currently possible due to an X limitation. If that’s
not
the case, could someone explain to me how I can get this working?

Straight X-Window is probably even more complex than DirectX to use.
I’ve seen a Hello World program run for a couple of pages!

In the examples I’ve seen, they usually set both SDL_SWSURFACE and
SDL_HWSURFACE, rather than one or the other. I’m not sure if there’s any
good reason behind that, but might be something worth trying. Maybe I
should
look at the source and see what’s going on…

Just tried it. Didn’t make a difference.

SDL_video.h:#define SDL_SWSURFACE 0x00000000

Of course that won’t make a difference when added or bitwise ORed to the
flags.

Greg V. (hmaon)

    "It's today!" said Piglet.
"My favorite day," said Pooh.On Tue, 6 Mar 2001, Andy Sy wrote: