We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 2320 - OpenGL Context lost / broken on Macs (OS X 10.9 + GeForce) when Steam overlay appears
Summary: OpenGL Context lost / broken on Macs (OS X 10.9 + GeForce) when Steam overlay...
Status: RESOLVED WONTFIX
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: 2.0.1
Hardware: x86 Other
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-12-20 19:11 UTC by philhassey
Modified: 2017-08-15 03:54 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description philhassey 2013-12-20 19:11:27 UTC
Overview:

On OS X 10.9 Mavericks on some GeForce video cards, the OpenGL context is lost / broken when the Steam overlay appears.

Steps to Reproduce:

1. Have OS X 10.9 Mavericks and a GeForce video card.
2. Make sure the overlay is enabled on your Mac.
3. Start up "Galcon Legends" (not publicly available yet, I can provide beta keys upon request)
4. Wait until the overlay appears.

Actual Results:

Most textures disappear or stop working.

Expected Results:

The overlay should not interfere with the game.

OR there should be an Event notifying me that the Context has been lost so I can re-load textures.

Hardware:

OS X 10.9 Mavericks
GeForce 9400 / 256MB, GeForce GT 330M / 256MB

Video of issue:

http://www.youtube.com/watch?v=ZbCRAn3ajvk&feature=youtu.be

Steamworks Development Community thread:

http://steamcommunity.com/groups/steamworks/discussions/12/666828127036283052/

Other notes:

Galcon Legends uses OpenGL ES 1.1 style GL code.

I added in code to call glIsTexture on all my textures after each resize even to  reload textures if something got lost.  The code did not detect any lost textures.

Thanks!
-Phil
Comment 1 Sam Lantinga 2013-12-22 21:40:04 UTC
Hey Phil, can you send me two keys via e-mail so we can reproduce this?
Comment 2 philhassey 2014-01-08 18:56:39 UTC
I've sent in those keys and I've created a branch on my Steam App "sdl2-bug-2320" that contains a version of my game with this issue.

(Since I'm going live soon, I'm going to work on workarounds to reload all textures when I receive resize events, so future builds of Galcon Legends may not reproduce this issue.)
Comment 3 Sam Lantinga 2014-01-08 22:37:53 UTC
Hey Phil, I tried that beta branch on Mac OS X 10.9 and I'm not seeing the issue here.

Out of curiosity, how are you running OpenGL ES 1.1 code on Mac OS X?

Do you have a simple repro-case application with source that I can drop in to test it out?

Thanks!
Comment 4 philhassey 2014-01-08 23:38:44 UTC
The bug is still present in the "default" branch after some experimenting today.  I have disabled the sdl2-bug-2320 branch for now.

The bug ONLY appears on GeForce cards.  (Since I don't have one of these, I've been getting feedback from a few beta users to verify if I'm making any progress.)

I have added in a hot-key "CTRL-R" that forces a SDL_GL_DeleteContext, SDL_GL_CreateContext and a reload of all textures.  This makes it so when the problem happens people are able to reset things and continue playing.

I'm not sure I can provide a simpler example since I can't reproduce the issue on my own computer, unfortunately.  I do all my dev on OS X Mavericks Macs, but none of them have GeForce video cards.

Thanks!
-Phil
Comment 5 philhassey 2014-01-08 23:42:23 UTC
To answer the OpenGL ES question: I'm just using normal OpenGL 1.x, just keeping to the subset that is the same as GLES.  (I use maybe one or two #defines to handle slightly different function names.)  So I'm not doing anything strange here.
Comment 6 Gabriel Jacobo 2014-01-09 22:47:51 UTC
A stab in the dark...it seems rare that the context be lost. Did you try a:

    SDL_GL_MakeCurrent(window, NULL);
    SDL_GL_MakeCurrent(window, context);

as a workaround?
Comment 7 Ryan C. Gordon 2015-02-18 21:40:41 UTC
Phil, did this ever get resolved in some way? I have Macs with these GPUs, I think, if it still needs resolution.

--ryan.
Comment 8 philhassey 2015-02-24 16:54:46 UTC
This issue is still active for me.  You can see it in Galcon 2:

http://store.steampowered.com/app/294160 (free)

Load it up, when the overlay appears, textures vanish, press CTRL-R to reload them.

I'm using SDL Runtime Version: 2.0.1 because some other fullscreen issues were in newer versions of SDL 2 (but I think those were fixed in hg.)  So I can't say for sure if it's still a problem or not.  

(This doesn't happen on my Mac, because I have a different video card.)

Thanks!
-Phil
Comment 9 Ryan C. Gordon 2015-02-24 18:56:57 UTC
Adding to the triage list. Will try to reproduce.

--ryan.
Comment 10 Ryan C. Gordon 2015-02-24 19:09:55 UTC
Oh yeah, that's totally broken.

I have to research this more, but it's possible the Steam Overlay is trampling some GL state and it has nothing to do with SDL. I'll push it through OpenGL Profiler and see what's happening.

In the name of heroic measures, if you're using the Steamworks SDK, it fires a callback when the Overlay appears or vanishes, so you can just reload stuff when that happens as a workaround...but fixing the bug is a better idea. I'll report back.

--ryan.
Comment 11 philhassey 2015-02-24 19:21:27 UTC
Thanks for checking it out.  I tried a bunch of workarounds a while ago, and decided it was easiest to tell people with the issue to press CTRL-R, which tells my game to force-reload all the textures.

I did just look back in the Steam community thread I started ages ago, and it appears someone figured out some kind of workaround .. maybe.

http://steamcommunity.com/groups/steamworks/discussions/12/666828127036283052/

Maybe someone can convince Steam to fix this if it is an issue on their end.

-Phil
Comment 12 Ryan C. Gordon 2015-03-25 14:37:56 UTC
(In reply to philhassey from comment #11)
> Maybe someone can convince Steam to fix this if it is an issue on their end.

This is on Valve's radar now. I'll leave the bug open for now, so I remember to check back on it.

--ryan.
Comment 13 philhassey 2016-04-02 23:29:40 UTC
Someone in the Steamworks Development community figured out how to work around this issue with the overlay:

http://steamcommunity.com/groups/steamworks/discussions/12/618463446164757945/

So for SDL2 games, this means adding these lines to your project before calling SDL_GL_SwapBuffers():

    glVertexPointer(4, GL_FLOAT, 0, 0);
    glColorPointer(4, GL_FLOAT, 0, 0);
    glTexCoordPointer(4, GL_FLOAT, 0, 0);

I suppose this could be either added into SDL2, or fixed in the Steam client.

-Phil
Comment 14 Sam Lantinga 2017-08-15 03:54:05 UTC
This needs to be fixed on the Steam side of things, if it hasn't already been taken care of.