macOS 10.14 (Mojave) issues

Hi everyone. I’m testing SDL’s default branch on Mojave and noticing a weird glitch. The window appears just fine, but is empty (black) until you move (e.g. drag title bar with cursor) or resize the window. Basically, it seems like the entire OpenGL context isn’t being rendered until some window action takes place to force it — even glClearColor() has no effect until the window interaction. So far, I’ve seen the same results in the tests testdraw2.c and testshader.c, and also in my 2D engine with custom GL2.1 and GL3.3 forward-compatible backends. I’m happy to dig in further to troubleshoot (been looking for an opportunity to contribute back), but wanted to post here to see if anyone has some initial ideas or areas to investigate. Thanks!

Ok, I’ve done some naïve testing and found that in testshader.c, if I put a…

SDL_PumpEvents();
SDL_SetWindowSize(window, width, height);

after the call to SDL_GL_CreateContext(window), the OpenGL contents will appear. Very interesting. :face_with_monocle:

I currently have this issue with my application as well.

To add to this, my application has 2 SDL windows, one that just uses the SDL_Renderer and one that uses an explicit OpenGL context. The OpenGL window can be opened optionally and renders on a separate thread. This worked fine on High Sierra, but now with Mojave, whenever I open this window now, the entire program freezes. Stepping through the debugger during these freezes works fine at first glance.

Haven’t figured out a way around this yet.

Same problem for me. As a temporary solution I’ve added
[NSTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(scheduleUpdate) userInfo:nil repeats:NO];
at the end of - (void)setWindow:(SDL_Window *)newWindow method in video/cocoa/SDL_cocoaopengl.m

Also I had a problem with wrong OpenGL scissor coordinates. Method static int GL_UpdateClipRect(SDL_Renderer * renderer) in render/opengl/SDL_render_gl.c doesn’t works correctly after updating to Mojave.
SDL_GL_GetDrawableSize(renderer->window, &w, &h); now returns double size for drawable dimensions when launched on HiDPI screen, so scissor coordinates become broken and nothing is displayed on screen. Probably it is not a problem with SDL, but problem with SDL usage in my code, but same code worked fine in High Sierra.

Here are a few, logistically-inclined notes on this, posted for posterity, and perhaps convenience:

Two bugs (at least) have been filed against this:

Ryan (icculus) has posted at least one fix so far, which is how up on SDL HG, specifically at https://hg.libsdl.org/SDL/rev/55489adbb75c

2 Likes

I’ve read a report about it being a problem for SDL 1.2x as well

Once we wrestle this to the ground in SDL2, I assume a 1.2 fix will be straightforward enough.

FWIW, my app stopped working in Mojave and failed on either glClear (when checking glGetError) or GL_FRAMEBUFFER_UNDEFINED (when checking glCheckFramebufferStatus) when switching to framebuffer 0 (default), but I built latest SDL from source (dbdc76) and my application works there.

1 Like

@icculus has there been a fix for SDL 1.2 yet? I’m kind of desperate for one :slight_smile:

first testing seems to indicate that https://hg.libsdl.org/SDL/rev/ab7529cb9558 fixed it