From e5a55ede324ce500f50991d56491758803063a58 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Wed, 30 Jul 2014 03:06:30 +0200 Subject: Bug 1038 - Allow skipping detection of certain GLProfiles: Skip 'ARB_create_context' context creation extension via property 'jogl.disable.openglarbcontext'; ... Only allow the exclusions if platform OS is not OSX: - jogl.disable.openglcore - jogl.disable.openglarbcontext Since on OSX they are known to work reliable and there is not other method if receiving a higher GL profile than core and ARB. This also removes the restrictions on X11 and Windows, where profiles >= GL3 must be created using ARB_create_context. Hence this is allowed now. --- make/scripts/tests-win.bat | 4 +-- make/scripts/tests-x64-dbg.bat | 3 ++ make/scripts/tests.sh | 3 +- src/jogl/classes/javax/media/opengl/GLProfile.java | 33 ++++++++++++++++++---- src/jogl/classes/jogamp/opengl/GLContextImpl.java | 3 ++ .../opengl/windows/wgl/WindowsWGLContext.java | 9 ++---- .../jogamp/opengl/x11/glx/X11GLXContext.java | 15 +++------- 7 files changed, 43 insertions(+), 27 deletions(-) diff --git a/make/scripts/tests-win.bat b/make/scripts/tests-win.bat index fb3bc3b5c..2fec817cc 100755 --- a/make/scripts/tests-win.bat +++ b/make/scripts/tests-win.bat @@ -1,5 +1,5 @@ REM scripts\java-win.bat jogamp.newt.awt.opengl.VersionApplet -REM scripts\java-win.bat com.jogamp.newt.opengl.GLWindow +scripts\java-win.bat com.jogamp.newt.opengl.GLWindow REM scripts\java-win.bat javax.media.opengl.awt.GLCanvas REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestMainVersionGLWindowNEWT %* REM scripts\java-win.bat com.jogamp.oculusvr.OVRVersion %* @@ -183,7 +183,7 @@ REM scripts\java-win.bat testawt com.jogamp.opengl.test.junit.jogl.caps.TestMult REM scripts\java-win.bat testnoawt com.jogamp.opengl.test.junit.jogl.caps.TestMultisampleES1NEWT %* REM scripts\java-win.bat testnoawt com.jogamp.opengl.test.junit.jogl.caps.TestMultisampleES2NEWT %* REM scripts\java-win.bat testawt com.jogamp.opengl.test.junit.jogl.caps.TestTranslucencyAWT %* -scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.caps.TestTranslucencyNEWT %* +REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.caps.TestTranslucencyNEWT %* REM scripts\java-win.bat com.jogamp.opengl.test.junit.newt.parenting.TestTranslucentChildWindowBug632NEWT %* REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.awt.TestBug461OffscreenSupersamplingSwingAWT diff --git a/make/scripts/tests-x64-dbg.bat b/make/scripts/tests-x64-dbg.bat index da5746c45..f18072b4b 100755 --- a/make/scripts/tests-x64-dbg.bat +++ b/make/scripts/tests-x64-dbg.bat @@ -26,6 +26,9 @@ REM set D_ARGS="-Djogl.debug=all" "-Dnewt.debug=all" "-Dnativewindow.debug=all" REM set D_ARGS="-Djogl.debug=all" "-Dnewt.debug=all" "-Dnativewindow.debug=all" "-Djogamp.debug=all" "-Djogl.debug.EGLDrawableFactory.DontQuery" REM set D_ARGS="-Djogl.debug=all" "-Dnewt.debug=all" "-Dnativewindow.debug=all" "-Djogl.debug.windows.cpu_affinity_mode=0" "-Djogl.debug.GLContext.TraceSwitch" "-Djogl.debug.GLContext" REM set D_ARGS="-Djogl.debug=all" "-Dnewt.debug=all" "-Dnativewindow.debug=all" "-Djogl.debug.GLContext.TraceSwitch" "-Djogl.debug.GLContext" +REM set D_ARGS="-Djogl.disable.opengles" +REM set D_ARGS="-Djogl.disable.openglcore" +REM set D_ARGS="-Djogl.disable.openglarbcontext" REM set D_ARGS="-Dnativewindow.debug.GDIUtil" "-Dnativewindow.debug.RegisteredClass" REM set D_ARGS="-Djogl.debug.GLContext" "-Djogl.debug.FBObject" REM set D_ARGS="-Djogl.debug.GLDrawable" "-Djogl.debug.EGLDrawableFactory.DontQuery" diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh index 55cb3e715..d403a4201 100644 --- a/make/scripts/tests.sh +++ b/make/scripts/tests.sh @@ -116,7 +116,8 @@ function jrun() { #D_ARGS="-Dnativewindow.debug.X11Util.ATI_HAS_NO_XCLOSEDISPLAY_BUG" #D_ARGS="-Dnativewindow.debug.X11Util.ATI_HAS_NO_MULTITHREADING_BUG" #D_ARGS="-Djogl.disable.opengles" - D_ARGS="-Djogl.disable.openglcore" + #D_ARGS="-Djogl.disable.openglcore" + #D_ARGS="-Djogl.disable.openglarbcontext" #D_ARGS="-Djogl.debug.DebugGL -Dnewt.debug.Window" #D_ARGS="-Djogl.debug.DebugGL -Djogl.debug.FBObject" #D_ARGS="-Djogl.debug.FBObject -Djogl.debug.TraceGL -Djogl.debug.GLBufferStateTracker" diff --git a/src/jogl/classes/javax/media/opengl/GLProfile.java b/src/jogl/classes/javax/media/opengl/GLProfile.java index dec5bc821..d39d0f11a 100644 --- a/src/jogl/classes/javax/media/opengl/GLProfile.java +++ b/src/jogl/classes/javax/media/opengl/GLProfile.java @@ -44,6 +44,7 @@ import jogamp.opengl.DesktopGLDynamicLookupHelper; import com.jogamp.common.GlueGenVersion; import com.jogamp.common.jvm.JNILibLoaderBase; import com.jogamp.common.os.Platform; +import com.jogamp.common.util.PropertyAccess; import com.jogamp.common.util.ReflectionUtil; import com.jogamp.common.util.VersionUtil; import com.jogamp.common.util.cache.TempJarCache; @@ -75,21 +76,34 @@ import java.util.Map; */ public class GLProfile { - public static final boolean DEBUG = Debug.debug("GLProfile"); + public static final boolean DEBUG; /** * In case no OpenGL ES profiles are required - * and if the running platform may have a buggy implementation, + * and if one platform may have a buggy implementation, * setting the property jogl.disable.opengles disables querying possible existing OpenGL ES profiles. */ - public static final boolean disableOpenGLES = Debug.isPropertyDefined("jogl.disable.opengles", true); + public static final boolean disableOpenGLES; /** * In case no native OpenGL core profiles are required - * and if the running platform may have a buggy implementation, + * and if one platform may have a buggy implementation, * setting the property jogl.disable.openglcore disables querying possible existing native OpenGL core profiles. + *

+ * This exclusion is disabled for {@link Platform.OSType#MACOS}. + *

+ */ + public static final boolean disableOpenGLCore; + + /** + * In case the implementation of the ARB_create_context + * context creation extension is buggy on one platform, + * setting the property jogl.disable.openglarbcontext disables utilizing it. + *

+ * This exclusion is disabled for {@link Platform.OSType#MACOS}. + *

*/ - public static final boolean disableOpenGLCore = Debug.isPropertyDefined("jogl.disable.openglcore", true); + public static final boolean disableOpenGLARBContext; /** * We have to disable support for ANGLE, the D3D ES2 emulation on Windows provided w/ Firefox and Chrome. @@ -99,11 +113,18 @@ public class GLProfile { * jogl.enable.ANGLE. *

*/ - public static final boolean enableANGLE = Debug.isPropertyDefined("jogl.enable.ANGLE", true); + public static final boolean enableANGLE; static { // Also initializes TempJarCache if shall be used. Platform.initSingleton(); + final boolean isOSX = Platform.OSType.MACOS == Platform.getOSType(); + + DEBUG = Debug.debug("GLProfile"); + disableOpenGLES = PropertyAccess.isPropertyDefined("jogl.disable.opengles", true); + disableOpenGLCore = PropertyAccess.isPropertyDefined("jogl.disable.openglcore", true) && !isOSX; + disableOpenGLARBContext = PropertyAccess.isPropertyDefined("jogl.disable.openglarbcontext", true) && !isOSX; + enableANGLE = PropertyAccess.isPropertyDefined("jogl.enable.ANGLE", true); } /** diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java index 34e247cdd..93c0b69b8 100644 --- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java @@ -820,6 +820,9 @@ public abstract class GLContextImpl extends GLContext { */ protected final long createContextARB(final long share, final boolean direct) { + if( GLProfile.disableOpenGLARBContext ) { + return 0; + } final AbstractGraphicsConfiguration config = drawable.getNativeSurface().getGraphicsConfiguration(); final AbstractGraphicsDevice device = config.getScreen().getDevice(); diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java index 9c5a5b272..00f5687a5 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java @@ -360,16 +360,11 @@ public class WindowsWGLContext extends GLContextImpl { } } } else { - if( glCaps.getGLProfile().isGL3() ) { - WGL.wglMakeCurrent(0, 0); - WGL.wglDeleteContext(temp_ctx); - throw new GLException(getThreadName()+": WindowsWGLContex.createContextImpl ctx !ARB, profile > GL2 requested (OpenGL >= 3.0.1). Requested: "+glCaps.getGLProfile()+", current: "+getGLVersion()); - } if(DEBUG) { - System.err.println("WindowsWGLContext.createContext failed, fall back to !ARB context "+getGLVersion()); + System.err.println("WindowsWGLContext.createContext via ARB failed, fall back to !ARB context "+getGLVersion()); } - // continue with temp context for GL < 3.0 + // continue with temp context contextHandle = temp_ctx; if ( !wglMakeContextCurrent(drawable.getHandle(), drawableRead.getHandle(), contextHandle) ) { WGL.wglMakeCurrent(0, 0); diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java index d4c3abc49..d93b2feb0 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java @@ -51,7 +51,6 @@ import javax.media.nativewindow.NativeSurface; import javax.media.opengl.GLCapabilitiesImmutable; import javax.media.opengl.GLContext; import javax.media.opengl.GLException; -import javax.media.opengl.GLProfile; import jogamp.nativewindow.x11.X11Lib; import jogamp.nativewindow.x11.X11Util; @@ -298,13 +297,12 @@ public class X11GLXContext extends GLContextImpl { } final GLCapabilitiesImmutable glCaps = (GLCapabilitiesImmutable) config.getChosenCapabilities(); - final GLProfile glp = glCaps.getGLProfile(); if( !config.hasFBConfig() ) { // not able to use FBConfig -> GLX 1.1 forceGLXVersionOneOne(); - if(glp.isGL3()) { - throw new GLException(getThreadName()+": Unable to create OpenGL >= 3.1 context"); + if(glCaps.getGLProfile().isGL3()) { + throw new GLException(getThreadName()+": Unable to create OpenGL >= 3.1 context w/o FBConfig"); } contextHandle = GLX.glXCreateContext(display, config.getXVisualInfo(), shareWithHandle, direct); if ( 0 == contextHandle ) { @@ -380,16 +378,11 @@ public class X11GLXContext extends GLContextImpl { } } } else { - if( glp.isGL3() ) { - glXMakeContextCurrent(display, 0, 0, 0); - GLX.glXDestroyContext(display, temp_ctx); - throw new GLException(getThreadName()+": X11GLXContext.createContextImpl ctx !ARB, profile > GL2 requested (OpenGL >= 3.0.1). Requested: "+glp+", current: "+getGLVersion()); - } if(DEBUG) { - System.err.println(getThreadName()+": X11GLXContext.createContextImpl failed, fall back to !ARB context "+getGLVersion()); + System.err.println(getThreadName()+": X11GLXContext.createContextImpl via ARB failed, fall back to !ARB context "+getGLVersion()); } - // continue with temp context for GL <= 3.0 + // continue with temp context contextHandle = temp_ctx; if ( !glXMakeContextCurrent(display, drawable.getHandle(), drawableRead.getHandle(), contextHandle) ) { glXMakeContextCurrent(display, 0, 0, 0); -- cgit v1.2.3