aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp
diff options
context:
space:
mode:
Diffstat (limited to 'src/jogl/classes/jogamp')
-rw-r--r--src/jogl/classes/jogamp/opengl/GLContextImpl.java66
-rw-r--r--src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java4
2 files changed, 35 insertions, 35 deletions
diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
index 9280d9830..a528c60be 100644
--- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
@@ -206,11 +206,11 @@ public abstract class GLContextImpl extends GLContext {
throw new GLException("Setting read drawable feature not available");
}
final Thread currentThread = Thread.currentThread();
- if( contextLock.isLockedByOtherThread() ) {
- throw new GLException("GLContext current by other thread "+contextLock.getOwner().getName()+", operation not allowed on this thread "+currentThread.getName());
+ if( lock.isLockedByOtherThread() ) {
+ throw new GLException("GLContext current by other thread "+lock.getOwner().getName()+", operation not allowed on this thread "+currentThread.getName());
}
- final boolean lockHeld = contextLock.isOwner(currentThread);
- if( lockHeld && contextLock.getHoldCount() > 1 ) {
+ final boolean lockHeld = lock.isOwner(currentThread);
+ if( lockHeld && lock.getHoldCount() > 1 ) {
// would need to makeCurrent * holdCount
throw new GLException("GLContext is recursively locked - unsupported for setGLDrawable(..)");
}
@@ -234,11 +234,11 @@ public abstract class GLContextImpl extends GLContext {
public final GLDrawable setGLDrawable(final GLDrawable readWrite, final boolean setWriteOnly) {
// Validate constraints first!
final Thread currentThread = Thread.currentThread();
- if( contextLock.isLockedByOtherThread() ) {
- throw new GLException("GLContext current by other thread "+contextLock.getOwner().getName()+", operation not allowed on this thread "+currentThread.getName());
+ if( lock.isLockedByOtherThread() ) {
+ throw new GLException("GLContext current by other thread "+lock.getOwner().getName()+", operation not allowed on this thread "+currentThread.getName());
}
- final boolean lockHeld = contextLock.isOwner(currentThread);
- if( lockHeld && contextLock.getHoldCount() > 1 ) {
+ final boolean lockHeld = lock.isOwner(currentThread);
+ if( lockHeld && lock.getHoldCount() > 1 ) {
// would need to makeCurrent * holdCount
throw new GLException("GLContext is recursively locked - unsupported for setGLDrawable(..)");
}
@@ -339,11 +339,11 @@ public abstract class GLContextImpl extends GLContext {
private void release(final boolean inDestruction) throws GLException {
if( TRACE_SWITCH ) {
final long drawH = null != drawable ? drawable.getHandle() : 0;
- System.err.println(getThreadName() +": GLContext.ContextSwitch[release.0]: obj " + toHexString(hashCode()) + ", ctx "+toHexString(contextHandle)+", surf "+(null!=drawable)+" "+toHexString(drawH)+", inDestruction: "+inDestruction+", "+contextLock);
+ System.err.println(getThreadName() +": GLContext.ContextSwitch[release.0]: obj " + toHexString(hashCode()) + ", ctx "+toHexString(contextHandle)+", surf "+(null!=drawable)+" "+toHexString(drawH)+", inDestruction: "+inDestruction+", "+lock);
}
- if ( !contextLock.isOwner(Thread.currentThread()) ) {
+ if ( !lock.isOwner(Thread.currentThread()) ) {
final long drawH = null != drawable ? drawable.getHandle() : 0;
- final String msg = getThreadName() +": Context not current on thread, obj " + toHexString(hashCode())+", ctx "+toHexString(contextHandle)+", surf "+(null!=drawable)+" "+toHexString(drawH)+", inDestruction: "+inDestruction+", "+contextLock;
+ final String msg = getThreadName() +": Context not current on thread, obj " + toHexString(hashCode())+", ctx "+toHexString(contextHandle)+", surf "+(null!=drawable)+" "+toHexString(drawH)+", inDestruction: "+inDestruction+", "+lock;
if( DEBUG_TRACE_SWITCH ) {
System.err.println(msg);
if( null != lastCtxReleaseStack ) {
@@ -357,7 +357,7 @@ public abstract class GLContextImpl extends GLContext {
}
Throwable drawableContextMadeCurrentException = null;
- final boolean actualRelease = ( inDestruction || contextLock.getHoldCount() == 1 ) && 0 != contextHandle;
+ final boolean actualRelease = ( inDestruction || lock.getHoldCount() == 1 ) && 0 != contextHandle;
try {
if( actualRelease ) {
if( !inDestruction ) {
@@ -374,10 +374,10 @@ public abstract class GLContextImpl extends GLContext {
if( actualRelease ) {
setCurrent(null);
}
- contextLock.unlock();
+ lock.unlock();
drawable.unlockSurface();
if( DEBUG_TRACE_SWITCH ) {
- final String msg = getThreadName() +": GLContext.ContextSwitch[release.X]: obj " + toHexString(hashCode()) + ", ctx "+toHexString(contextHandle)+", surf "+toHexString(drawable.getHandle())+" - "+(actualRelease?"switch":"keep ")+" - "+contextLock;
+ final String msg = getThreadName() +": GLContext.ContextSwitch[release.X]: obj " + toHexString(hashCode()) + ", ctx "+toHexString(contextHandle)+", surf "+toHexString(drawable.getHandle())+" - "+(actualRelease?"switch":"keep ")+" - "+lock;
lastCtxReleaseStack = new Throwable(msg);
if( TRACE_SWITCH ) {
System.err.println(msg);
@@ -397,7 +397,7 @@ public abstract class GLContextImpl extends GLContext {
if ( DEBUG_TRACE_SWITCH ) {
final long drawH = null != drawable ? drawable.getHandle() : 0;
System.err.println(getThreadName() + ": GLContextImpl.destroy.0: obj " + toHexString(hashCode()) + ", ctx " + toHexString(contextHandle) +
- ", surf "+(null!=drawable)+" "+toHexString(drawH)+", isShared "+GLContextShareSet.isShared(this)+" - "+contextLock);
+ ", surf "+(null!=drawable)+" "+toHexString(drawH)+", isShared "+GLContextShareSet.isShared(this)+" - "+lock);
}
if ( 0 != contextHandle ) { // isCreated() ?
if ( null == drawable ) {
@@ -415,17 +415,17 @@ public abstract class GLContextImpl extends GLContext {
}
// Must hold the lock around the destroy operation to make sure we
// don't destroy the context while another thread renders to it.
- contextLock.lock(); // holdCount++ -> 1 - n (1: not locked, 2-n: destroy while rendering)
+ lock.lock(); // holdCount++ -> 1 - n (1: not locked, 2-n: destroy while rendering)
if ( DEBUG_TRACE_SWITCH ) {
- if ( contextLock.getHoldCount() > 2 ) {
+ if ( lock.getHoldCount() > 2 ) {
final String msg = getThreadName() + ": GLContextImpl.destroy: obj " + toHexString(hashCode()) + ", ctx " + toHexString(contextHandle);
- System.err.println(msg+" - Lock was hold more than once - makeCurrent/release imbalance: "+contextLock);
+ System.err.println(msg+" - Lock was hold more than once - makeCurrent/release imbalance: "+lock);
Thread.dumpStack();
}
}
try {
// if not current, makeCurrent(), to call associateDrawable(..) and to disable debug handler
- if ( contextLock.getHoldCount() == 1 ) {
+ if ( lock.getHoldCount() == 1 ) {
if ( GLContext.CONTEXT_NOT_CURRENT == makeCurrent() ) {
throw new GLException("GLContext.makeCurrent() failed: "+toString());
}
@@ -443,7 +443,7 @@ public abstract class GLContextImpl extends GLContext {
defaultVAO = 0;
}
glDebugHandler.enable(false);
- if(contextLock.getHoldCount() > 1) {
+ if(lock.getHoldCount() > 1) {
// pending release() after makeCurrent()
release(true);
}
@@ -456,10 +456,10 @@ public abstract class GLContextImpl extends GLContext {
}
resetStates(false);
} finally {
- contextLock.unlock();
+ lock.unlock();
if ( DEBUG_TRACE_SWITCH ) {
System.err.println(getThreadName() + ": GLContextImpl.destroy.X: obj " + toHexString(hashCode()) + ", ctx " + toHexString(contextHandle) +
- ", isShared "+GLContextShareSet.isShared(this)+" - "+contextLock);
+ ", isShared "+GLContextShareSet.isShared(this)+" - "+lock);
}
}
} finally {
@@ -545,11 +545,11 @@ public abstract class GLContextImpl extends GLContext {
final boolean hasDrawable = null != drawable;
if( TRACE_SWITCH ) {
final long drawH = null != drawable ? drawable.getHandle() : 0;
- System.err.println(getThreadName() +": GLContext.ContextSwitch[makeCurrent.0]: obj " + toHexString(hashCode()) + ", ctx "+toHexString(contextHandle)+", surf "+hasDrawable+" "+toHexString(drawH)+" - "+contextLock);
+ System.err.println(getThreadName() +": GLContext.ContextSwitch[makeCurrent.0]: obj " + toHexString(hashCode()) + ", ctx "+toHexString(contextHandle)+", surf "+hasDrawable+" "+toHexString(drawH)+" - "+lock);
}
if( !hasDrawable ) {
if( DEBUG_TRACE_SWITCH ) {
- System.err.println(getThreadName() +": GLContext.ContextSwitch[makeCurrent.X0]: obj " + toHexString(hashCode()) + ", ctx "+toHexString(contextHandle)+" - NULL Drawable - CONTEXT_NOT_CURRENT - "+contextLock);
+ System.err.println(getThreadName() +": GLContext.ContextSwitch[makeCurrent.X0]: obj " + toHexString(hashCode()) + ", ctx "+toHexString(contextHandle)+" - NULL Drawable - CONTEXT_NOT_CURRENT - "+lock);
}
return CONTEXT_NOT_CURRENT;
}
@@ -558,7 +558,7 @@ public abstract class GLContextImpl extends GLContext {
final int lockRes = drawable.lockSurface();
if (NativeSurface.LOCK_SURFACE_NOT_READY >= lockRes) {
if( DEBUG_TRACE_SWITCH ) {
- System.err.println(getThreadName() +": GLContext.ContextSwitch[makeCurrent.X1]: obj " + toHexString(hashCode()) + ", ctx "+toHexString(contextHandle)+", surf "+toHexString(drawable.getHandle())+" - Surface Not Ready - CONTEXT_NOT_CURRENT - "+contextLock);
+ System.err.println(getThreadName() +": GLContext.ContextSwitch[makeCurrent.X1]: obj " + toHexString(hashCode()) + ", ctx "+toHexString(contextHandle)+", surf "+toHexString(drawable.getHandle())+" - Surface Not Ready - CONTEXT_NOT_CURRENT - "+lock);
}
return CONTEXT_NOT_CURRENT;
}
@@ -570,7 +570,7 @@ public abstract class GLContextImpl extends GLContext {
if ( 0 == drawable.getHandle() ) {
throw new GLException("drawable has invalid handle: "+drawable);
}
- contextLock.lock();
+ lock.lock();
try {
// One context can only be current by one thread,
// and one thread can only have one context current!
@@ -582,7 +582,7 @@ public abstract class GLContextImpl extends GLContext {
drawableUpdatedNotify();
unlockResources = false; // success
if( TRACE_SWITCH ) {
- System.err.println(getThreadName() +": GLContext.ContextSwitch[makeCurrent.X2]: obj " + toHexString(hashCode()) + ", ctx "+toHexString(contextHandle)+", surf "+toHexString(drawable.getHandle())+" - keep - CONTEXT_CURRENT - "+contextLock);
+ System.err.println(getThreadName() +": GLContext.ContextSwitch[makeCurrent.X2]: obj " + toHexString(hashCode()) + ", ctx "+toHexString(contextHandle)+", surf "+toHexString(drawable.getHandle())+" - keep - CONTEXT_CURRENT - "+lock);
}
return CONTEXT_CURRENT;
} else {
@@ -605,9 +605,9 @@ public abstract class GLContextImpl extends GLContext {
} finally {
if (unlockResources) {
if( DEBUG_TRACE_SWITCH ) {
- System.err.println(getThreadName() +": GLContext.ContextSwitch[makeCurrent.1]: Context lock.unlock() due to error, res "+makeCurrentResultToString(res)+", "+contextLock);
+ System.err.println(getThreadName() +": GLContext.ContextSwitch[makeCurrent.1]: Context lock.unlock() due to error, res "+makeCurrentResultToString(res)+", "+lock);
}
- contextLock.unlock();
+ lock.unlock();
}
}
} /* if ( drawable.isRealized() ) */
@@ -658,7 +658,7 @@ public abstract class GLContextImpl extends GLContext {
*/
}
if( TRACE_SWITCH ) {
- System.err.println(getThreadName() +": GLContext.ContextSwitch[makeCurrent.X3]: obj " + toHexString(hashCode()) + ", ctx "+toHexString(contextHandle)+", surf "+toHexString(drawable.getHandle())+" - switch - "+makeCurrentResultToString(res)+" - stateTracker.on "+glStateTracker.isEnabled()+" - "+contextLock);
+ System.err.println(getThreadName() +": GLContext.ContextSwitch[makeCurrent.X3]: obj " + toHexString(hashCode()) + ", ctx "+toHexString(contextHandle)+", surf "+toHexString(drawable.getHandle())+" - switch - "+makeCurrentResultToString(res)+" - stateTracker.on "+glStateTracker.isEnabled()+" - "+lock);
}
return res;
}
@@ -2223,7 +2223,7 @@ public abstract class GLContextImpl extends GLContext {
* </p>
*/
public final boolean isOwner(final Thread thread) {
- return contextLock.isOwner(thread);
+ return lock.isOwner(thread);
}
/**
@@ -2233,7 +2233,7 @@ public abstract class GLContextImpl extends GLContext {
* </p>
*/
public final boolean hasWaiters() {
- return contextLock.getQueueLength()>0;
+ return lock.getQueueLength()>0;
}
/**
@@ -2243,7 +2243,7 @@ public abstract class GLContextImpl extends GLContext {
* </p>
*/
public final int getLockCount() {
- return contextLock.getHoldCount();
+ return lock.getHoldCount();
}
//---------------------------------------------------------------------------
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java
index ddfa873ae..7066a6db5 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java
@@ -726,7 +726,7 @@ public class MacOSXCGLContext extends GLContextImpl
final RecursiveLock surfaceLock = ols.getLock();
if( surfaceLock.tryLock( maxwait ) ) {
try {
- if( MacOSXCGLContext.this.contextLock.tryLock( maxwait ) ) {
+ if( MacOSXCGLContext.this.lock.tryLock( maxwait ) ) {
try {
nsOpenGLLayer = CGL.createNSOpenGLLayer(ctx, shaderProgram, pfmt, pbuffer, texID, isOpaque,
texWidth, texHeight, winWidth, winHeight);
@@ -739,7 +739,7 @@ public class MacOSXCGLContext extends GLContextImpl
System.err.println("NSOpenGLLayer.Attach: OK, layer "+toHexString(nsOpenGLLayer)+" w/ pbuffer "+toHexString(pbuffer)+", texID "+texID+", texSize "+lastWidth+"x"+lastHeight+", drawableHandle "+toHexString(drawable.getHandle())+" - "+getThreadName());
}
} finally {
- MacOSXCGLContext.this.contextLock.unlock();
+ MacOSXCGLContext.this.lock.unlock();
}
}
} finally {