From 21f82eb8b74a60cc8a869e073e124d44c75f217e Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Fri, 23 Aug 2019 07:25:53 +0200 Subject: Bug 1383: Tighten version/profile qualification: fail if: requested compat profile && has core profile On Mesa, if requesting a 3.1 compat profile, we receive a 4.5 core profile. This is natural due to constraints within glXCreateContextAttribsARB, i.e. GLX_CONTEXT_PROFILE_MASK_ARB is only a available for versions >= 3.2 and these are not available on Mesa. Tested with Mesa 18.3.6 of Debian 10 Buster, which also confirms Bug 1385 fix of limitating GL3CompatNonCompliant to Mesa < 18.2.0 --- src/jogl/classes/jogamp/opengl/GLContextImpl.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java index 5f5823801..72a6b0b4e 100644 --- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java @@ -1860,6 +1860,7 @@ public abstract class GLContextImpl extends GLContext { // Relaxed match for versions ( !isES && major < 3 ) requests, last resort! // Otherwise: // - fail if hasVersion < reqVersion (desktop and ES) + // - fail if requested compat && has core profile (desktop) // - fail if ES major-version mismatch: // - request 1, >= 3 must be equal // - request 2 must be [2..3] @@ -1867,6 +1868,7 @@ public abstract class GLContextImpl extends GLContext { final int _hasMajor = hasGLVersionByInt.getMajor(); if( strictMatch && ( ( ( isESReq || reqMajor >= 3 ) && hasGLVersionByInt.compareTo(reqGLVersion) < 0 ) || + ( !isESReq && 0 != ( reqCtxProfileBits & GLContext.CTX_PROFILE_COMPAT ) && 0 != ( hasCtxProfileBits & GLContext.CTX_PROFILE_CORE ) ) || ( isESReq && ( ( 2 == reqMajor && ( 2 > _hasMajor || _hasMajor > 3 ) ) || // 2 -> [2..3] @@ -1876,7 +1878,9 @@ public abstract class GLContextImpl extends GLContext { ) ) { if(DEBUG) { System.err.println(getThreadName() + ": GLContext.setGLFuncAvail.X: FAIL, GL version mismatch (Int): requested "+ - GLContext.getGLVersion(reqMajor, reqMinor, reqCtxProfileBits, null)+" -> has "+glVersion+", "+hasGLVersionByInt); + GLContext.getGLVersion(reqMajor, reqMinor, reqCtxProfileBits, null)+ + " -> has "+glVersion+", "+hasGLVersionByInt+" - "+ + GLContext.getGLVersion(glIntMajor[0], glIntMinor[0], hasCtxProfileBits, null)); } return false; } @@ -1912,6 +1916,7 @@ public abstract class GLContextImpl extends GLContext { // Relaxed match for versions ( !isES && major < 3 ) requests, last resort! // Otherwise: // - fail if hasVersion < reqVersion (desktop and ES) + // - fail if requested compat && has core profile (desktop) // - fail if ES major-version mismatch: // - request 1, >= 3 must be equal // - request 2 must be [2..3] @@ -1919,6 +1924,7 @@ public abstract class GLContextImpl extends GLContext { final int _hasMajor = hasGLVersionByString.getMajor(); if( strictMatch && ( ( ( isESReq || reqMajor >= 3 ) && hasGLVersionByString.compareTo(reqGLVersion) < 0 ) || + ( !isESReq && 0 != ( reqCtxProfileBits & GLContext.CTX_PROFILE_COMPAT ) && 0 != ( hasCtxProfileBits & GLContext.CTX_PROFILE_CORE ) ) || ( isESReq && ( ( 2 == reqMajor && ( 2 > _hasMajor || _hasMajor > 3 ) ) || // 2 -> [2..3] @@ -1928,7 +1934,9 @@ public abstract class GLContextImpl extends GLContext { ) ) { if(DEBUG) { System.err.println(getThreadName() + ": GLContext.setGLFuncAvail.X: FAIL, GL version mismatch (String): requested "+ - GLContext.getGLVersion(reqMajor, reqMinor, reqCtxProfileBits, null)+" -> has "+glVersion+", "+hasGLVersionByString); + GLContext.getGLVersion(reqMajor, reqMinor, reqCtxProfileBits, null)+ + " -> has "+glVersion+", "+hasGLVersionByString+" - "+ + GLContext.getGLVersion(hasGLVersionByString.getMajor(), hasGLVersionByString.getMinor(), hasCtxProfileBits, null)); } return false; } -- cgit v1.2.3