diff options
Diffstat (limited to 'src/jogl')
-rw-r--r-- | src/jogl/classes/com/jogamp/opengl/GLBase.java | 13 | ||||
-rw-r--r-- | src/jogl/classes/com/jogamp/opengl/GLContext.java | 47 | ||||
-rw-r--r-- | src/jogl/classes/com/jogamp/opengl/GLExtensions.java | 1 | ||||
-rw-r--r-- | src/jogl/classes/jogamp/opengl/GLContextImpl.java | 36 |
4 files changed, 80 insertions, 17 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/GLBase.java b/src/jogl/classes/com/jogamp/opengl/GLBase.java index b6704e6ba..dee5f1488 100644 --- a/src/jogl/classes/com/jogamp/opengl/GLBase.java +++ b/src/jogl/classes/com/jogamp/opengl/GLBase.java @@ -224,6 +224,19 @@ public interface GLBase { public boolean isGLES3Compatible(); /** + * Indicates whether this GL object is compatible with the core OpenGL ES3.1 functionality. + * <p> + * Return true if the underlying context is an ES3 context ≥ 3.1 or implements + * the extension <code>GL_ARB_ES3_1_compatibility</code>, otherwise false. + * </p> + * <p> + * Includes [ GL ≥ 4.5, GL ≥ 3.1 w/ GL_ARB_ES3_1_compatibility and GLES3 ≥ 3.1 ] + * </p> + * @see GLContext#isGLES31Compatible() + */ + public boolean isGLES31Compatible(); + + /** * Indicates whether this GL object supports GLSL. * @see GLContext#hasGLSL() */ diff --git a/src/jogl/classes/com/jogamp/opengl/GLContext.java b/src/jogl/classes/com/jogamp/opengl/GLContext.java index 6366c4e37..5ecd5e1e1 100644 --- a/src/jogl/classes/com/jogamp/opengl/GLContext.java +++ b/src/jogl/classes/com/jogamp/opengl/GLContext.java @@ -193,10 +193,13 @@ public abstract class GLContext { // /** <code>GL_ARB_ES2_compatibility</code> implementation related: Context is compatible w/ ES2. Not a cache key. See {@link #isGLES2Compatible()}, {@link #getAvailableContextProperties(AbstractGraphicsDevice, GLProfile)}. */ - protected static final int CTX_IMPL_ES2_COMPAT = 1 << 10; + protected static final int CTX_IMPL_ES2_COMPAT = 1 << 10; /** <code>GL_ARB_ES3_compatibility</code> implementation related: Context is compatible w/ ES3. Not a cache key. See {@link #isGLES3Compatible()}, {@link #getAvailableContextProperties(AbstractGraphicsDevice, GLProfile)}. */ - protected static final int CTX_IMPL_ES3_COMPAT = 1 << 11; + protected static final int CTX_IMPL_ES3_COMPAT = 1 << 11; + + /** <code>GL_ARB_ES3_1_compatibility</code> implementation related: Context is compatible w/ ES3. Not a cache key. See {@link #isGLES31Compatible()}, {@link #getAvailableContextProperties(AbstractGraphicsDevice, GLProfile)}. */ + protected static final int CTX_IMPL_ES31_COMPAT = 1 << 12; /** * Context supports basic FBO, details see {@link #hasBasicFBOSupport()}. @@ -204,7 +207,7 @@ public abstract class GLContext { * @see #hasBasicFBOSupport() * @see #getAvailableContextProperties(AbstractGraphicsDevice, GLProfile) */ - protected static final int CTX_IMPL_FBO = 1 << 12; + protected static final int CTX_IMPL_FBO = 1 << 13; /** * Context supports <code>OES_single_precision</code>, fp32, fixed function point (FFP) compatibility entry points, @@ -213,7 +216,7 @@ public abstract class GLContext { * @see #hasFP32CompatAPI() * @see #getAvailableContextProperties(AbstractGraphicsDevice, GLProfile) */ - protected static final int CTX_IMPL_FP32_COMPAT_API = 1 << 13; + protected static final int CTX_IMPL_FP32_COMPAT_API = 1 << 14; private static final ThreadLocal<GLContext> currentContext = new ThreadLocal<GLContext>(); @@ -911,6 +914,17 @@ public abstract class GLContext { } /** + * Return true if this context is an ES3 context ≥ 3.1 or implements + * the extension <code>GL_ARB_ES3_1_compatibility</code>, otherwise false. + * <p> + * Includes [ GL ≥ 4.5, GL ≥ 3.1 w/ GL_ARB_ES3_1_compatibility and GLES3 ≥ 3.1 ] + * </p> + */ + public final boolean isGLES31Compatible() { + return 0 != ( ctxOptions & CTX_IMPL_ES31_COMPAT ) ; + } + + /** * @return true if impl. is a hardware rasterizer, otherwise false. * @see #isHardwareRasterizer(AbstractGraphicsDevice, GLProfile) * @see GLProfile#isHardwareRasterizer() @@ -988,7 +1002,7 @@ public abstract class GLContext { final GL gl = getGL(); final int[] val = new int[] { 0 } ; try { - gl.glGetIntegerv(GL2ES3.GL_MAX_SAMPLES, val, 0); + gl.glGetIntegerv(GL.GL_MAX_SAMPLES, val, 0); final int glerr = gl.glGetError(); if(GL.GL_NO_ERROR == glerr) { return val[0]; @@ -1958,6 +1972,29 @@ public abstract class GLContext { } return 0 != ( ctp[0] & CTX_IMPL_ES3_COMPAT ); } + /** + * Returns true if a ES3 ≥ 3.1 compatible profile is available, + * i.e. either a ≥ 4.5 context or a ≥ 3.1 context supporting <code>GL_ARB_ES3_1_compatibility</code>, + * otherwise false. + * <p> + * Includes [ GL ≥ 4.5, GL ≥ 3.1 w/ GL_ARB_ES3_1_compatibility and GLES3 ≥ 3.1 ] + * </p> + */ + public static final boolean isGLES31CompatibleAvailable(final AbstractGraphicsDevice device) { + final int major[] = { 0 }; + final int minor[] = { 0 }; + final int ctp[] = { 0 }; + boolean ok; + + ok = GLContext.getAvailableGLVersion(device, 3, GLContext.CTX_PROFILE_ES, major, minor, ctp); + if( !ok ) { + ok = GLContext.getAvailableGLVersion(device, 3, GLContext.CTX_PROFILE_CORE, major, minor, ctp); + } + if( !ok ) { + GLContext.getAvailableGLVersion(device, 3, GLContext.CTX_PROFILE_COMPAT, major, minor, ctp); + } + return 0 != ( ctp[0] & CTX_IMPL_ES31_COMPAT ); + } public static boolean isGL4bcAvailable(final AbstractGraphicsDevice device, final boolean isHardware[]) { return isGLVersionAvailable(device, 4, CTX_PROFILE_COMPAT, isHardware); diff --git a/src/jogl/classes/com/jogamp/opengl/GLExtensions.java b/src/jogl/classes/com/jogamp/opengl/GLExtensions.java index 1593da25c..1bf8071ea 100644 --- a/src/jogl/classes/com/jogamp/opengl/GLExtensions.java +++ b/src/jogl/classes/com/jogamp/opengl/GLExtensions.java @@ -52,6 +52,7 @@ public class GLExtensions { public static final String ARB_ES2_compatibility = "GL_ARB_ES2_compatibility"; public static final String ARB_ES3_compatibility = "GL_ARB_ES3_compatibility"; + public static final String ARB_ES3_1_compatibility = "GL_ARB_ES3_1_compatibility"; public static final String EXT_abgr = "GL_EXT_abgr"; public static final String OES_rgb8_rgba8 = "GL_OES_rgb8_rgba8"; diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java index 928ed0284..c56dc74da 100644 --- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java @@ -41,7 +41,6 @@ package jogamp.opengl; import java.lang.reflect.Method; -import java.nio.ByteBuffer; import java.nio.IntBuffer; import java.security.AccessController; import java.security.PrivilegedAction; @@ -1319,9 +1318,11 @@ public abstract class GLContextImpl extends GLContext { name. Currently not used. */ protected final String mapToRealGLFunctionName(final String glFunctionName) { final Map<String, String> map = getFunctionNameMap(); - final String lookup = ( null != map ) ? map.get(glFunctionName) : null; - if (lookup != null) { - return lookup; + if( null != map ) { + final String lookup = map.get(glFunctionName); + if (lookup != null) { + return lookup; + } } return glFunctionName; } @@ -1334,9 +1335,11 @@ public abstract class GLContextImpl extends GLContext { */ protected final String mapToRealGLExtensionName(final String glExtensionName) { final Map<String, String> map = getExtensionNameMap(); - final String lookup = ( null != map ) ? map.get(glExtensionName) : null; - if (lookup != null) { - return lookup; + if( null != map ) { + final String lookup = map.get(glExtensionName); + if (lookup != null) { + return lookup; + } } return glExtensionName; } @@ -1654,7 +1657,7 @@ public abstract class GLContextImpl extends GLContext { } if( major < 2 ) { // there is no ES2/3-compat for a profile w/ major < 2 - ctxProfileBits &= ~ ( GLContext.CTX_IMPL_ES2_COMPAT | GLContext.CTX_IMPL_ES3_COMPAT ) ; + ctxProfileBits &= ~ ( GLContext.CTX_IMPL_ES2_COMPAT | GLContext.CTX_IMPL_ES3_COMPAT | GLContext.CTX_IMPL_ES31_COMPAT ) ; } if(!isCurrentContextHardwareRasterizer()) { @@ -1748,10 +1751,19 @@ public abstract class GLContextImpl extends GLContext { if( major >= 3 ) { ctxProfileBits |= CTX_IMPL_ES3_COMPAT | CTX_IMPL_ES2_COMPAT ; ctxProfileBits |= CTX_IMPL_FBO; + if( minor >= 1 ) { + ctxProfileBits |= CTX_IMPL_ES31_COMPAT; + } } else if( major >= 2 ) { ctxProfileBits |= CTX_IMPL_ES2_COMPAT; ctxProfileBits |= CTX_IMPL_FBO; } + } else if( ( major > 4 || major == 4 && minor >= 5 ) || + ( ( major > 3 || major == 3 && minor >= 1 ) && isExtensionAvailable( GLExtensions.ARB_ES3_1_compatibility ) ) ) { + // See GLContext.isGLES31CompatibleAvailable(..)/isGLES31Compatible() + // Includes [ GL ≥ 4.5, GL ≥ 3.1 w/ GL_ARB_ES3_1_compatibility and GLES ≥ 3.1 ] + ctxProfileBits |= CTX_IMPL_ES31_COMPAT | CTX_IMPL_ES3_COMPAT | CTX_IMPL_ES2_COMPAT ; + ctxProfileBits |= CTX_IMPL_FBO; } else if( ( major > 4 || major == 4 && minor >= 3 ) || ( ( major > 3 || major == 3 && minor >= 1 ) && isExtensionAvailable( GLExtensions.ARB_ES3_compatibility ) ) ) { // See GLContext.isGLES3CompatibleAvailable(..)/isGLES3Compatible() @@ -2424,10 +2436,10 @@ public abstract class GLContextImpl extends GLContext { } switch(target) { case GL.GL_FRAMEBUFFER: - case GL2ES3.GL_DRAW_FRAMEBUFFER: + case GL.GL_DRAW_FRAMEBUFFER: boundFBOTarget[0] = framebufferName; // draw break; - case GL2ES3.GL_READ_FRAMEBUFFER: + case GL.GL_READ_FRAMEBUFFER: boundFBOTarget[1] = framebufferName; // read break; default: // ignore untracked target @@ -2437,9 +2449,9 @@ public abstract class GLContextImpl extends GLContext { public final int getBoundFramebuffer(final int target) { switch(target) { case GL.GL_FRAMEBUFFER: - case GL2ES3.GL_DRAW_FRAMEBUFFER: + case GL.GL_DRAW_FRAMEBUFFER: return boundFBOTarget[0]; // draw - case GL2ES3.GL_READ_FRAMEBUFFER: + case GL.GL_READ_FRAMEBUFFER: return boundFBOTarget[1]; // read default: throw new InternalError("Invalid FBO target name: "+toHexString(target)); |