From da697607fce1e6d2b0c65fcc37030c88981b76ec Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Fri, 17 Aug 2012 15:33:12 +0200 Subject: Fix EGLDrawableFactory.getEGLSurface(..): Catch WrappedSurface case w/ EGLDevice and EGLGraphicsConfiguration - Regression of 43a473b2005d7f59a7f4f5b8bc7ca9ae88b4e894 Do not create a WrappedSurface around a given WrappedSurface if the latter is intended for EGL, i.e. uses EGLDevice and EGLGraphicsConfiguration even though the surface handle is not valid [yet]. For this case we assume the WrappedSurface has a lifecycle hook as it is used for the dummy drawable. Otherwise we would have a recursive WrappedSurface, ie with EGLDrawableFactory.createOnscreenDrawableImpl( dummySurface ), where dummySurface is a WrappedSurface w/ EGL pbuffer drawable lifecycle hook. Commit 43a473b2005d7f59a7f4f5b8bc7ca9ae88b4e894 didn't take the above case into account. --- src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/jogl/classes') diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java index f7377a648..e145a959c 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java @@ -471,10 +471,17 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { AbstractGraphicsConfiguration aConfig = surface.getGraphicsConfiguration(); AbstractGraphicsDevice aDevice = aConfig.getScreen().getDevice(); if( aDevice instanceof EGLGraphicsDevice && aConfig instanceof EGLGraphicsConfiguration ) { + if(surface instanceof WrappedSurface) { + // already wrapped surface - no wrapped recursion + if(DEBUG) { + System.err.println(getThreadName() + ": getEGLSurface - already wrapped surface - use as-is: "+surface); + } + return surface; + } if(EGLDrawable.isValidEGLSurface((EGLGraphicsDevice)aDevice, surface)) { // already in native EGL format if(DEBUG) { - System.err.println(getThreadName() + ": getEGLSurface - already valid EGL surface - use as-is: "+aConfig); + System.err.println(getThreadName() + ": getEGLSurface - already valid EGL surface - use as-is: "+surface); } return surface; } -- cgit v1.2.3