aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2015-01-23 14:55:11 +0100
committerSven Gothel <[email protected]>2015-01-23 14:55:11 +0100
commit3471ee732ab1b642a37066c70acbb749eb696d21 (patch)
tree16f225075726a1f376c2da725d624e6baa7fef0c /src/jogl
parentcbdd310351f2eda837e707ba7fa9ac18ff9473e4 (diff)
Bug 1038: Refine handling of GLRendererQuirks.NoARBCreateContext
- GLRendererQuirks.NoARBCreateContext is set static per device - Property GLProfile.disableOpenGLARBContext sets static GLRendererQuirks.NoARBCreateContext - Centralize handling in GLContextImpl.createContextARB(..)
Diffstat (limited to 'src/jogl')
-rw-r--r--src/jogl/classes/jogamp/opengl/GLContextImpl.java32
-rw-r--r--src/jogl/classes/jogamp/opengl/egl/EGLContext.java47
-rw-r--r--src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java5
-rw-r--r--src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java5
4 files changed, 58 insertions, 31 deletions
diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
index b6db1813f..e2a35efb1 100644
--- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
@@ -922,7 +922,15 @@ public abstract class GLContextImpl extends GLContext {
*/
protected final long createContextARB(final long share, final boolean direct)
{
- if( GLProfile.disableOpenGLARBContext ) {
+ if( GLProfile.disableOpenGLARBContext ||
+ GLRendererQuirks.existStickyDeviceQuirk(drawable.getNativeSurface().getGraphicsConfiguration().getScreen().getDevice(),
+ GLRendererQuirks.NoARBCreateContext) ) {
+ if( DEBUG ) {
+ System.err.println(getThreadName() + ": createContextARB: Disabled "+
+ "- property disableOpenGLARBContext "+ GLProfile.disableOpenGLARBContext +
+ ", quirk NoARBCreateContext "+GLRendererQuirks.existStickyDeviceQuirk(drawable.getNativeSurface().getGraphicsConfiguration().getScreen().getDevice(),
+ GLRendererQuirks.NoARBCreateContext));
+ }
return 0;
}
final AbstractGraphicsConfiguration config = drawable.getNativeSurface().getGraphicsConfiguration();
@@ -937,7 +945,7 @@ public abstract class GLContextImpl extends GLContext {
final GLProfile glp = glCaps.getGLProfile();
if ( !GLContext.getAvailableGLVersionsSet(device) ) {
- if(!mapGLVersions(device)) {
+ if( !mapGLVersions(device) ) {
// none of the ARB context creation calls was successful, bail out
return 0;
}
@@ -1861,6 +1869,22 @@ public abstract class GLContextImpl extends GLContext {
}
}
}
+ if( GLProfile.disableOpenGLARBContext ) {
+ final int quirk = GLRendererQuirks.NoARBCreateContext;
+ if(DEBUG) {
+ System.err.println("Quirk: "+GLRendererQuirks.toString(quirk)+": cause: disabled");
+ }
+ quirks.addQuirk( quirk );
+ if( withinGLVersionsMapping ) {
+ // Thread safe due to single threaded initialization!
+ GLRendererQuirks.addStickyDeviceQuirk(adevice, quirk);
+ } else {
+ // FIXME: Remove when moving EGL/ES to ARB ctx creation
+ synchronized(GLContextImpl.class) {
+ GLRendererQuirks.addStickyDeviceQuirk(adevice, quirk);
+ }
+ }
+ }
//
// OS related quirks
@@ -1951,6 +1975,10 @@ public abstract class GLContextImpl extends GLContext {
System.err.println("Quirk: "+GLRendererQuirks.toString(quirk)+": cause: OS "+Platform.getOSType()+", [Vendor "+glVendor+", Renderer "+glRenderer+" and Version "+glVersion+"]");
}
quirks.addQuirk( quirk );
+ if( withinGLVersionsMapping ) {
+ // Thread safe due to single threaded initialization!
+ GLRendererQuirks.addStickyDeviceQuirk(adevice, quirk);
+ }
}
}
} else if( isDriverIntel && glRenderer.equals("Intel Bear Lake B") ) {
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLContext.java b/src/jogl/classes/jogamp/opengl/egl/EGLContext.java
index b3c848012..f7f477aac 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLContext.java
@@ -290,33 +290,34 @@ public class EGLContext extends GLContextImpl {
protected boolean createImpl(final long shareWithHandle) throws GLException {
final EGLGraphicsConfiguration config = (EGLGraphicsConfiguration) drawable.getNativeSurface().getGraphicsConfiguration();
final AbstractGraphicsDevice device = config.getScreen().getDevice();
- final boolean availableGLVersionsSet = GLContext.getAvailableGLVersionsSet(device);
+ final GLCapabilitiesImmutable glCaps = (GLCapabilitiesImmutable) config.getChosenCapabilities();
+ final GLProfile glp = glCaps.getGLProfile();
- if( !GLProfile.disableOpenGLARBContext && availableGLVersionsSet ) {
- contextHandle = createContextARB(shareWithHandle, true);
- if( 0 == contextHandle ) {
- throw new GLException(getThreadName()+": Unable to create temp OpenGL context(0) on eglDevice "+device+
- ", eglConfig "+config+", "+drawable.getGLProfile()+", shareWith "+toHexString(shareWithHandle)+", error "+toHexString(EGL.eglGetError()));
- }
- } else {
- final GLProfile glProfile = drawable.getGLProfile();
- final int reqMajor;
- if ( glProfile.usesNativeGLES3() ) {
- reqMajor = 3;
- } else if ( glProfile.usesNativeGLES2() ) {
- reqMajor = 2;
- } else if ( glProfile.usesNativeGLES1() ) {
- reqMajor = 1;
+ contextHandle = createContextARB(shareWithHandle, true);
+ if (DEBUG) {
+ if( 0 != contextHandle ) {
+ System.err.println(getThreadName() + ": EGLContext.createImpl: OK (ARB) on eglDevice "+device+
+ ", eglConfig "+config+", "+glp+", shareWith "+toHexString(shareWithHandle)+", error "+toHexString(EGL.eglGetError()));
} else {
- throw new GLException("Error creating OpenGL context - invalid GLProfile: "+glProfile);
+ System.err.println(getThreadName() + ": EGLContext.createImpl: NOT OK (ARB) - creation failed on eglDevice "+device+
+ ", eglConfig "+config+", "+glp+", shareWith "+toHexString(shareWithHandle)+", error "+toHexString(EGL.eglGetError()));
}
- final int ctp = GLContext.CTX_PROFILE_ES | getContextCreationFlags();
- contextHandle = createContextARBImpl(shareWithHandle, true, ctp, reqMajor, 0);
+ }
+ if( 0 == contextHandle ) {
+ if( !glp.isGLES() ) {
+ throw new GLException(getThreadName()+": Unable to create desktop OpenGL context(ARB n/a) on eglDevice "+device+
+ ", eglConfig "+config+", "+glp+", shareWith "+toHexString(shareWithHandle)+", error "+toHexString(EGL.eglGetError()));
+ }
+ final int[] reqMajorCTP = new int[] { 0, 0 };
+ GLContext.getRequestMajorAndCompat(glp, reqMajorCTP);
+ reqMajorCTP[1] |= getContextCreationFlags();
+
+ contextHandle = createContextARBImpl(shareWithHandle, true, reqMajorCTP[1], reqMajorCTP[0], 0);
if( 0 == contextHandle ) {
- throw new GLException(getThreadName()+": Unable to create temp OpenGL context(1) on eglDevice "+device+
- ", eglConfig "+config+", "+drawable.getGLProfile()+", shareWith "+toHexString(shareWithHandle)+", error "+toHexString(EGL.eglGetError()));
+ throw new GLException(getThreadName()+": Unable to create ES OpenGL context on eglDevice "+device+
+ ", eglConfig "+config+", "+glp+", shareWith "+toHexString(shareWithHandle)+", error "+toHexString(EGL.eglGetError()));
}
- if( !setGLFunctionAvailability(true, reqMajor, 0, ctp, false /* strictMatch */, false /* withinGLVersionsMapping */) ) {
+ if( !setGLFunctionAvailability(true, reqMajorCTP[0], 0, reqMajorCTP[1], false /* strictMatch */, false /* withinGLVersionsMapping */) ) {
EGL.eglMakeCurrent(drawable.getNativeSurface().getDisplayHandle(), EGL.EGL_NO_SURFACE, EGL.EGL_NO_SURFACE, EGL.EGL_NO_CONTEXT);
EGL.eglDestroyContext(drawable.getNativeSurface().getDisplayHandle(), contextHandle);
contextHandle = 0;
@@ -331,7 +332,7 @@ public class EGLContext extends GLContextImpl {
",\n\t"+this+
",\n\tsharing with 0x" + Long.toHexString(shareWithHandle));
}
- return true;
+ return 0 != contextHandle;
}
@Override
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java
index 6cc29dddb..4edd080d2 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java
@@ -333,7 +333,7 @@ public class WindowsWGLContext extends GLContextImpl {
isProcCreateContextAttribsARBAvailable = false;
isExtARBCreateContextAvailable = false;
}
- if ( isProcCreateContextAttribsARBAvailable && isExtARBCreateContextAvailable && !GLProfile.disableOpenGLARBContext && !getRendererQuirks().exist( GLRendererQuirks.NoARBCreateContext ) ) {
+ if ( isProcCreateContextAttribsARBAvailable && isExtARBCreateContextAvailable ) {
// initial ARB context creation
contextHandle = createContextARB(shareWithHandle, true);
createContextARBTried=true;
@@ -347,8 +347,7 @@ public class WindowsWGLContext extends GLContextImpl {
} else if (DEBUG) {
System.err.println(getThreadName() + ": createContextImpl: NOT OK (ARB, initial) - extension not available - share "+toHexString(shareWithHandle)+
", isProcCreateContextAttribsARBAvailable "+isProcCreateContextAttribsARBAvailable+
- ", isExtGLXARBCreateContextAvailable "+isExtARBCreateContextAvailable+
- ", disableOpenGLARBContext "+GLProfile.disableOpenGLARBContext);
+ ", isExtGLXARBCreateContextAvailable "+isExtARBCreateContextAvailable);
}
}
} else {
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java
index 4337eaf54..5d0f154cb 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java
@@ -358,7 +358,7 @@ public class X11GLXContext extends GLContextImpl {
// is*Available calls are valid since setGLFunctionAvailability(..) was called
final boolean isProcCreateContextAttribsARBAvailable = isFunctionAvailable("glXCreateContextAttribsARB");
final boolean isExtARBCreateContextAvailable = isExtensionAvailable("GLX_ARB_create_context");
- if ( isProcCreateContextAttribsARBAvailable && isExtARBCreateContextAvailable && !GLProfile.disableOpenGLARBContext ) {
+ if ( isProcCreateContextAttribsARBAvailable && isExtARBCreateContextAvailable ) {
// initial ARB context creation
contextHandle = createContextARB(shareWithHandle, direct);
createContextARBTried=true;
@@ -372,8 +372,7 @@ public class X11GLXContext extends GLContextImpl {
} else if( DEBUG ) {
System.err.println(getThreadName() + ": createContextImpl: NOT OK (ARB, initial) - extension not available - share "+toHexString(shareWithHandle)+
", isProcCreateContextAttribsARBAvailable "+isProcCreateContextAttribsARBAvailable+
- ", isExtGLXARBCreateContextAvailable "+isExtARBCreateContextAvailable+
- ", disableOpenGLARBContext "+GLProfile.disableOpenGLARBContext);
+ ", isExtGLXARBCreateContextAvailable "+isExtARBCreateContextAvailable);
}
}
} else {