Offering $100 if you can fix this

Please see message here. It’s about a slowdown using SDL 1.3 when fullscreen using OpenGL on some Mac OS X systems.

I’m offering $100 to anyone who can find and fix the cause of this issue, if it’s done within the next 2 days.

I’m offering $100 to anyone who can find and fix the cause of this
issue, if it’s done within the next 2 days.

(Despite testgl2 doing this) don’t call SDL_GL_MakeCurrent() every frame.

Do I get the 100 dollars? :slight_smile:

–ryan.

(Despite testgl2 doing this) don’t call SDL_GL_MakeCurrent() every frame.

The latest SDL in Mercurial now handles the case of trying to make the
current context current, and now testgl2.c no longer runs at 30fps in
fullscreen on Mac OS X.

–ryan.

Ryan C. Gordon wrote:

(Despite testgl2 doing this) don’t call SDL_GL_MakeCurrent() every frame.

The latest SDL in Mercurial now handles the case of trying to make the
current context current, and now testgl2.c no longer runs at 30fps in
fullscreen on Mac OS X.

Wow, I’m a little embarrassed that the cause of the problem was so basic!

But yes, the $100 is yours if you want it! I wasn’t kidding about the offer. I’m very grateful to get this fixed, if this is indeed the same issue causing a slowdown in my app. (I’m guessing it is, as my app also calls the same function once every frame.)

Hmmm… building with the latest Mercurial version, my app no longer handles window resizes properly. The former version I was using, SDL-1.3.0-5557, worked just fine. Not sure if its your change to SDL_GL_MakeCurrent() that’s causing this issue or not. I’ll try removing your change and see what happens to find out.

Indeed, your fix turned out to be the cause of the window-resizing issues.

I tried a workaround, and it seems to work? I modified in SDL_video.c:

void
SDL_OnWindowResized(SDL_Window * window)
{
// NEW LINE: Our cached context is no longer valid
_this->current_glctx = NULL;

window->surface_valid = SDL_FALSE;
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_SIZE_CHANGED, window->w, window->h);

}

I have no idea if this is a “complete” solution or not, but it did fix the problem in my game when the window was resized. You think the current context “cached” needs to be cleared in other situations too?

I have no idea if this is a “complete” solution or not, but it did fix
the problem in my game when the window was resized. You think the
current context “cached” needs to be cleared in other situations too?

The Cocoa docs say we need to use the “update” message on the GL context
every time it moves or resizes, so I sprinkled that around in the
appropriate places (SDL_GL_MakeCurrent() was calling “update” every
time, hiding this issue).

So the latest in Mercurial should fix this now. testgl2 --resize works
with this fix, at least.

–ryan.

But yes, the $100 is yours if you want it!

That’s okay, you can keep it. :slight_smile:

–ryan.

Thanks so much Ryan, this bug was holding me back from releasing my game, and now I can!