From 5d33b0a3ef993ff2d257c90abc3d84bc93269cd0 Mon Sep 17 00:00:00 2001 From: Sven Gothel <sgothel@jausoft.com> 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. --- .../opengl/macosx/cgl/MacOSXPbufferCGLContext.java | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLContext.java') diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLContext.java index 75b54504a..efc70e3dd 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLContext.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLContext.java @@ -117,12 +117,7 @@ public class MacOSXPbufferCGLContext extends MacOSXCGLContext { } protected void destroyImpl() throws GLException { - if (!impl.destroy(contextHandle)) { - throw new GLException("Unable to delete OpenGL context"); - } - if (DEBUG) { - System.err.println("!!! Destroyed OpenGL context " + contextHandle); - } + impl.destroy(contextHandle); } protected void setSwapIntervalImpl(int interval) { @@ -212,7 +207,7 @@ public class MacOSXPbufferCGLContext extends MacOSXCGLContext { interface Impl { public boolean isNSContext(); public long create(); - public boolean destroy(long ctx); + public void destroy(long ctx); public boolean makeCurrent(long ctx); public boolean release(long ctx); public void setSwapInterval(long ctx, int interval); @@ -237,8 +232,8 @@ public class MacOSXPbufferCGLContext extends MacOSXCGLContext { return contextHandle; } - public boolean destroy(long ctx) { - return CGL.deleteContext(ctx); + public void destroy(long ctx) { + MacOSXPbufferCGLContext.super.destroyImpl(); } public boolean makeCurrent(long ctx) { @@ -344,8 +339,13 @@ public class MacOSXPbufferCGLContext extends MacOSXCGLContext { return ctx.get(0); } - public boolean destroy(long ctx) { - return (CGL.CGLDestroyContext(ctx) == CGL.kCGLNoError); + public void destroy(long ctx) { + if (CGL.CGLDestroyContext(ctx) != CGL.kCGLNoError) { + throw new GLException("Unable to delete OpenGL context (cgl)"); + } + if (DEBUG) { + System.err.println("!!! Destroyed OpenGL context (cgl)" + contextHandle); + } } public boolean makeCurrent(long ctx) { -- cgit v1.2.3