[Mesa-dev] [PATCH 1/2] mesa: fix up GLSL version when computing GL version

Ilia Mirkin imirkin at alum.mit.edu
Mon Apr 27 06:23:54 PDT 2015


Some required extension might be missing, and we may expose a GLSL
version that does not match up with the GL version. Fix that up when
computing the GL version.

Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
---
 src/mesa/main/version.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c
index a65ace0..bf0a1cf 100644
--- a/src/mesa/main/version.c
+++ b/src/mesa/main/version.c
@@ -207,7 +207,7 @@ _mesa_override_glsl_version(struct gl_constants *consts)
  */
 static GLuint
 compute_version(const struct gl_extensions *extensions,
-                const struct gl_constants *consts, gl_api api)
+                struct gl_constants *consts, gl_api api)
 {
    GLuint major, minor, version;
 
@@ -330,38 +330,47 @@ compute_version(const struct gl_extensions *extensions,
    if (ver_4_2) {
       major = 4;
       minor = 2;
+      consts->GLSLVersion = 420;
    }
    else if (ver_4_1) {
       major = 4;
       minor = 1;
+      consts->GLSLVersion = 410;
    }
    else if (ver_4_0) {
       major = 4;
       minor = 0;
+      consts->GLSLVersion = 400;
    }
    else if (ver_3_3) {
       major = 3;
       minor = 3;
+      consts->GLSLVersion = 330;
    }
    else if (ver_3_2) {
       major = 3;
       minor = 2;
+      consts->GLSLVersion = 150;
    }
    else if (ver_3_1) {
       major = 3;
       minor = 1;
+      consts->GLSLVersion = 140;
    }
    else if (ver_3_0) {
       major = 3;
       minor = 0;
+      consts->GLSLVersion = 130;
    }
    else if (ver_2_1) {
       major = 2;
       minor = 1;
+      consts->GLSLVersion = 120;
    }
    else if (ver_2_0) {
       major = 2;
       minor = 0;
+      consts->GLSLVersion = 110;
    }
    else if (ver_1_5) {
       major = 1;
-- 
2.0.5



More information about the mesa-dev mailing list