aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/opengl/GLContextImpl.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-09-20 23:12:48 +0200
committerSven Gothel <[email protected]>2012-09-20 23:12:48 +0200
commit923d9dd7f1d40db72d35ca76a761ca14babf147f (patch)
tree754fdccc679898e9699cb76feeb54b97fcb2e605 /src/jogl/classes/jogamp/opengl/GLContextImpl.java
parent0f531ec116245b10fcb41e7b0905f240b91aa93a (diff)
Add GLRendererQuirks; Fix shared EGL/ES resources;
Add GLRendererQuirks: - Contains centralized 'tagged' workarounds for GL renderer bugs (quirks) - Accessible via GLContext and GLDrawableFactory - Initialized in GLContext.setAvailability* - Simplify GLGraphicsConfigurationUtil.fixOffscreenGLCapabilities(..) & use Quirks - use quirks - instead of passing booleans for each config, pass factory & device Fix shared EGL/ES resources: - GLProfile needs to initialize EGLDrawableFactory's shared resources before desktop, so EGLDrawableFactory can use the fallback defaultDisplay & defaultSharedResource for host mapped sharedResources (hack). - If using defaultSharedResources for host mapped ones, do not go through initialization cycles - simply map (sharedResource + context). - EGLDrawableFactory: Use device's unique-key instead of connection only, since the latter causes a collision (EGL-connection == X11-connection).
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/GLContextImpl.java')
-rw-r--r--src/jogl/classes/jogamp/opengl/GLContextImpl.java55
1 files changed, 45 insertions, 10 deletions
diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
index 050c619fd..e164dfe44 100644
--- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
@@ -46,6 +46,7 @@ import java.util.HashMap;
import java.util.Map;
import com.jogamp.common.os.DynamicLookupHelper;
+import com.jogamp.common.os.Platform;
import com.jogamp.common.util.ReflectionUtil;
import com.jogamp.common.util.VersionNumber;
import com.jogamp.gluegen.runtime.FunctionAddressResolver;
@@ -53,6 +54,7 @@ import com.jogamp.gluegen.runtime.ProcAddressTable;
import com.jogamp.gluegen.runtime.opengl.GLNameResolver;
import com.jogamp.gluegen.runtime.opengl.GLProcAddressResolver;
import com.jogamp.opengl.GLExtensions;
+import com.jogamp.opengl.GLRendererQuirks;
import javax.media.nativewindow.AbstractGraphicsConfiguration;
import javax.media.nativewindow.AbstractGraphicsDevice;
@@ -162,7 +164,7 @@ public abstract class GLContextImpl extends GLContext {
additionalCtxCreationFlags = 0;
glRenderer = "";
- glRendererLowerCase = glRenderer;
+ glRendererLowerCase = glRenderer;
if (boundFBOTarget != null) { // <init>
boundFBOTarget[0] = 0; // draw
@@ -1116,13 +1118,6 @@ public abstract class GLContextImpl extends GLContext {
}
}
- protected final String getGLVersionString() {
- return glVersion;
- }
- 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
@@ -1264,6 +1259,8 @@ public abstract class GLContextImpl extends GLContext {
// Set GL Version (complete w/ version string)
//
setContextVersion(major, minor, ctxProfileBits, true);
+
+ setRendererQuirks();
setDefaultSwapInterval();
@@ -1272,7 +1269,45 @@ public abstract class GLContextImpl extends GLContext {
}
}
- protected static final boolean hasFBOImpl(int major, int ctp, ExtensionAvailabilityCache extCache) {
+ private final void setRendererQuirks() {
+ int[] quirks = new int[GLRendererQuirks.COUNT];
+ int i = 0;
+
+ // OS related quirks
+ if( Platform.getOSType() == Platform.OSType.MACOS ) {
+ final int quirk = GLRendererQuirks.NoOffscreenBitmap;
+ if(DEBUG) {
+ System.err.println("Quirk: "+GLRendererQuirks.toString(quirk)+": cause: OS "+Platform.getOSType());
+ }
+ quirks[i++] = quirk;
+ } else if( Platform.getOSType() == Platform.OSType.WINDOWS ) {
+ final int quirk = GLRendererQuirks.NoDoubleBufferedBitmap;
+ if(DEBUG) {
+ System.err.println("Quirk: "+GLRendererQuirks.toString(quirk)+": cause: OS "+Platform.getOSType());
+ }
+ quirks[i++] = quirk;
+ }
+
+ // Renderer related quirks, may also involve OS
+ if( Platform.OSType.ANDROID == Platform.getOSType() && glRendererLowerCase.contains("powervr") ) {
+ final int quirk = GLRendererQuirks.NoSetSwapInterval;
+ if(DEBUG) {
+ System.err.println("Quirk: "+GLRendererQuirks.toString(quirk)+": cause: OS "+Platform.getOSType() + " / Renderer " + glRenderer);
+ }
+ quirks[i++] = quirk;
+ }
+ if( glRendererLowerCase.contains("intel(r)") && glRendererLowerCase.contains("mesa") ) {
+ final int quirk = GLRendererQuirks.NoDoubleBufferedPBuffer;
+ if(DEBUG) {
+ System.err.println("Quirk: "+GLRendererQuirks.toString(quirk)+": cause: Renderer " + glRenderer);
+ }
+ quirks[i++] = quirk;
+ }
+ glRendererQuirks = new GLRendererQuirks(quirks, 0, i);
+ }
+
+
+ private static final boolean hasFBOImpl(int major, int ctp, ExtensionAvailabilityCache extCache) {
return ( 0 != (ctp & CTX_PROFILE_ES) && major >= 2 ) || // ES >= 2.0
major >= 3 || // any >= 3.0 GL ctx
@@ -1288,7 +1323,7 @@ public abstract class GLContextImpl extends GLContext {
extCache.isExtensionAvailable(GLExtensions.OES_framebuffer_object) ) ; // OES_framebuffer_object excluded
}
- protected final void removeCachedVersion(int major, int minor, int ctxProfileBits) {
+ private final void removeCachedVersion(int major, int minor, int ctxProfileBits) {
if(!isCurrentContextHardwareRasterizer()) {
ctxProfileBits |= GLContext.CTX_IMPL_ACCEL_SOFT;
}