diff options
author | Sven Gothel <[email protected]> | 2019-08-22 18:28:21 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2019-08-22 18:28:21 +0200 |
commit | 5d27c6400a472517e08a86165878f2360d4077bc (patch) | |
tree | 9d7c9fc4d6b4bc4fe4ee73e2f90952a772c95ebd /src | |
parent | c896476cc309ab9705329da2c9776a6c481fdb5f (diff) |
Bug 1383: GLContext.isValidGLVersion() ensure only one profile bit is set max; Add OpenGL version 4.6
Diffstat (limited to 'src')
-rw-r--r-- | src/jogl/classes/com/jogamp/opengl/GLContext.java | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/GLContext.java b/src/jogl/classes/com/jogamp/opengl/GLContext.java index 606e4b4ed..8f030ade4 100644 --- a/src/jogl/classes/com/jogamp/opengl/GLContext.java +++ b/src/jogl/classes/com/jogamp/opengl/GLContext.java @@ -55,6 +55,7 @@ import jogamp.opengl.GLContextImpl; import jogamp.opengl.GLContextShareSet; import com.jogamp.common.os.Platform; +import com.jogamp.common.util.Bitfield; import com.jogamp.common.util.VersionNumber; import com.jogamp.common.util.VersionNumberString; import com.jogamp.common.util.locks.LockFactory; @@ -1505,7 +1506,7 @@ public abstract class GLContext { /* 1.*/ { 0, 1, 2, 3, 4, 5 }, /* 2.*/ { 0, 1 }, /* 3.*/ { 0, 1, 2, 3 }, - /* 4.*/ { 0, 1, 2, 3, 4, 5 } }; + /* 4.*/ { 0, 1, 2, 3, 4, 5, 6 } }; public static final int ES_VERSIONS[][] = { /* 0.*/ { -1 }, @@ -1533,6 +1534,15 @@ public abstract class GLContext { /** * Returns true, if the major.minor is not inferior to the lowest * valid version and does not exceed the highest known major number by more than one. + * Otherwise returns false. + * <p> + * Returns false if more than one bit of the following list in {@code ctxProfile} is set + * <ul> + * <li>{@link GLContext#CTX_PROFILE_ES}</li> + * <li>{@link GLContext#CTX_PROFILE_CORE}</li> + * <li>{@link GLContext#CTX_PROFILE_COMPAT}</li> + * </ul> + * </p> * <p> * The minor version number is ignored by the upper limit validation * and the major version number may exceed by one. @@ -1550,6 +1560,9 @@ public abstract class GLContext { if( 1>major || 0>minor ) { return false; } + if ( 1 < Bitfield.Util.bitCount( ctxProfile & ( CTX_PROFILE_ES | CTX_PROFILE_CORE | CTX_PROFILE_COMPAT ) ) ) { + return false; + } if( 0 != ( CTX_PROFILE_ES & ctxProfile ) ) { if( major >= ES_VERSIONS.length + 1 ) return false; } else { |