aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/opengl/GLContextImpl.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-10-13 13:02:32 +0200
committerSven Gothel <[email protected]>2011-10-13 13:02:32 +0200
commit5d33b0a3ef993ff2d257c90abc3d84bc93269cd0 (patch)
treeb6a0a984ce20f8f57a37932476cde851ab31d72e /src/jogl/classes/jogamp/opengl/GLContextImpl.java
parenta8c14db739c8d7765d1a204f73b5708faac07fdd (diff)
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.
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/GLContextImpl.java')
-rw-r--r--src/jogl/classes/jogamp/opengl/GLContextImpl.java28
1 files changed, 9 insertions, 19 deletions
diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
index 283b0c751..5bf0b53a2 100644
--- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
@@ -119,7 +119,7 @@ public abstract class GLContextImpl extends GLContext {
if (shareWith != null) {
GLContextShareSet.registerSharing(this, shareWith);
}
- GLContextShareSet.registerForBufferObjectSharing(shareWith, this);
+ GLContextShareSet.synchronizeBufferObjectSharing(shareWith, this);
this.drawable = drawable;
this.drawableRead = drawable;
@@ -266,23 +266,6 @@ public abstract class GLContextImpl extends GLContext {
// don't destroy the context out from under another thread rendering to it
lockConsiderFailFast();
try {
- /* FIXME: refactor dependence on Java 2D / JOGL bridge
- if (tracker != null) {
- // Don't need to do anything for contexts that haven't been
- // created yet
- if (isCreated()) {
- // If we are tracking creation and destruction of server-side
- // OpenGL objects, we must decrement the reference count of the
- // GLObjectTracker upon context destruction.
- //
- // Note that we can only eagerly delete these server-side
- // objects if there is another context currrent right now
- // which shares textures and display lists with this one.
- tracker.unref(deletedObjectTracker);
- }
- }
- */
-
if (contextHandle != 0) {
int lockRes = drawable.lockSurface();
if (NativeSurface.LOCK_SURFACE_NOT_READY == lockRes) {
@@ -291,9 +274,16 @@ public abstract class GLContextImpl extends GLContext {
}
try {
destroyImpl();
+ if (DEBUG) {
+ System.err.println("GLContextImpl.destroy: " + toHexString(contextHandle) +
+ ", isShared "+GLContextShareSet.isShared(this));
+ }
contextHandle = 0;
glDebugHandler = null;
- GLContextShareSet.contextDestroyed(this);
+ // this maybe impl. in a platform specific way to release remaining shared ctx.
+ if(GLContextShareSet.contextDestroyed(this) && !GLContextShareSet.hasCreatedSharedLeft(this)) {
+ GLContextShareSet.unregisterSharing(this);
+ }
} finally {
drawable.unlockSurface();
}