From 2fe180fbee15b82e2ae14fe3c95887db246c874d Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sun, 27 Jan 2013 14:08:07 +0100 Subject: Bug 665 (part 3) - Allow dis-association of GLContext's GLDrawable .. - Add EGL/ES2 tests, attempt to fix wrapped EGL case - Bug 665 (part 2) was commit 7fd5f76e1eb4bbf93fe9b1171744bd755d8f96e4 - Add EGL/ES2 tests in - TestGLContextDrawableSwitch01NEWT - TestGLContextDrawableSwitch11NEWT - Attempt to fix wrapped EGL case (incomplete) - Using EGL/ES w/ non native EGL device/surface, but natively wrapped instances (most of the cases), a 'complicated' delegation of Native-Upstream -> EGL-Proxy -> EGL-Instance is being used heavily relying on the objects lifecycle. GLEventListenerState tries to roll back the realized state and even sets the upstream device handle, but this doesn't seem to be sufficient on X11. Discussion: It might turn out that we only can implement the survival of GLContext and it's display device reliable w/ EGL within the GLAutoDrawable implementation, which can hold the previous not destructed instances. --- src/jogl/classes/jogamp/opengl/GLContextImpl.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/jogl/classes/jogamp/opengl/GLContextImpl.java') diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java index 2a2b6a8fd..b17fce569 100644 --- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java @@ -206,11 +206,12 @@ public abstract class GLContextImpl extends GLContext { if( drawable == readWrite && ( setWriteOnly || drawableRead == readWrite ) ) { return drawable; // no change. } - final boolean lockHeld = lock.isOwner(Thread.currentThread()); + final Thread currentThread = Thread.currentThread(); + final boolean lockHeld = lock.isOwner(currentThread); if(lockHeld) { release(); } else if(lock.isLockedByOtherThread()) { // still could glitch .. - throw new GLException("GLContext current by other thread ("+lock.getOwner()+"), operation not allowed."); + throw new GLException("GLContext current by other thread "+lock.getOwner().getName()+", operation not allowed on this thread "+currentThread.getName()); } if( !setWriteOnly || drawableRead == drawable ) { // if !setWriteOnly || !explicitReadDrawable drawableRead = (GLDrawableImpl) readWrite; @@ -339,7 +340,7 @@ public abstract class GLContextImpl extends GLContext { } if (contextHandle != 0) { final int lockRes = drawable.lockSurface(); - if (NativeSurface.LOCK_SURFACE_NOT_READY == lockRes) { + if (NativeSurface.LOCK_SURFACE_NOT_READY >= lockRes) { // this would be odd .. throw new GLException("Surface not ready to lock: "+drawable); } @@ -413,7 +414,7 @@ public abstract class GLContextImpl extends GLContext { } final int lockRes = drawable.lockSurface(); - if (NativeSurface.LOCK_SURFACE_NOT_READY == lockRes) { + if (NativeSurface.LOCK_SURFACE_NOT_READY >= lockRes) { // this would be odd .. throw new GLException("Surface not ready to lock"); } -- cgit v1.2.3