OSDN Git Service

glsl: add support for using API_OPENGL_CORE
authorJordan Justen <jordan.l.justen@intel.com>
Tue, 24 Jul 2012 21:48:57 +0000 (14:48 -0700)
committerJordan Justen <jordan.l.justen@intel.com>
Mon, 30 Jul 2012 23:25:56 +0000 (16:25 -0700)
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/glsl/glsl_parser_extras.cpp

index df40459..7a9b221 100644 (file)
@@ -27,6 +27,7 @@
 
 extern "C" {
 #include "main/core.h" /* for struct gl_context */
+#include "main/context.h"
 }
 
 #include "ralloc.h"
@@ -90,19 +91,17 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *_ctx,
     */
    this->Const.GLSL_100ES = (ctx->API == API_OPENGLES2)
       || ctx->Extensions.ARB_ES2_compatibility;
-   this->Const.GLSL_110 = (ctx->API == API_OPENGL);
-   this->Const.GLSL_120 = (ctx->API == API_OPENGL)
-      && (ctx->Const.GLSLVersion >= 120);
-   this->Const.GLSL_130 = (ctx->API == API_OPENGL)
-      && (ctx->Const.GLSLVersion >= 130);
-   this->Const.GLSL_140 = (ctx->API == API_OPENGL)
-      && (ctx->Const.GLSLVersion >= 140);
+   bool is_desktop_gl = _mesa_is_desktop_gl(ctx);
+   this->Const.GLSL_110 = is_desktop_gl;
+   this->Const.GLSL_120 = is_desktop_gl && (ctx->Const.GLSLVersion >= 120);
+   this->Const.GLSL_130 = is_desktop_gl && (ctx->Const.GLSLVersion >= 130);
+   this->Const.GLSL_140 = is_desktop_gl && (ctx->Const.GLSLVersion >= 140);
 
    const unsigned lowest_version =
       (ctx->API == API_OPENGLES2) || ctx->Extensions.ARB_ES2_compatibility
       ? 100 : 110;
    const unsigned highest_version =
-      (ctx->API == API_OPENGL) ? ctx->Const.GLSLVersion : 100;
+      is_desktop_gl ? ctx->Const.GLSLVersion : 100;
    char *supported = ralloc_strdup(this, "");
 
    for (unsigned ver = lowest_version; ver <= highest_version; ver += 10) {