| Summary: | NSOpenGLContext setView and update methods must be called from main thread | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Tim McDaniel <tmcdaniel> |
| Component: | video | Assignee: | Ryan C. Gordon <icculus> |
| Status: | REOPENED --- | QA Contact: | Sam Lantinga <slouken> |
| Severity: | critical | ||
| Priority: | P2 | CC: | icculus, mr_helmut |
| Version: | 2.0.15 | Keywords: | target-2.0.14 |
| Hardware: | All | ||
| OS: | macOS 10.15 | ||
| Attachments: | dispatch GL context updates to main thread | ||
|
Description
Tim McDaniel
2020-01-08 00:27:46 UTC
I should add: In our internal SDL fork, in Cocoa_GL_MakeCurrent, as an optimization we skip [nscontext setWindow:window]; [nscontext updateIfNeeded]; if the passed in window is the same as the nscontext's current window, since those calls are unnecessary in that case. Thanks, can you provide a tested patch? Created attachment 4155 [details]
dispatch GL context updates to main thread
I can't vouch for the viability of this patch, as I have not tested it as-is. I have removed some of our mods that would only muddy the waters, and are specific to our SDL fork. Specifically, with our mods, we take explicit control of GL context updates by passing in a NULL window pointer to SDL_GL_MakeCurrent, which disables SDL's automatic context update mechanism (e.g. context update when window is resized) and causes an explicit forced update.
This patch looks reasonable to me. With minor changes to make it apply, it's now https://hg.libsdl.org/SDL/rev/19c4516de68d, thanks! --ryan. Hello there, Maintainer of MonoGame here. MonoGame uses SDL on macOS and we believe that this issue might not have been addressed properly. We have a macOS build bot on the MonoGame repository which runs tests in threads with NUnit and since SDL 2.0.14 the tests are getting frozen upon calling SDL_GL_CreateContext (which never returns). We assumed a threading issue and narrowed this down to these changes https://hg.libsdl.org/SDL/rev/19c4516de68d Reverting them worked. Cheers, Thomas |