diff options
author | Sven Gothel <[email protected]> | 2015-08-29 17:44:34 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2015-08-29 17:44:34 +0200 |
commit | 99a064327bf991318841c858d21d13e55d6b39db (patch) | |
tree | 499bbd046b0e22f59e1938361440655a300e00b7 /src/jogl/classes/jogamp/opengl/egl/EGLContext.java | |
parent | 17af6ed1d0f60c111079ff19c4114fefbfd025fc (diff) |
Bug 1203: Implement regular EGL OpenGL Profile probing (ES* + GL*)
- GLProfile
- Add 'hasGL234OnEGLImpl' handling, i.e. GL* profiles on EGL devices
- Properly handle EGL's 'GLDynamicLookupHelper' queries for ES2, ES1 and GL* profiles,
i.e. allow each one to fail seperately.
- Merge computed EGL-Profile-Map (1) and Desktop-Profile-Map (2)
per device, instead of just using the last computation,
preserving and favoratizing the Desktop-Profile-Map.
- GLContextImpl.mapGLVersions(..): Map ES* profiles if having an EGLGraphicsDevice
and not disabled via GLProfile.disableOpenGLES.
- EGLContext
- createContextARBImpl(..): Use the EGL_CONTEXT_MINOR_VERSION_KHR if supported
- GLContext* accessibility: Remove unused entries, add newly used ones
- EGLDrawableFactory
- Fix a bug regarding detection of 'OpenGL' API for EGL
- SharedResource: Use detailed knowledge of each profile
- Only create one drawable and context for probing maximum,
utilizing 'GLContextImpl.MappedGLVersionListener'
to detect all mapped profiles for 'SharedResource' instance.
- Detect whether the probed/mapped device
can be mapped to the default-EGL-device, i.e.:
- current device is not the default-EGL-device
- default-EGL-device is valid and could be mapped (beforehand)
- same connection
In this case, no probing/mapping is performed
and the default-EGL-device mapped data being reused and remapped
to the requested device.
- When mapping/probing, attempt to use a surfaceless context first,
allowing same codepath for default-EGL-device and native-device (X11, ..).
This avoids using pbuffer if using default-EGL-device
and a dummy onscreen window if using a native-device (X11, ..).
If this fails, continue as usual ..
- default-EGL-device -> pbuffer
- native-device (X11, ..) -> dummy onscreen window
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/egl/EGLContext.java')
-rw-r--r-- | src/jogl/classes/jogamp/opengl/egl/EGLContext.java | 62 |
1 files changed, 21 insertions, 41 deletions
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLContext.java b/src/jogl/classes/jogamp/opengl/egl/EGLContext.java index eba8b1df3..8c86f5199 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLContext.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLContext.java @@ -236,11 +236,11 @@ public class EGLContext extends GLContextImpl { int index = ctx_attribs_idx_major + 2; - /** if( ctDesktopGL && reqMinor >= 0 ) { // FIXME: No minor version probing for ES currently! + if( reqMinor >= 0 ) { attribs.put(index + 0, EGLExt.EGL_CONTEXT_MINOR_VERSION_KHR); attribs.put(index + 1, reqMinor); index += 2; - } */ + } if( ctDesktopGL && ( useMajor > 3 || useMajor == 3 && reqMinor >= 2 ) ) { attribs.put(index + 0, EGLExt.EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR); @@ -463,52 +463,32 @@ public class EGLContext extends GLContextImpl { // Accessible .. // - /* pp */ void mapCurrentAvailableGLESVersion(final AbstractGraphicsDevice device) { - mapStaticGLESVersion(device, ctxVersion.getMajor(), ctxVersion.getMinor(), ctxOptions); + /* pp */ static final boolean isGLES1(final int majorVersion, final int ctxOptions) { + return 0 != ( ctxOptions & GLContext.CTX_PROFILE_ES ) && majorVersion == 1 ; } - /* pp */ int getContextOptions() { return ctxOptions; } - /* pp */ static void mapStaticGLESVersion(final AbstractGraphicsDevice device, final GLCapabilitiesImmutable caps) { - final GLProfile glp = caps.getGLProfile(); - final int[] reqMajorCTP = new int[2]; - GLContext.getRequestMajorAndCompat(glp, reqMajorCTP); - if( glp.isGLES() ) { - if( reqMajorCTP[0] >= 3 ) { - reqMajorCTP[1] |= GLContext.CTX_IMPL_ES3_COMPAT | GLContext.CTX_IMPL_ES2_COMPAT | GLContext.CTX_IMPL_FBO ; - } else if( reqMajorCTP[0] >= 2 ) { - reqMajorCTP[1] |= GLContext.CTX_IMPL_ES2_COMPAT | GLContext.CTX_IMPL_FBO ; - } - } - if( !caps.getHardwareAccelerated() ) { - reqMajorCTP[1] |= GLContext.CTX_IMPL_ACCEL_SOFT; + /* pp */ static final boolean isGLES2ES3(final int majorVersion, final int ctxOptions) { + if( 0 != ( ctxOptions & CTX_PROFILE_ES ) ) { + return 2 == majorVersion || 3 == majorVersion; + } else { + return false; } - mapStaticGLESVersion(device, reqMajorCTP[0], 0, reqMajorCTP[1]); } - /* pp */ static void mapStaticGLESVersion(final AbstractGraphicsDevice device, final int major, final int minor, final int ctp) { - if( 0 != ( ctp & GLContext.CTX_PROFILE_ES) ) { - // ES1, ES2, ES3, .. - mapStaticGLESVersion(device, major /* reqMajor */, major, minor, ctp); - if( 3 == major ) { - // map ES2 -> ES3 - mapStaticGLESVersion(device, 2 /* reqMajor */, major, minor, ctp); - } - } + /* pp */ static final boolean isGLDesktop(final int ctxOptions) { + return 0 != (ctxOptions & (CTX_PROFILE_COMPAT|CTX_PROFILE_CORE)); } - private static void mapStaticGLESVersion(final AbstractGraphicsDevice device, final int reqMajor, final int major, final int minor, final int ctp) { - GLContext.mapAvailableGLVersion(device, reqMajor, GLContext.CTX_PROFILE_ES, 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, GLContext.CTX_PROFILE_ES, major, minor, ctp); - } + protected static StringBuilder getGLProfile(final StringBuilder sb, final int ctp) { + return GLContext.getGLProfile(sb, ctp); } - protected static String getGLVersion(final int major, final int minor, final int ctp, final String gl_version) { - return GLContext.getGLVersion(major, minor, ctp, gl_version); + /* pp */ int getContextOptions() { return ctxOptions; } + protected static void remapAvailableGLVersions(final AbstractGraphicsDevice fromDevice, final AbstractGraphicsDevice toDevice) { + GLContextImpl.remapAvailableGLVersions(fromDevice, toDevice); } - - protected static boolean getAvailableGLVersionsSet(final AbstractGraphicsDevice device) { - return GLContext.getAvailableGLVersionsSet(device); + protected static synchronized void setMappedGLVersionListener(final MappedGLVersionListener mvl) { + GLContextImpl.setMappedGLVersionListener(mvl); } - protected static void setAvailableGLVersionsSet(final AbstractGraphicsDevice device, final boolean set) { - GLContext.setAvailableGLVersionsSet(device, set); + + protected static String getGLVersion(final int major, final int minor, final int ctp, final String gl_version) { + return GLContext.getGLVersion(major, minor, ctp, gl_version); } protected static String toHexString(final int hex) { |