From 3317e7a427fbb81dd3d7daa8116c7d33166ed003 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Tue, 3 Feb 2015 21:18:02 +0100 Subject: Bug 1068 - Fix issue w/ unifying Surfaceless probing (commit 2120be14c7525ef051d105f9bb02294f78d17d28) Commit 2120be14c7525ef051d105f9bb02294f78d17d28 caused GLDrawableFactoryImpl.probeSurfacelessCtx(..) to be only called if appropriate, hence GLRendererQuirks.NoSurfacelessCtx was not set otherwise. This patch adds the required 'else' branch for the case GLDrawableFactoryImpl.probeSurfacelessCtx(..) is not called and issues GLDrawableFactoryImpl.setNoSurfacelessCtxQuirk(..). +++ Add Note to EGLDrawableFactory's shutdown: "sr.device.close() Issues eglTerminate(), which may cause SIGSEGV w/ NVIDIA 343.36 w/ TestGLProfile01NEWT" However keep this code enabled, since this seems to be a driver issue. +++ --- .../jogamp/opengl/GLDrawableFactoryImpl.java | 39 ++++++++++++++++------ 1 file changed, 29 insertions(+), 10 deletions(-) (limited to 'src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java') diff --git a/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java b/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java index 1fd5c5b47..b7f861e13 100644 --- a/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java @@ -96,7 +96,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { *

* Caller shall skip probing in case surfaceless support is not possible, * e.g. OpenGL ES without {@code EGL_KHR_surfaceless_context} or EGL < 1.5, - * or desktop OpenGL context < 3.0. + * or desktop OpenGL context < 3.0 and instead call {@link #setNoSurfacelessCtxQuirk(GLContext)}! *

* * @param context the context to probe, must be current @@ -141,19 +141,38 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { } } if( !noSurfacelessCtxQuirk && !allowsSurfacelessCtx ) { - final int quirk = GLRendererQuirks.NoSurfacelessCtx; - if(DEBUG || GLContext.DEBUG) { - System.err.println("Quirk: "+GLRendererQuirks.toString(quirk)+" -> "+device+": cause: probe"); - } - final GLRendererQuirks glrq = context.getRendererQuirks(); - if( null != glrq ) { - glrq.addQuirk(quirk); - } - GLRendererQuirks.addStickyDeviceQuirk(device, quirk); + setNoSurfacelessCtxQuirkImpl(device, context); } return allowsSurfacelessCtx; } + /** + * Method will set the {@link GLRendererQuirks#NoSurfacelessCtx} + * if it has not been set already. + * + * @param context the context to probe, must be current + * @see GLRendererQuirks#NoSurfacelessCtx + */ + protected final void setNoSurfacelessCtxQuirk(final GLContext context) { + final boolean noSurfacelessCtxQuirk = context.hasRendererQuirk(GLRendererQuirks.NoSurfacelessCtx); + if( !noSurfacelessCtxQuirk ) { + final GLDrawable origDrawable = context.getGLDrawable(); + final AbstractGraphicsDevice device = origDrawable.getNativeSurface().getGraphicsConfiguration().getScreen().getDevice(); + setNoSurfacelessCtxQuirkImpl(device, context); + } + } + private final void setNoSurfacelessCtxQuirkImpl(final AbstractGraphicsDevice device, final GLContext context) { + final int quirk = GLRendererQuirks.NoSurfacelessCtx; + if(DEBUG || GLContext.DEBUG) { + System.err.println("Quirk: "+GLRendererQuirks.toString(quirk)+" -> "+device+": cause: probe"); + } + final GLRendererQuirks glrq = context.getRendererQuirks(); + if( null != glrq ) { + glrq.addQuirk(quirk); + } + GLRendererQuirks.addStickyDeviceQuirk(device, quirk); + } + /** * Returns the shared resource mapped to the device {@link AbstractGraphicsDevice#getConnection()}, * either a pre-existing or newly created, or null if creation failed or not supported.
-- cgit v1.2.3