aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl
diff options
context:
space:
mode:
authorBrice Figureau <[email protected]>2013-10-29 14:49:25 +0100
committerBrice Figureau <[email protected]>2013-10-29 14:49:25 +0100
commit85be81387d33224036b3fe2b02d74aab2926e028 (patch)
treea142177fecf58d9fe0d0226bb65b069a0b50d4a2 /src/jogl
parentbcfaa149b9803ce33c5a356cbcb45f7dfd3e4361 (diff)
Fix #875 - ES version should be strictly validated
When initializing the context in GLContextImpl.setGLFuncAvailability ES devices must be validated by strictly matching the major version, otherwise on ES3 devices we were mixing ES1 implementation with ES3 contexts, ultimately crashing in a safeguard. Signed-off-by: Brice Figureau <[email protected]>
Diffstat (limited to 'src/jogl')
-rw-r--r--src/jogl/classes/jogamp/opengl/GLContextImpl.java26
1 files changed, 17 insertions, 9 deletions
diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
index 377ebd9f5..77e493b25 100644
--- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
@@ -1386,6 +1386,8 @@ public abstract class GLContextImpl extends GLContext {
}
}
+ boolean isES = ( CTX_PROFILE_ES & ctxProfileBits ) != 0;
+
//
// Validate GL version either by GL-Integer or GL-String
//
@@ -1424,10 +1426,13 @@ public abstract class GLContextImpl extends GLContext {
}
return false;
}
- // Use returned GL version!
- major = glIntMajor[0];
- minor = glIntMinor[0];
- versionValidated = true;
+ // impose strict matching for ES
+ if ((isES && major == glIntMajor[0]) || !isES) {
+ // Use returned GL version!
+ major = glIntMajor[0];
+ minor = glIntMinor[0];
+ versionValidated = true;
+ }
} else {
versionGL3IntFailed = true;
}
@@ -1455,10 +1460,13 @@ public abstract class GLContextImpl extends GLContext {
}
return false;
}
- // Use returned GL version!
- major = hasGLVersionNumber.getMajor();
- minor = hasGLVersionNumber.getMinor();
- versionValidated = true;
+ // impose strict matching for ES
+ if ((isES && major == hasGLVersionNumber.getMajor()) || !isES) {
+ // Use returned GL version!
+ major = hasGLVersionNumber.getMajor();
+ minor = hasGLVersionNumber.getMinor();
+ versionValidated = true;
+ }
}
}
if( strictMatch && !versionValidated ) {
@@ -1551,7 +1559,7 @@ public abstract class GLContextImpl extends GLContext {
}
}
- if( 0 != ( CTX_PROFILE_ES & ctxProfileBits ) ) {
+ if( isES ) {
if( major >= 3 ) {
ctxProfileBits |= CTX_IMPL_ES3_COMPAT | CTX_IMPL_ES2_COMPAT ;
ctxProfileBits |= CTX_IMPL_FBO;