#include "ast.h"
#include "glsl_parser_extras.h"
#include "glsl_types.h"
+#include "main/context.h"
#define YYLEX_PARAM state->scanner
switch ($2) {
case 100:
state->es_shader = true;
- supported = state->Const.GLSL_100ES;
+ supported = state->ctx->API == API_OPENGLES2 ||
+ state->ctx->Extensions.ARB_ES2_compatibility;
break;
case 110:
- supported = state->Const.GLSL_110;
- break;
case 120:
- supported = state->Const.GLSL_120;
- break;
+ /* FINISHME: Once the OpenGL 3.0 'forward compatible' context or
+ * the OpenGL 3.2 Core context is supported, this logic will need
+ * change. Older versions of GLSL are no longer supported
+ * outside the compatibility contexts of 3.x.
+ */
case 130:
- supported = state->Const.GLSL_130;
- break;
case 140:
- supported = state->Const.GLSL_140;
+ case 150:
+ case 330:
+ case 400:
+ case 410:
+ case 420:
+ supported = _mesa_is_desktop_gl(state->ctx) &&
+ ((unsigned) $2) <= state->ctx->Const.GLSLVersion;
break;
default:
supported = false;
this->Const.MaxDrawBuffers = ctx->Const.MaxDrawBuffers;
- /* Note: Once the OpenGL 3.0 'forward compatible' context or the OpenGL 3.2
- * Core context is supported, this logic will need change. Older versions of
- * GLSL are no longer supported outside the compatibility contexts of 3.x.
- */
- this->Const.GLSL_100ES = (ctx->API == API_OPENGLES2)
- || ctx->Extensions.ARB_ES2_compatibility;
- 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 =
- is_desktop_gl ? ctx->Const.GLSLVersion : 100;
+ _mesa_is_desktop_gl(ctx) ? ctx->Const.GLSLVersion : 100;
char *supported = ralloc_strdup(this, "");
for (unsigned ver = lowest_version; ver <= highest_version; ver += 10) {
/* ARB_draw_buffers */
unsigned MaxDrawBuffers;
-
- /**
- * Set of GLSL versions supported by the current context
- *
- * Knowing that version X is supported doesn't mean that versions before
- * X are also supported. Version 1.00 is only supported in an ES2
- * context or when GL_ARB_ES2_compatibility is supported. In an OpenGL
- * 3.0 "forward compatible" context, GLSL 1.10 and 1.20 are \b not
- * supported.
- */
- /*@{*/
- unsigned GLSL_100ES:1;
- unsigned GLSL_110:1;
- unsigned GLSL_120:1;
- unsigned GLSL_130:1;
- unsigned GLSL_140:1;
- /*@}*/
} Const;
/**