diff options
author | Sven Gothel <[email protected]> | 2012-09-20 23:12:48 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2012-09-20 23:12:48 +0200 |
commit | 923d9dd7f1d40db72d35ca76a761ca14babf147f (patch) | |
tree | 754fdccc679898e9699cb76feeb54b97fcb2e605 /src/jogl/classes/jogamp/opengl/egl/EGLContext.java | |
parent | 0f531ec116245b10fcb41e7b0905f240b91aa93a (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/egl/EGLContext.java')
-rw-r--r-- | src/jogl/classes/jogamp/opengl/egl/EGLContext.java | 51 |
1 files changed, 21 insertions, 30 deletions
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLContext.java b/src/jogl/classes/jogamp/opengl/egl/EGLContext.java index 06953a8e1..84aeaa94a 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLContext.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLContext.java @@ -51,9 +51,10 @@ 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; +import com.jogamp.nativewindow.egl.EGLGraphicsDevice; +import com.jogamp.opengl.GLRendererQuirks; public abstract class EGLContext extends GLContextImpl { private boolean eglQueryStringInitialized; @@ -269,14 +270,7 @@ public abstract class EGLContext extends GLContextImpl { @Override protected boolean setSwapIntervalImpl(int 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(DEBUG) { - System.err.println("Ignored: eglSwapInterval("+interval+") - cause: OS "+Platform.getOSType() + " / Renderer " + getGLRendererString(false)); - } + if( hasRendererQuirk(GLRendererQuirks.NoSetSwapInterval) ) { return false; } return EGL.eglSwapInterval(drawable.getNativeSurface().getDisplayHandle(), interval); @@ -286,20 +280,11 @@ public abstract class EGLContext extends GLContextImpl { // Accessible .. // - /** - * If context is an ES profile, map it to the given device - * via {@link GLContext#mapAvailableGLVersion(AbstractGraphicsDevice, int, int, int, int, int)}. - * <p> - * We intentionally override a non native EGL device ES profile mapping, - * i.e. this will override/modify an already 'set' X11/WGL/.. mapping. - * </p> - * - * @param device - */ - protected void mapCurrentAvailableGLVersion(AbstractGraphicsDevice device) { - mapCurrentAvailableGLVersionImpl(device, ctxMajorVersion, ctxMinorVersion, ctxOptions); - } - protected static void mapStaticGLESVersion(AbstractGraphicsDevice device, GLCapabilitiesImmutable caps) { + /* pp */ void mapCurrentAvailableGLVersion(AbstractGraphicsDevice device) { + mapStaticGLVersion(device, ctxMajorVersion, ctxMinorVersion, ctxOptions); + } + /* pp */ int getContextOptions() { return ctxOptions; } + /* pp */ static void mapStaticGLESVersion(AbstractGraphicsDevice device, GLCapabilitiesImmutable caps) { final GLProfile glp = caps.getGLProfile(); final int[] reqMajorCTP = new int[2]; GLContext.getRequestMajorAndCompat(glp, reqMajorCTP); @@ -309,21 +294,27 @@ public abstract class EGLContext extends GLContextImpl { if(!caps.getHardwareAccelerated()) { reqMajorCTP[1] |= GLContext.CTX_IMPL_ACCEL_SOFT; } - mapCurrentAvailableGLVersionImpl(device, reqMajorCTP[0], 0, reqMajorCTP[1]); - } - protected static void mapStaticGLESVersion(AbstractGraphicsDevice device, int major) { + mapStaticGLVersion(device, reqMajorCTP[0], 0, reqMajorCTP[1]); + } + /* pp */ static void mapStaticGLESVersion(AbstractGraphicsDevice device, int major) { int ctp = ( 2 == major ) ? ( GLContext.CTX_PROFILE_ES | GLContext.CTX_IMPL_ES2_COMPAT | GLContext.CTX_IMPL_FBO ) : ( GLContext.CTX_PROFILE_ES ); - mapCurrentAvailableGLVersionImpl(device, major, 0, ctp); + mapStaticGLVersion(device, major, 0, ctp); } - private static void mapCurrentAvailableGLVersionImpl(AbstractGraphicsDevice device, int major, int minor, int ctp) { + /* pp */ static void mapStaticGLVersion(AbstractGraphicsDevice device, int major, int minor, int ctp) { if( 0 != ( ctp & GLContext.CTX_PROFILE_ES) ) { // ES1 or ES2 final int reqMajor = major; final int reqProfile = GLContext.CTX_PROFILE_ES; - GLContext.mapAvailableGLVersion(device, reqMajor, reqProfile, - major, minor, ctp); + GLContext.mapAvailableGLVersion(device, reqMajor, reqProfile, major, minor, ctp); + if(! ( device instanceof EGLGraphicsDevice ) ) { + final EGLGraphicsDevice eglDevice = new EGLGraphicsDevice(device.getHandle(), EGL.EGL_NO_DISPLAY, device.getConnection(), device.getUnitID(), null); + GLContext.mapAvailableGLVersion(eglDevice, reqMajor, reqProfile, major, minor, ctp); + } } } + protected static String getGLVersion(int major, int minor, int ctp, String gl_version) { + return GLContext.getGLVersion(major, minor, ctp, gl_version); + } protected static boolean getAvailableGLVersionsSet(AbstractGraphicsDevice device) { return GLContext.getAvailableGLVersionsSet(device); |