powervr-graphics / Native_SDK

C++ cross-platform 3D graphics SDK. Includes demos & helper code (resource loading etc.) to speed up development of Vulkan, OpenGL ES 2.0 & 3.x applications
https://docs.imgtec.com/sdk-documentation/html/introduction.html
MIT License
702 stars 197 forks source link

[BUG] macOS Catalina: eglMakeCurrent crashes if not called on ui thread #46

Open wang-bin opened 4 years ago

wang-bin commented 4 years ago

Description

I see eglMakeCurrent() calls [NSOpenGLContext setView:], which must be called in UI thread. Before macOS 10.15 it's not a problem, but xcode will warn about UI API called on non-ui thread if you write similar opengl context code yourself.

BTW, I think setView should be called in eglCreateWindowSurface but not eglMakeCurrent.

Repro steps

Environment

Additional Info

Thread 6 Crashed:
0   com.apple.AppKit                0x00007fff38180cbc -[NSOpenGLContext setView:] + 229
1   libEGL.dylib                    0x0000000119687a4c cocoa_make_current(void*, void*) + 124
2   libEGL.dylib                    0x00000001196882c4 glove::GLContext::make_current(void*) const + 20
3   libEGL.dylib                    0x00000001196393f1 egl::Context::make_current(std::__1::shared_ptr<egl::Surface>, std::__1::shared_ptr<egl::Surface>) + 641
4   libEGL.dylib                    0x00000001196391f9 egl::Context::make_current(std::__1::shared_ptr<egl::Surface>, std::__1::shared_ptr<egl::Surface>) + 137
5   libEGL.dylib                    0x00000001196410f4 eglMakeCurrent + 740
omarzohdi commented 4 years ago

Hi @wang-bin, thanks for bringing this up. The powervr SDK was not tested against macOS 10.15. We'll be looking into the issue and providing a patch as soon as possible.

SPConrad commented 3 years ago

Is this still being investigated?