aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-03-07 12:44:52 +0100
committerSven Gothel <[email protected]>2012-03-07 12:44:52 +0100
commit7b450386d876c52805295804c9ebf9a109ed5508 (patch)
treeacae1582fcc9e1538e6883e7e42e5e65f1a904c7 /src
parent8385d98098f7804e5ee369d77963f5a7464a3e1f (diff)
GLContextImpl: Expose GL_RENDERER for impl. / EGLContext workaround Android 4.0.3, Pandaboard ES, PowerVR SGX 540 Bug
GLContextImpl: Expose GL_RENDERER for impl. - This allows reusing the 'early' string. EGLContext workaround Android 4.0.3, Pandaboard ES, PowerVR SGX 540 Bug - On mentioned platform, the app crashes when eglSwapInterval() has been called.
Diffstat (limited to 'src')
-rw-r--r--src/jogl/classes/jogamp/opengl/GLContextImpl.java58
-rw-r--r--src/jogl/classes/jogamp/opengl/egl/EGLContext.java13
2 files changed, 47 insertions, 24 deletions
diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
index 5cbe3a44d..8c9ac589a 100644
--- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
@@ -82,6 +82,9 @@ public abstract class GLContextImpl extends GLContext {
// OpenGL functions.
private ProcAddressTable glProcAddressTable;
+ private String glRenderer;
+ private String glRendererLowerCase;
+
// Tracks creation and initialization of buffer objects to avoid
// repeated glGet calls upon glMapBuffer operations
private GLBufferSizeTracker bufferSizeTracker; // Singleton - Set by GLContextShareSet
@@ -151,6 +154,9 @@ public abstract class GLContextImpl extends GLContext {
contextFQN = null;
additionalCtxCreationFlags = 0;
+ glRenderer = "";
+ glRendererLowerCase = glRenderer;
+
super.resetStates();
}
@@ -950,6 +956,30 @@ public abstract class GLContextImpl extends GLContext {
table.reset(getDrawableImpl().getGLDynamicLookupHelper() );
}
+ private final void initGLRendererStrings() {
+ final GLDynamicLookupHelper glDynLookupHelper = getDrawableImpl().getGLDynamicLookupHelper();
+ final long _glGetString = glDynLookupHelper.dynamicLookupFunction("glGetString");
+ if(0 == _glGetString) {
+ // FIXME
+ System.err.println("Warning: Entry point to 'glGetString' is NULL.");
+ Thread.dumpStack();
+ } else {
+ final String _glRenderer = glGetStringInt(GL.GL_RENDERER, _glGetString);
+ if(null == _glRenderer) {
+ // FIXME
+ System.err.println("Warning: GL_RENDERER is NULL.");
+ Thread.dumpStack();
+ } else {
+ glRenderer = _glRenderer;
+ glRendererLowerCase = glRenderer.toLowerCase();
+ }
+ }
+ }
+
+ protected final String getGLRendererString(boolean lowerCase) {
+ return lowerCase ? glRendererLowerCase : glRenderer;
+ }
+
/**
* Sets the OpenGL implementation class and
* the cache of which GL functions are available for calling through this
@@ -980,6 +1010,8 @@ public abstract class GLContextImpl extends GLContext {
}
updateGLXProcAddressTable();
+ initGLRendererStrings();
+
if(!isCurrentContextHardwareRasterizer()) {
ctxProfileBits |= GLContext.CTX_IMPL_ACCEL_SOFT;
}
@@ -1086,28 +1118,10 @@ public abstract class GLContextImpl extends GLContext {
if(!drawable.getChosenGLCapabilities().getHardwareAccelerated()) {
isHardwareRasterizer = false;
} else {
- // On some platforms (eg. X11), a software GL impl. does not properly declare itself properly.
- // FIXME: We have to evaluate whether this heuristic approach is acceptable.
- final GLDynamicLookupHelper glDynLookupHelper = getDrawableImpl().getGLDynamicLookupHelper();
- final long _glGetString = glDynLookupHelper.dynamicLookupFunction("glGetString");
- if(0 == _glGetString) {
- // FIXME
- System.err.println("Warning: Entry point to 'glGetString' is NULL.");
- Thread.dumpStack();
- } else {
- String glRenderer = glGetStringInt(GL.GL_RENDERER, _glGetString);
- if(null == glRenderer) {
- // FIXME
- System.err.println("Warning: GL_RENDERER is NULL.");
- Thread.dumpStack();
- } else {
- glRenderer = glRenderer.toLowerCase();
- isHardwareRasterizer = ! ( glRenderer.contains("software") /* Mesa3D */ ||
- glRenderer.contains("mesa x11") /* Mesa3D*/ ||
- glRenderer.contains("softpipe") /* Gallium */
- );
- }
- }
+ isHardwareRasterizer = ! ( glRendererLowerCase.contains("software") /* Mesa3D */ ||
+ glRendererLowerCase.contains("mesa x11") /* Mesa3D*/ ||
+ glRendererLowerCase.contains("softpipe") /* Gallium */
+ );
}
return isHardwareRasterizer;
}
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLContext.java b/src/jogl/classes/jogamp/opengl/egl/EGLContext.java
index dcef1cd3d..dc47799c1 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLContext.java
@@ -50,6 +50,7 @@ import jogamp.opengl.GLContextImpl;
import jogamp.opengl.GLDrawableImpl;
import com.jogamp.common.nio.Buffers;
+import com.jogamp.common.os.Platform;
import com.jogamp.gluegen.runtime.ProcAddressTable;
import com.jogamp.gluegen.runtime.opengl.GLProcAddressResolver;
@@ -274,8 +275,16 @@ public abstract class EGLContext extends GLContextImpl {
}
protected void setSwapIntervalImpl(int interval) {
- if (EGL.eglSwapInterval(((EGLDrawable)drawable).getDisplay(), interval)) {
- currentSwapInterval = interval ;
+ // FIXME !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ // eglSwapInterval(..) issued:
+ // Android 4.0.3 / Pandaboard ES / PowerVR SGX 540: crashes
+ // FIXME !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ if( ! ( Platform.OSType.ANDROID == Platform.getOSType() && getGLRendererString(true).contains("powervr") ) ) {
+ if (EGL.eglSwapInterval(((EGLDrawable)drawable).getDisplay(), interval)) {
+ currentSwapInterval = interval ;
+ }
+ } else if(DEBUG) {
+ System.err.println("Ignored: eglSwapInterval("+interval+") - cause: OS "+Platform.getOSType() + " / Renderer " + getGLRendererString(false));
}
}