diff options
author | Sven Gothel <[email protected]> | 2020-03-05 20:04:17 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2020-03-05 20:04:17 +0100 |
commit | d88ca606f67e16c144b36f8fd1f188fdf8531ee0 (patch) | |
tree | fbfdeac8117ab01ea5626672a49c24f01f01354b /make/stub_includes/macosx/UIKit/NSOpenGL.h | |
parent | 3e141416ea6c85c14dc622dae57f071d5fd0ff4f (diff) |
Bug 1398: Ensure CGLContext lock will be acquired before leaving user makeCurrent() call
Command SetNSViewCmd sets NSOpenGLContext's NSView via [NSOpenGLContext setView:]
on the main-thread as enforced since XCode 11 using SDK macosx10.15, see Bug 1398.
This command is injected into OSX's main-thread @ NSOpenGLImpl.makeCurrent(long) only if required,
i.e. issued only for a newly bound NSView and skipped for surface-less or offscreen 'surfaces'.
This operation must be performed w/o blocking other tasks locking the NativeSurface on main-thread to complete.
Since [NSOpenGLContext setView:] acquires the CGLContext lock on the main-thread,
it can't be locked by the calling thread until this task has been completed.
Command issuer NSOpenGLImpl.makeCurrent(long) will not acquire the CGLContext lock if this command is pending.
contextMadeCurrent(true) cures the potential unlocked CGLContext by issuing
a whole GLContext.release() and GLContext.makeCurrent() cycle while waiting for this command to be completed in-between.
This GLContext cycle also ensures an unlocked NativeSurface.getLock() in-between,
allowing potentially blocked other tasks on the main-thread to complete and hence this queued command to execute.
Notable test provoking critical multithreading issues is com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NewtCanvasSWT.
Notable test exposing issues with an unlocked CGLContext is com.jogamp.opengl.test.junit.jogl.glsl.TestGLSLShaderState02NEWT.
Diffstat (limited to 'make/stub_includes/macosx/UIKit/NSOpenGL.h')
0 files changed, 0 insertions, 0 deletions