From 5d33b0a3ef993ff2d257c90abc3d84bc93269cd0 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Thu, 13 Oct 2011 13:02:32 +0200 Subject: MacOSX: Fix shared ctx release [onMainThread]; Make GLContextShareSet lifecycle deterministic; Remove warnings Fix shared ctx release [onMainThread] - Releasing the shared contexts caused a freeze of about 10s from one of the shared release operations. [NSOpenGLContext release] - Thorough triage concluded the workaround to release the shared ctx on the main thread. - Using enhanced GLContextShareSet, see below Make GLContextShareSet lifecycle deterministic - Programmatically control the lifecycle of tracked shared ctx allows us using 'hard' references. - Features queries for isShared() and ofc unregister a share set if all are destroyed. Remove warnings - MacOSXWindowSystemInterface.m used 'long', where 'GLint' was requested. --- .../classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java') diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java index 6d6b79b42..b35e38d02 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java @@ -42,9 +42,11 @@ package jogamp.opengl.macosx.cgl; import java.nio.*; import java.util.*; + import javax.media.opengl.*; import javax.media.nativewindow.*; import jogamp.opengl.*; + import com.jogamp.gluegen.runtime.ProcAddressTable; import com.jogamp.gluegen.runtime.opengl.GLProcAddressResolver; @@ -204,14 +206,15 @@ public abstract class MacOSXCGLContext extends GLContextImpl throw new GLException("Unable to delete OpenGL Context (CGL)"); } if (DEBUG) { - System.err.println("!!! Destroyed OpenGL Context (CGL) " + contextHandle); + System.err.println("!!! Destroyed OpenGL Context (CGL) " + toHexString(contextHandle)); } } else { - if (!CGL.deleteContext(contextHandle)) { - throw new GLException("Unable to delete OpenGL Context (NS)"); + final boolean isSharedContext = GLContextShareSet.isShared(this); + if (!CGL.deleteContext(contextHandle, isSharedContext)) { + throw new GLException("Unable to delete OpenGL Context (NS) "+toHexString(contextHandle)+", isShared "+isSharedContext); } if (DEBUG) { - System.err.println("!!! Destroyed OpenGL Context (NS) " + contextHandle); + System.err.println("!!! Destroyed OpenGL Context (NS.s0) " + toHexString(contextHandle)+", isShared "+isSharedContext); } } } -- cgit v1.2.3