summaryrefslogtreecommitdiff
path: root/src/glsl/glsl_lexer.lpp
diff options
context:
space:
mode:
authorKenneth Graunke <kenneth@whitecape.org>2010-09-05 01:32:32 -0700
committerKenneth Graunke <kenneth@whitecape.org>2010-09-07 17:30:37 -0700
commitc5e74871d9e4b555f3927fd11944c769d466bd12 (patch)
tree825fa8b99437fdf49016705dcd7aa98025e367df /src/glsl/glsl_lexer.lpp
parent7dcfc44b72f00ba5a38cb02123c80113440f0de9 (diff)
glsl: Recognize GLSL ES 1.00 keywords.
Diffstat (limited to 'src/glsl/glsl_lexer.lpp')
-rw-r--r--src/glsl/glsl_lexer.lpp24
1 files changed, 17 insertions, 7 deletions
diff --git a/src/glsl/glsl_lexer.lpp b/src/glsl/glsl_lexer.lpp
index 1de1fb4cf7..ed3cb251a1 100644
--- a/src/glsl/glsl_lexer.lpp
+++ b/src/glsl/glsl_lexer.lpp
@@ -46,6 +46,16 @@
} \
} while (0)
+/* Handle reserved words in GLSL ES (version 100) */
+#define TOKEN_OR_IDENTIFIER_ES(version, token) \
+ do { \
+ if (yyextra->es_shader) { \
+ return token; \
+ } else { \
+ TOKEN_OR_IDENTIFIER(version, token); \
+ } \
+ } while (0)
+
#define RESERVED_WORD(version, token) \
do { \
if (yyextra->language_version >= version) { \
@@ -190,9 +200,9 @@ inout return INOUT_TOK;
uniform return UNIFORM;
varying return VARYING;
centroid TOKEN_OR_IDENTIFIER(120, CENTROID);
-invariant TOKEN_OR_IDENTIFIER(120, INVARIANT);
+invariant TOKEN_OR_IDENTIFIER_ES(120, INVARIANT);
-flat TOKEN_OR_IDENTIFIER(130, FLAT);
+flat TOKEN_OR_IDENTIFIER_ES(130, FLAT);
smooth TOKEN_OR_IDENTIFIER(130, SMOOTH);
noperspective TOKEN_OR_IDENTIFIER(130, NOPERSPECTIVE);
@@ -327,16 +337,16 @@ namespace RESERVED_WORD(999, NAMESPACE);
using RESERVED_WORD(999, USING);
/* Additional reserved words in GLSL 1.20. */
-lowp TOKEN_OR_IDENTIFIER(120, LOWP);
-mediump TOKEN_OR_IDENTIFIER(120, MEDIUMP);
-highp TOKEN_OR_IDENTIFIER(120, HIGHP);
-precision TOKEN_OR_IDENTIFIER(120, PRECISION);
+lowp TOKEN_OR_IDENTIFIER_ES(120, LOWP);
+mediump TOKEN_OR_IDENTIFIER_ES(120, MEDIUMP);
+highp TOKEN_OR_IDENTIFIER_ES(120, HIGHP);
+precision TOKEN_OR_IDENTIFIER_ES(120, PRECISION);
/* Additional reserved words in GLSL 1.30. */
common TOKEN_OR_IDENTIFIER(130, COMMON);
partition TOKEN_OR_IDENTIFIER(130, PARTITION);
active TOKEN_OR_IDENTIFIER(130, ACTIVE);
-superp TOKEN_OR_IDENTIFIER(130, SUPERP);
+superp TOKEN_OR_IDENTIFIER_ES(130, SUPERP);
samplerBuffer TOKEN_OR_IDENTIFIER(130, SAMPLERBUFFER);
filter TOKEN_OR_IDENTIFIER(130, FILTER);
image1D TOKEN_OR_IDENTIFIER(130, IMAGE1D);