diff options
author | Kenneth Graunke <kenneth@whitecape.org> | 2010-09-05 01:32:32 -0700 |
---|---|---|
committer | Kenneth Graunke <kenneth@whitecape.org> | 2010-09-07 17:30:37 -0700 |
commit | c5e74871d9e4b555f3927fd11944c769d466bd12 (patch) | |
tree | 825fa8b99437fdf49016705dcd7aa98025e367df | |
parent | 7dcfc44b72f00ba5a38cb02123c80113440f0de9 (diff) |
glsl: Recognize GLSL ES 1.00 keywords.
-rw-r--r-- | src/glsl/glsl_lexer.cpp | 424 | ||||
-rw-r--r-- | src/glsl/glsl_lexer.lpp | 24 | ||||
-rw-r--r-- | src/glsl/glsl_parser.cpp | 54 | ||||
-rw-r--r-- | src/glsl/glsl_parser.ypp | 66 |
4 files changed, 287 insertions, 281 deletions
diff --git a/src/glsl/glsl_lexer.cpp b/src/glsl/glsl_lexer.cpp index 873df609d3..7661bbe982 100644 --- a/src/glsl/glsl_lexer.cpp +++ b/src/glsl/glsl_lexer.cpp @@ -54,6 +54,7 @@ typedef int flex_int32_t; typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; +#endif /* ! C99 */ /* Limits of integral types. */ #ifndef INT8_MIN @@ -84,8 +85,6 @@ typedef unsigned int flex_uint32_t; #define UINT32_MAX (4294967295U) #endif -#endif /* ! C99 */ - #endif /* ! FLEXINT_H */ #ifdef __cplusplus @@ -159,15 +158,7 @@ typedef void* yyscan_t; /* Size of default input buffer. */ #ifndef YY_BUF_SIZE -#ifdef __ia64__ -/* On IA-64, the buffer size is 16k, not 8k. - * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. - * Ditto for the __ia64__ case accordingly. - */ -#define YY_BUF_SIZE 32768 -#else #define YY_BUF_SIZE 16384 -#endif /* __ia64__ */ #endif /* The state buf must be large enough to hold one state per character in the main buffer. @@ -974,6 +965,16 @@ static yyconst flex_int16_t yy_chk[1145] = } \ } 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) { \ @@ -985,7 +986,7 @@ static yyconst flex_int16_t yy_chk[1145] = } \ } while (0) -#line 989 "glsl_lexer.cpp" +#line 990 "glsl_lexer.cpp" #define INITIAL 0 #define PP 1 @@ -1112,12 +1113,7 @@ static int input (yyscan_t yyscanner ); /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE -#ifdef __ia64__ -/* On IA-64, the buffer size is 16k, not 8k */ -#define YY_READ_BUF_SIZE 16384 -#else #define YY_READ_BUF_SIZE 8192 -#endif /* __ia64__ */ #endif /* Copy whatever the last rule matched to the standard output. */ @@ -1125,7 +1121,7 @@ static int input (yyscan_t yyscanner ); /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) +#define ECHO fwrite( yytext, yyleng, 1, yyout ) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -1136,7 +1132,7 @@ static int input (yyscan_t yyscanner ); if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ - size_t n; \ + int n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ @@ -1224,10 +1220,10 @@ YY_DECL register int yy_act; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; -#line 76 "glsl_lexer.lpp" +#line 86 "glsl_lexer.lpp" -#line 1231 "glsl_lexer.cpp" +#line 1227 "glsl_lexer.cpp" yylval = yylval_param; @@ -1313,7 +1309,7 @@ do_action: /* This label is used only to access EOF actions. */ case 1: YY_RULE_SETUP -#line 78 "glsl_lexer.lpp" +#line 88 "glsl_lexer.lpp" ; YY_BREAK /* Preprocessor tokens. */ @@ -1322,17 +1318,17 @@ case 2: yyg->yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 81 "glsl_lexer.lpp" +#line 91 "glsl_lexer.lpp" ; YY_BREAK case 3: YY_RULE_SETUP -#line 82 "glsl_lexer.lpp" +#line 92 "glsl_lexer.lpp" { BEGIN PP; return VERSION; } YY_BREAK case 4: YY_RULE_SETUP -#line 83 "glsl_lexer.lpp" +#line 93 "glsl_lexer.lpp" { BEGIN PP; return EXTENSION; } YY_BREAK case 5: @@ -1340,7 +1336,7 @@ case 5: yyg->yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 84 "glsl_lexer.lpp" +#line 94 "glsl_lexer.lpp" { /* Eat characters until the first digit is * encountered @@ -1362,7 +1358,7 @@ case 6: yyg->yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 99 "glsl_lexer.lpp" +#line 109 "glsl_lexer.lpp" { /* Eat characters until the first digit is * encountered @@ -1380,7 +1376,7 @@ YY_RULE_SETUP YY_BREAK case 7: YY_RULE_SETUP -#line 113 "glsl_lexer.lpp" +#line 123 "glsl_lexer.lpp" { BEGIN PP; return PRAGMA_DEBUG_ON; @@ -1388,7 +1384,7 @@ YY_RULE_SETUP YY_BREAK case 8: YY_RULE_SETUP -#line 117 "glsl_lexer.lpp" +#line 127 "glsl_lexer.lpp" { BEGIN PP; return PRAGMA_DEBUG_OFF; @@ -1396,7 +1392,7 @@ YY_RULE_SETUP YY_BREAK case 9: YY_RULE_SETUP -#line 121 "glsl_lexer.lpp" +#line 131 "glsl_lexer.lpp" { BEGIN PP; return PRAGMA_OPTIMIZE_ON; @@ -1404,7 +1400,7 @@ YY_RULE_SETUP YY_BREAK case 10: YY_RULE_SETUP -#line 125 "glsl_lexer.lpp" +#line 135 "glsl_lexer.lpp" { BEGIN PP; return PRAGMA_OPTIMIZE_OFF; @@ -1412,38 +1408,38 @@ YY_RULE_SETUP YY_BREAK case 11: YY_RULE_SETUP -#line 129 "glsl_lexer.lpp" +#line 139 "glsl_lexer.lpp" { BEGIN PRAGMA; } YY_BREAK case 12: /* rule 12 can match eol */ YY_RULE_SETUP -#line 131 "glsl_lexer.lpp" +#line 141 "glsl_lexer.lpp" { BEGIN 0; yylineno++; yycolumn = 0; } YY_BREAK case 13: YY_RULE_SETUP -#line 132 "glsl_lexer.lpp" +#line 142 "glsl_lexer.lpp" { } YY_BREAK case 14: YY_RULE_SETUP -#line 134 "glsl_lexer.lpp" +#line 144 "glsl_lexer.lpp" { } YY_BREAK case 15: YY_RULE_SETUP -#line 135 "glsl_lexer.lpp" +#line 145 "glsl_lexer.lpp" { } YY_BREAK case 16: YY_RULE_SETUP -#line 136 "glsl_lexer.lpp" +#line 146 "glsl_lexer.lpp" return COLON; YY_BREAK case 17: YY_RULE_SETUP -#line 137 "glsl_lexer.lpp" +#line 147 "glsl_lexer.lpp" { yylval->identifier = strdup(yytext); return IDENTIFIER; @@ -1451,7 +1447,7 @@ YY_RULE_SETUP YY_BREAK case 18: YY_RULE_SETUP -#line 141 "glsl_lexer.lpp" +#line 151 "glsl_lexer.lpp" { yylval->n = strtol(yytext, NULL, 10); return INTCONSTANT; @@ -1460,283 +1456,283 @@ YY_RULE_SETUP case 19: /* rule 19 can match eol */ YY_RULE_SETUP -#line 145 "glsl_lexer.lpp" +#line 155 "glsl_lexer.lpp" { BEGIN 0; yylineno++; yycolumn = 0; return EOL; } YY_BREAK case 20: /* rule 20 can match eol */ YY_RULE_SETUP -#line 147 "glsl_lexer.lpp" +#line 157 "glsl_lexer.lpp" { yylineno++; yycolumn = 0; } YY_BREAK case 21: YY_RULE_SETUP -#line 149 "glsl_lexer.lpp" +#line 159 "glsl_lexer.lpp" return ATTRIBUTE; YY_BREAK case 22: YY_RULE_SETUP -#line 150 "glsl_lexer.lpp" +#line 160 "glsl_lexer.lpp" return CONST_TOK; YY_BREAK case 23: YY_RULE_SETUP -#line 151 "glsl_lexer.lpp" +#line 161 "glsl_lexer.lpp" return BOOL_TOK; YY_BREAK case 24: YY_RULE_SETUP -#line 152 "glsl_lexer.lpp" +#line 162 "glsl_lexer.lpp" return FLOAT_TOK; YY_BREAK case 25: YY_RULE_SETUP -#line 153 "glsl_lexer.lpp" +#line 163 "glsl_lexer.lpp" return INT_TOK; YY_BREAK case 26: YY_RULE_SETUP -#line 155 "glsl_lexer.lpp" +#line 165 "glsl_lexer.lpp" return BREAK; YY_BREAK case 27: YY_RULE_SETUP -#line 156 "glsl_lexer.lpp" +#line 166 "glsl_lexer.lpp" return CONTINUE; YY_BREAK case 28: YY_RULE_SETUP -#line 157 "glsl_lexer.lpp" +#line 167 "glsl_lexer.lpp" return DO; YY_BREAK case 29: YY_RULE_SETUP -#line 158 "glsl_lexer.lpp" +#line 168 "glsl_lexer.lpp" return WHILE; YY_BREAK case 30: YY_RULE_SETUP -#line 159 "glsl_lexer.lpp" +#line 169 "glsl_lexer.lpp" return ELSE; YY_BREAK case 31: YY_RULE_SETUP -#line 160 "glsl_lexer.lpp" +#line 170 "glsl_lexer.lpp" return FOR; YY_BREAK case 32: YY_RULE_SETUP -#line 161 "glsl_lexer.lpp" +#line 171 "glsl_lexer.lpp" return IF; YY_BREAK case 33: YY_RULE_SETUP -#line 162 "glsl_lexer.lpp" +#line 172 "glsl_lexer.lpp" return DISCARD; YY_BREAK case 34: YY_RULE_SETUP -#line 163 "glsl_lexer.lpp" +#line 173 "glsl_lexer.lpp" return RETURN; YY_BREAK case 35: YY_RULE_SETUP -#line 165 "glsl_lexer.lpp" +#line 175 "glsl_lexer.lpp" return BVEC2; YY_BREAK case 36: YY_RULE_SETUP -#line 166 "glsl_lexer.lpp" +#line 176 "glsl_lexer.lpp" return BVEC3; YY_BREAK case 37: YY_RULE_SETUP -#line 167 "glsl_lexer.lpp" +#line 177 "glsl_lexer.lpp" return BVEC4; YY_BREAK case 38: YY_RULE_SETUP -#line 168 "glsl_lexer.lpp" +#line 178 "glsl_lexer.lpp" return IVEC2; YY_BREAK case 39: YY_RULE_SETUP -#line 169 "glsl_lexer.lpp" +#line 179 "glsl_lexer.lpp" return IVEC3; YY_BREAK case 40: YY_RULE_SETUP -#line 170 "glsl_lexer.lpp" +#line 180 "glsl_lexer.lpp" return IVEC4; YY_BREAK case 41: YY_RULE_SETUP -#line 171 "glsl_lexer.lpp" +#line 181 "glsl_lexer.lpp" return VEC2; YY_BREAK case 42: YY_RULE_SETUP -#line 172 "glsl_lexer.lpp" +#line 182 "glsl_lexer.lpp" return VEC3; YY_BREAK case 43: YY_RULE_SETUP -#line 173 "glsl_lexer.lpp" +#line 183 "glsl_lexer.lpp" return VEC4; YY_BREAK case 44: YY_RULE_SETUP -#line 174 "glsl_lexer.lpp" +#line 184 "glsl_lexer.lpp" return MAT2X2; YY_BREAK case 45: YY_RULE_SETUP -#line 175 "glsl_lexer.lpp" +#line 185 "glsl_lexer.lpp" return MAT3X3; YY_BREAK case 46: YY_RULE_SETUP -#line 176 "glsl_lexer.lpp" +#line 186 "glsl_lexer.lpp" return MAT4X4; YY_BREAK case 47: YY_RULE_SETUP -#line 177 "glsl_lexer.lpp" +#line 187 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(120, MAT2X2); YY_BREAK case 48: YY_RULE_SETUP -#line 178 "glsl_lexer.lpp" +#line 188 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(120, MAT2X3); YY_BREAK case 49: YY_RULE_SETUP -#line 179 "glsl_lexer.lpp" +#line 189 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(120, MAT2X4); YY_BREAK case 50: YY_RULE_SETUP -#line 180 "glsl_lexer.lpp" +#line 190 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(120, MAT3X2); YY_BREAK case 51: YY_RULE_SETUP -#line 181 "glsl_lexer.lpp" +#line 191 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(120, MAT3X3); YY_BREAK case 52: YY_RULE_SETUP -#line 182 "glsl_lexer.lpp" +#line 192 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(120, MAT3X4); YY_BREAK case 53: YY_RULE_SETUP -#line 183 "glsl_lexer.lpp" +#line 193 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(120, MAT4X2); YY_BREAK case 54: YY_RULE_SETUP -#line 184 "glsl_lexer.lpp" +#line 194 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(120, MAT4X3); YY_BREAK case 55: YY_RULE_SETUP -#line 185 "glsl_lexer.lpp" +#line 195 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(120, MAT4X4); YY_BREAK case 56: YY_RULE_SETUP -#line 187 "glsl_lexer.lpp" +#line 197 "glsl_lexer.lpp" return IN_TOK; YY_BREAK case 57: YY_RULE_SETUP -#line 188 "glsl_lexer.lpp" +#line 198 "glsl_lexer.lpp" return OUT_TOK; YY_BREAK case 58: YY_RULE_SETUP -#line 189 "glsl_lexer.lpp" +#line 199 "glsl_lexer.lpp" return INOUT_TOK; YY_BREAK case 59: YY_RULE_SETUP -#line 190 "glsl_lexer.lpp" +#line 200 "glsl_lexer.lpp" return UNIFORM; YY_BREAK case 60: YY_RULE_SETUP -#line 191 "glsl_lexer.lpp" +#line 201 "glsl_lexer.lpp" return VARYING; YY_BREAK case 61: YY_RULE_SETUP -#line 192 "glsl_lexer.lpp" +#line 202 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(120, CENTROID); YY_BREAK case 62: YY_RULE_SETUP -#line 193 "glsl_lexer.lpp" -TOKEN_OR_IDENTIFIER(120, INVARIANT); +#line 203 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER_ES(120, INVARIANT); YY_BREAK case 63: YY_RULE_SETUP -#line 195 "glsl_lexer.lpp" -TOKEN_OR_IDENTIFIER(130, FLAT); +#line 205 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER_ES(130, FLAT); YY_BREAK case 64: YY_RULE_SETUP -#line 196 "glsl_lexer.lpp" +#line 206 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, SMOOTH); YY_BREAK case 65: YY_RULE_SETUP -#line 197 "glsl_lexer.lpp" +#line 207 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, NOPERSPECTIVE); YY_BREAK case 66: YY_RULE_SETUP -#line 199 "glsl_lexer.lpp" +#line 209 "glsl_lexer.lpp" return SAMPLER1D; YY_BREAK case 67: YY_RULE_SETUP -#line 200 "glsl_lexer.lpp" +#line 210 "glsl_lexer.lpp" return SAMPLER2D; YY_BREAK case 68: YY_RULE_SETUP -#line 201 "glsl_lexer.lpp" +#line 211 "glsl_lexer.lpp" return SAMPLER3D; YY_BREAK case 69: YY_RULE_SETUP -#line 202 "glsl_lexer.lpp" +#line 212 "glsl_lexer.lpp" return SAMPLERCUBE; YY_BREAK case 70: YY_RULE_SETUP -#line 203 "glsl_lexer.lpp" +#line 213 "glsl_lexer.lpp" return SAMPLER1DSHADOW; YY_BREAK case 71: YY_RULE_SETUP -#line 204 "glsl_lexer.lpp" +#line 214 "glsl_lexer.lpp" return SAMPLER2DSHADOW; YY_BREAK case 72: YY_RULE_SETUP -#line 206 "glsl_lexer.lpp" +#line 216 "glsl_lexer.lpp" return STRUCT; YY_BREAK case 73: YY_RULE_SETUP -#line 207 "glsl_lexer.lpp" +#line 217 "glsl_lexer.lpp" return VOID_TOK; YY_BREAK case 74: YY_RULE_SETUP -#line 209 "glsl_lexer.lpp" +#line 219 "glsl_lexer.lpp" { if ((yyextra->language_version >= 140) || (yyextra->ARB_fragment_coord_conventions_enable)){ @@ -1749,102 +1745,102 @@ YY_RULE_SETUP YY_BREAK case 75: YY_RULE_SETUP -#line 219 "glsl_lexer.lpp" +#line 229 "glsl_lexer.lpp" return INC_OP; YY_BREAK case 76: YY_RULE_SETUP -#line 220 "glsl_lexer.lpp" +#line 230 "glsl_lexer.lpp" return DEC_OP; YY_BREAK case 77: YY_RULE_SETUP -#line 221 "glsl_lexer.lpp" +#line 231 "glsl_lexer.lpp" return LE_OP; YY_BREAK case 78: YY_RULE_SETUP -#line 222 "glsl_lexer.lpp" +#line 232 "glsl_lexer.lpp" return GE_OP; YY_BREAK case 79: YY_RULE_SETUP -#line 223 "glsl_lexer.lpp" +#line 233 "glsl_lexer.lpp" return EQ_OP; YY_BREAK case 80: YY_RULE_SETUP -#line 224 "glsl_lexer.lpp" +#line 234 "glsl_lexer.lpp" return NE_OP; YY_BREAK case 81: YY_RULE_SETUP -#line 225 "glsl_lexer.lpp" +#line 235 "glsl_lexer.lpp" return AND_OP; YY_BREAK case 82: YY_RULE_SETUP -#line 226 "glsl_lexer.lpp" +#line 236 "glsl_lexer.lpp" return OR_OP; YY_BREAK case 83: YY_RULE_SETUP -#line 227 "glsl_lexer.lpp" +#line 237 "glsl_lexer.lpp" return XOR_OP; YY_BREAK case 84: YY_RULE_SETUP -#line 229 "glsl_lexer.lpp" +#line 239 "glsl_lexer.lpp" return MUL_ASSIGN; YY_BREAK case 85: YY_RULE_SETUP -#line 230 "glsl_lexer.lpp" +#line 240 "glsl_lexer.lpp" return DIV_ASSIGN; YY_BREAK case 86: YY_RULE_SETUP -#line 231 "glsl_lexer.lpp" +#line 241 "glsl_lexer.lpp" return ADD_ASSIGN; YY_BREAK case 87: YY_RULE_SETUP -#line 232 "glsl_lexer.lpp" +#line 242 "glsl_lexer.lpp" return MOD_ASSIGN; YY_BREAK case 88: YY_RULE_SETUP -#line 233 "glsl_lexer.lpp" +#line 243 "glsl_lexer.lpp" return LEFT_ASSIGN; YY_BREAK case 89: YY_RULE_SETUP -#line 234 "glsl_lexer.lpp" +#line 244 "glsl_lexer.lpp" return RIGHT_ASSIGN; YY_BREAK case 90: YY_RULE_SETUP -#line 235 "glsl_lexer.lpp" +#line 245 "glsl_lexer.lpp" return AND_ASSIGN; YY_BREAK case 91: YY_RULE_SETUP -#line 236 "glsl_lexer.lpp" +#line 246 "glsl_lexer.lpp" return XOR_ASSIGN; YY_BREAK case 92: YY_RULE_SETUP -#line 237 "glsl_lexer.lpp" +#line 247 "glsl_lexer.lpp" return OR_ASSIGN; YY_BREAK case 93: YY_RULE_SETUP -#line 238 "glsl_lexer.lpp" +#line 248 "glsl_lexer.lpp" return SUB_ASSIGN; YY_BREAK case 94: YY_RULE_SETUP -#line 240 "glsl_lexer.lpp" +#line 250 "glsl_lexer.lpp" { yylval->n = strtol(yytext, NULL, 10); return INTCONSTANT; @@ -1852,7 +1848,7 @@ YY_RULE_SETUP YY_BREAK case 95: YY_RULE_SETUP -#line 244 "glsl_lexer.lpp" +#line 254 "glsl_lexer.lpp" { yylval->n = strtol(yytext + 2, NULL, 16); return INTCONSTANT; @@ -1860,7 +1856,7 @@ YY_RULE_SETUP YY_BREAK case 96: YY_RULE_SETUP -#line 248 "glsl_lexer.lpp" +#line 258 "glsl_lexer.lpp" { yylval->n = strtol(yytext, NULL, 8); return INTCONSTANT; @@ -1868,7 +1864,7 @@ YY_RULE_SETUP YY_BREAK case 97: YY_RULE_SETUP -#line 253 "glsl_lexer.lpp" +#line 263 "glsl_lexer.lpp" { yylval->real = strtod(yytext, NULL); return FLOATCONSTANT; @@ -1876,7 +1872,7 @@ YY_RULE_SETUP YY_BREAK case 98: YY_RULE_SETUP -#line 257 "glsl_lexer.lpp" +#line 267 "glsl_lexer.lpp" { yylval->real = strtod(yytext, NULL); return FLOATCONSTANT; @@ -1884,7 +1880,7 @@ YY_RULE_SETUP YY_BREAK case 99: YY_RULE_SETUP -#line 261 "glsl_lexer.lpp" +#line 271 "glsl_lexer.lpp" { yylval->real = strtod(yytext, NULL); return FLOATCONSTANT; @@ -1892,7 +1888,7 @@ YY_RULE_SETUP YY_BREAK case 100: YY_RULE_SETUP -#line 265 "glsl_lexer.lpp" +#line 275 "glsl_lexer.lpp" { yylval->real = strtod(yytext, NULL); return FLOATCONSTANT; @@ -1900,7 +1896,7 @@ YY_RULE_SETUP YY_BREAK case 101: YY_RULE_SETUP -#line 269 "glsl_lexer.lpp" +#line 279 "glsl_lexer.lpp" { yylval->real = strtod(yytext, NULL); return FLOATCONSTANT; @@ -1908,7 +1904,7 @@ YY_RULE_SETUP YY_BREAK case 102: YY_RULE_SETUP -#line 274 "glsl_lexer.lpp" +#line 284 "glsl_lexer.lpp" { yylval->n = 1; return BOOLCONSTANT; @@ -1916,7 +1912,7 @@ YY_RULE_SETUP YY_BREAK case 103: YY_RULE_SETUP -#line 278 "glsl_lexer.lpp" +#line 288 "glsl_lexer.lpp" { yylval->n = 0; return BOOLCONSTANT; @@ -1925,394 +1921,394 @@ YY_RULE_SETUP /* Reserved words in GLSL 1.10. */ case 104: YY_RULE_SETUP -#line 285 "glsl_lexer.lpp" +#line 295 "glsl_lexer.lpp" RESERVED_WORD(999, ASM); YY_BREAK case 105: YY_RULE_SETUP -#line 286 "glsl_lexer.lpp" +#line 296 "glsl_lexer.lpp" RESERVED_WORD(999, CLASS); YY_BREAK case 106: YY_RULE_SETUP -#line 287 "glsl_lexer.lpp" +#line 297 "glsl_lexer.lpp" RESERVED_WORD(999, UNION); YY_BREAK case 107: YY_RULE_SETUP -#line 288 "glsl_lexer.lpp" +#line 298 "glsl_lexer.lpp" RESERVED_WORD(999, ENUM); YY_BREAK case 108: YY_RULE_SETUP -#line 289 "glsl_lexer.lpp" +#line 299 "glsl_lexer.lpp" RESERVED_WORD(999, TYPEDEF); YY_BREAK case 109: YY_RULE_SETUP -#line 290 "glsl_lexer.lpp" +#line 300 "glsl_lexer.lpp" RESERVED_WORD(999, TEMPLATE); YY_BREAK case 110: YY_RULE_SETUP -#line 291 "glsl_lexer.lpp" +#line 301 "glsl_lexer.lpp" RESERVED_WORD(999, THIS); YY_BREAK case 111: YY_RULE_SETUP -#line 292 "glsl_lexer.lpp" +#line 302 "glsl_lexer.lpp" RESERVED_WORD(999, PACKED_TOK); YY_BREAK case 112: YY_RULE_SETUP -#line 293 "glsl_lexer.lpp" +#line 303 "glsl_lexer.lpp" RESERVED_WORD(999, GOTO); YY_BREAK case 113: YY_RULE_SETUP -#line 294 "glsl_lexer.lpp" +#line 304 "glsl_lexer.lpp" RESERVED_WORD(130, SWITCH); YY_BREAK case 114: YY_RULE_SETUP -#line 295 "glsl_lexer.lpp" +#line 305 "glsl_lexer.lpp" RESERVED_WORD(130, DEFAULT); YY_BREAK case 115: YY_RULE_SETUP -#line 296 "glsl_lexer.lpp" +#line 306 "glsl_lexer.lpp" RESERVED_WORD(999, INLINE_TOK); YY_BREAK case 116: YY_RULE_SETUP -#line 297 "glsl_lexer.lpp" +#line 307 "glsl_lexer.lpp" RESERVED_WORD(999, NOINLINE); YY_BREAK case 117: YY_RULE_SETUP -#line 298 "glsl_lexer.lpp" +#line 308 "glsl_lexer.lpp" RESERVED_WORD(999, VOLATILE); YY_BREAK case 118: YY_RULE_SETUP -#line 299 "glsl_lexer.lpp" +#line 309 "glsl_lexer.lpp" RESERVED_WORD(999, PUBLIC_TOK); YY_BREAK case 119: YY_RULE_SETUP -#line 300 "glsl_lexer.lpp" +#line 310 "glsl_lexer.lpp" RESERVED_WORD(999, STATIC); YY_BREAK case 120: YY_RULE_SETUP -#line 301 "glsl_lexer.lpp" +#line 311 "glsl_lexer.lpp" RESERVED_WORD(999, EXTERN); YY_BREAK case 121: YY_RULE_SETUP -#line 302 "glsl_lexer.lpp" +#line 312 "glsl_lexer.lpp" RESERVED_WORD(999, EXTERNAL); YY_BREAK case 122: YY_RULE_SETUP -#line 303 "glsl_lexer.lpp" +#line 313 "glsl_lexer.lpp" RESERVED_WORD(999, INTERFACE); YY_BREAK case 123: YY_RULE_SETUP -#line 304 "glsl_lexer.lpp" +#line 314 "glsl_lexer.lpp" RESERVED_WORD(999, LONG_TOK); YY_BREAK case 124: YY_RULE_SETUP -#line 305 "glsl_lexer.lpp" +#line 315 "glsl_lexer.lpp" RESERVED_WORD(999, SHORT_TOK); YY_BREAK case 125: YY_RULE_SETUP -#line 306 "glsl_lexer.lpp" +#line 316 "glsl_lexer.lpp" RESERVED_WORD(999, DOUBLE_TOK); YY_BREAK case 126: YY_RULE_SETUP -#line 307 "glsl_lexer.lpp" +#line 317 "glsl_lexer.lpp" RESERVED_WORD(999, HALF); YY_BREAK case 127: YY_RULE_SETUP -#line 308 "glsl_lexer.lpp" +#line 318 "glsl_lexer.lpp" RESERVED_WORD(999, FIXED_TOK); YY_BREAK case 128: YY_RULE_SETUP -#line 309 "glsl_lexer.lpp" +#line 319 "glsl_lexer.lpp" RESERVED_WORD(999, UNSIGNED); YY_BREAK case 129: YY_RULE_SETUP -#line 310 "glsl_lexer.lpp" +#line 320 "glsl_lexer.lpp" RESERVED_WORD(999, INPUT_TOK); YY_BREAK case 130: YY_RULE_SETUP -#line 311 "glsl_lexer.lpp" +#line 321 "glsl_lexer.lpp" RESERVED_WORD(999, OUTPUT); YY_BREAK case 131: YY_RULE_SETUP -#line 312 "glsl_lexer.lpp" +#line 322 "glsl_lexer.lpp" RESERVED_WORD(999, HVEC2); YY_BREAK case 132: YY_RULE_SETUP -#line 313 "glsl_lexer.lpp" +#line 323 "glsl_lexer.lpp" RESERVED_WORD(999, HVEC3); YY_BREAK case 133: YY_RULE_SETUP -#line 314 "glsl_lexer.lpp" +#line 324 "glsl_lexer.lpp" RESERVED_WORD(999, HVEC4); YY_BREAK case 134: YY_RULE_SETUP -#line 315 "glsl_lexer.lpp" +#line 325 "glsl_lexer.lpp" RESERVED_WORD(999, DVEC2); YY_BREAK case 135: YY_RULE_SETUP -#line 316 "glsl_lexer.lpp" +#line 326 "glsl_lexer.lpp" RESERVED_WORD(999, DVEC3); YY_BREAK case 136: YY_RULE_SETUP -#line 317 "glsl_lexer.lpp" +#line 327 "glsl_lexer.lpp" RESERVED_WORD(999, DVEC4); YY_BREAK case 137: YY_RULE_SETUP -#line 318 "glsl_lexer.lpp" +#line 328 "glsl_lexer.lpp" RESERVED_WORD(999, FVEC2); YY_BREAK case 138: YY_RULE_SETUP -#line 319 "glsl_lexer.lpp" +#line 329 "glsl_lexer.lpp" RESERVED_WORD(999, FVEC3); YY_BREAK case 139: YY_RULE_SETUP -#line 320 "glsl_lexer.lpp" +#line 330 "glsl_lexer.lpp" RESERVED_WORD(999, FVEC4); YY_BREAK case 140: YY_RULE_SETUP -#line 321 "glsl_lexer.lpp" +#line 331 "glsl_lexer.lpp" return SAMPLER2DRECT; YY_BREAK case 141: YY_RULE_SETUP -#line 322 "glsl_lexer.lpp" +#line 332 "glsl_lexer.lpp" RESERVED_WORD(999, SAMPLER3DRECT); YY_BREAK case 142: YY_RULE_SETUP -#line 323 "glsl_lexer.lpp" +#line 333 "glsl_lexer.lpp" return SAMPLER2DRECTSHADOW; YY_BREAK case 143: YY_RULE_SETUP -#line 324 "glsl_lexer.lpp" +#line 334 "glsl_lexer.lpp" RESERVED_WORD(999, SIZEOF); YY_BREAK case 144: YY_RULE_SETUP -#line 325 "glsl_lexer.lpp" +#line 335 "glsl_lexer.lpp" RESERVED_WORD(999, CAST); YY_BREAK case 145: YY_RULE_SETUP -#line 326 "glsl_lexer.lpp" +#line 336 "glsl_lexer.lpp" RESERVED_WORD(999, NAMESPACE); YY_BREAK case 146: YY_RULE_SETUP -#line 327 "glsl_lexer.lpp" +#line 337 "glsl_lexer.lpp" RESERVED_WORD(999, USING); YY_BREAK /* Additional reserved words in GLSL 1.20. */ case 147: YY_RULE_SETUP -#line 330 "glsl_lexer.lpp" -TOKEN_OR_IDENTIFIER(120, LOWP); +#line 340 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER_ES(120, LOWP); YY_BREAK case 148: YY_RULE_SETUP -#line 331 "glsl_lexer.lpp" -TOKEN_OR_IDENTIFIER(120, MEDIUMP); +#line 341 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER_ES(120, MEDIUMP); YY_BREAK case 149: YY_RULE_SETUP -#line 332 "glsl_lexer.lpp" -TOKEN_OR_IDENTIFIER(120, HIGHP); +#line 342 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER_ES(120, HIGHP); YY_BREAK case 150: YY_RULE_SETUP -#line 333 "glsl_lexer.lpp" -TOKEN_OR_IDENTIFIER(120, PRECISION); +#line 343 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER_ES(120, PRECISION); YY_BREAK /* Additional reserved words in GLSL 1.30. */ case 151: YY_RULE_SETUP -#line 336 "glsl_lexer.lpp" +#line 346 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, COMMON); YY_BREAK case 152: YY_RULE_SETUP -#line 337 "glsl_lexer.lpp" +#line 347 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, PARTITION); YY_BREAK case 153: YY_RULE_SETUP -#line 338 "glsl_lexer.lpp" +#line 348 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, ACTIVE); YY_BREAK case 154: YY_RULE_SETUP -#line 339 "glsl_lexer.lpp" -TOKEN_OR_IDENTIFIER(130, SUPERP); +#line 349 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER_ES(130, SUPERP); YY_BREAK case 155: YY_RULE_SETUP -#line 340 "glsl_lexer.lpp" +#line 350 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, SAMPLERBUFFER); YY_BREAK case 156: YY_RULE_SETUP -#line 341 "glsl_lexer.lpp" +#line 351 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, FILTER); YY_BREAK case 157: YY_RULE_SETUP -#line 342 "glsl_lexer.lpp" +#line 352 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, IMAGE1D); YY_BREAK case 158: YY_RULE_SETUP -#line 343 "glsl_lexer.lpp" +#line 353 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, IMAGE2D); YY_BREAK case 159: YY_RULE_SETUP -#line 344 "glsl_lexer.lpp" +#line 354 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, IMAGE3D); YY_BREAK case 160: YY_RULE_SETUP -#line 345 "glsl_lexer.lpp" +#line 355 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, IMAGECUBE); YY_BREAK case 161: YY_RULE_SETUP -#line 346 "glsl_lexer.lpp" +#line 356 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, IIMAGE1D); YY_BREAK case 162: YY_RULE_SETUP -#line 347 "glsl_lexer.lpp" +#line 357 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, IIMAGE2D); YY_BREAK case 163: YY_RULE_SETUP -#line 348 "glsl_lexer.lpp" +#line 358 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, IIMAGE3D); YY_BREAK case 164: YY_RULE_SETUP -#line 349 "glsl_lexer.lpp" +#line 359 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, IIMAGECUBE); YY_BREAK case 165: YY_RULE_SETUP -#line 350 "glsl_lexer.lpp" +#line 360 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, UIMAGE1D); YY_BREAK case 166: YY_RULE_SETUP -#line 351 "glsl_lexer.lpp" +#line 361 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, UIMAGE2D); YY_BREAK case 167: YY_RULE_SETUP -#line 352 "glsl_lexer.lpp" +#line 362 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, UIMAGE3D); YY_BREAK case 168: YY_RULE_SETUP -#line 353 "glsl_lexer.lpp" +#line 363 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, UIMAGECUBE); YY_BREAK case 169: YY_RULE_SETUP -#line 354 "glsl_lexer.lpp" +#line 364 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, IMAGE1DARRAY); YY_BREAK case 170: YY_RULE_SETUP -#line 355 "glsl_lexer.lpp" +#line 365 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, IMAGE2DARRAY); YY_BREAK case 171: YY_RULE_SETUP -#line 356 "glsl_lexer.lpp" +#line 366 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, IIMAGE1DARRAY); YY_BREAK case 172: YY_RULE_SETUP -#line 357 "glsl_lexer.lpp" +#line 367 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, IIMAGE2DARRAY); YY_BREAK case 173: YY_RULE_SETUP -#line 358 "glsl_lexer.lpp" +#line 368 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, UIMAGE1DARRAY); YY_BREAK case 174: YY_RULE_SETUP -#line 359 "glsl_lexer.lpp" +#line 369 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, UIMAGE2DARRAY); YY_BREAK case 175: YY_RULE_SETUP -#line 360 "glsl_lexer.lpp" +#line 370 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, IMAGE1DSHADOW); YY_BREAK case 176: YY_RULE_SETUP -#line 361 "glsl_lexer.lpp" +#line 371 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, IMAGE2DSHADOW); YY_BREAK case 177: YY_RULE_SETUP -#line 362 "glsl_lexer.lpp" +#line 372 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, IMAGEBUFFER); YY_BREAK case 178: YY_RULE_SETUP -#line 363 "glsl_lexer.lpp" +#line 373 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, IIMAGEBUFFER); YY_BREAK case 179: YY_RULE_SETUP -#line 364 "glsl_lexer.lpp" +#line 374 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, UIMAGEBUFFER); YY_BREAK case 180: YY_RULE_SETUP -#line 365 "glsl_lexer.lpp" +#line 375 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, ROW_MAJOR); YY_BREAK case 181: YY_RULE_SETUP -#line 367 "glsl_lexer.lpp" +#line 377 "glsl_lexer.lpp" { struct _mesa_glsl_parse_state *state = yyextra; void *ctx = state; @@ -2322,15 +2318,15 @@ YY_RULE_SETUP YY_BREAK case 182: YY_RULE_SETUP -#line 374 "glsl_lexer.lpp" +#line 384 "glsl_lexer.lpp" { return yytext[0]; } YY_BREAK case 183: YY_RULE_SETUP -#line 376 "glsl_lexer.lpp" +#line 386 "glsl_lexer.lpp" ECHO; YY_BREAK -#line 2334 "glsl_lexer.cpp" +#line 2330 "glsl_lexer.cpp" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(PP): case YY_STATE_EOF(PRAGMA): @@ -3066,8 +3062,8 @@ YY_BUFFER_STATE _mesa_glsl__scan_string (yyconst char * yystr , yyscan_t yyscann /** Setup the input buffer state to scan the given bytes. The next call to _mesa_glsl_lex() will * scan from a @e copy of @a bytes. - * @param yybytes the byte buffer to scan - * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. + * @param bytes the byte buffer to scan + * @param len the number of bytes in the buffer pointed to by @a bytes. * @param yyscanner The scanner object. * @return the newly allocated buffer state object. */ @@ -3473,7 +3469,7 @@ void _mesa_glsl_free (void * ptr , yyscan_t yyscanner) #define YYTABLES_NAME "yytables" -#line 376 "glsl_lexer.lpp" +#line 386 "glsl_lexer.lpp" 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); diff --git a/src/glsl/glsl_parser.cpp b/src/glsl/glsl_parser.cpp index 8eae6b4210..301c221892 100644 --- a/src/glsl/glsl_parser.cpp +++ b/src/glsl/glsl_parser.cpp @@ -4529,16 +4529,16 @@ yyreduce: /* Line 1464 of yacc.c */ #line 1152 "glsl_parser.ypp" { - if (state->language_version < 130) - _mesa_glsl_error(& (yylsp[(1) - (1)]), state, - "precision qualifier forbidden " - "in GLSL %d.%d (1.30 or later " - "required)\n", - state->language_version / 100, - state->language_version % 100); + if (!state->es_shader && state->language_version < 130) + _mesa_glsl_error(& (yylsp[(1) - (1)]), state, + "precision qualifier forbidden " + "in GLSL %d.%d (1.30 or later " + "required)\n", + state->language_version / 100, + state->language_version % 100); - (yyval.n) = ast_precision_high; - ;} + (yyval.n) = ast_precision_high; + ;} break; case 217: @@ -4546,16 +4546,16 @@ yyreduce: /* Line 1464 of yacc.c */ #line 1163 "glsl_parser.ypp" { - if (state->language_version < 130) - _mesa_glsl_error(& (yylsp[(1) - (1)]), state, - "precision qualifier forbidden " - "in GLSL %d.%d (1.30 or later " - "required)\n", - state->language_version / 100, - state->language_version % 100); + if (!state->es_shader && state->language_version < 130) + _mesa_glsl_error(& (yylsp[(1) - (1)]), state, + "precision qualifier forbidden " + "in GLSL %d.%d (1.30 or later " + "required)\n", + state->language_version / 100, + state->language_version % 100); - (yyval.n) = ast_precision_medium; - ;} + (yyval.n) = ast_precision_medium; + ;} break; case 218: @@ -4563,16 +4563,16 @@ yyreduce: /* Line 1464 of yacc.c */ #line 1174 "glsl_parser.ypp" { - if (state->language_version < 130) - _mesa_glsl_error(& (yylsp[(1) - (1)]), state, - "precision qualifier forbidden " - "in GLSL %d.%d (1.30 or later " - "required)\n", - state->language_version / 100, - state->language_version % 100); + if (!state->es_shader && state->language_version < 130) + _mesa_glsl_error(& (yylsp[(1) - (1)]), state, + "precision qualifier forbidden " + "in GLSL %d.%d (1.30 or later " + "required)\n", + state->language_version / 100, + state->language_version % 100); - (yyval.n) = ast_precision_low; - ;} + (yyval.n) = ast_precision_low; + ;} break; case 219: diff --git a/src/glsl/glsl_parser.ypp b/src/glsl/glsl_parser.ypp index 594e445930..0df1e480ce 100644 --- a/src/glsl/glsl_parser.ypp +++ b/src/glsl/glsl_parser.ypp @@ -1149,39 +1149,39 @@ basic_type_specifier_nonarray: ; precision_qualifier: - HIGHP { - if (state->language_version < 130) - _mesa_glsl_error(& @1, state, - "precision qualifier forbidden " - "in GLSL %d.%d (1.30 or later " - "required)\n", - state->language_version / 100, - state->language_version % 100); - - $$ = ast_precision_high; - } - | MEDIUMP { - if (state->language_version < 130) - _mesa_glsl_error(& @1, state, - "precision qualifier forbidden " - "in GLSL %d.%d (1.30 or later " - "required)\n", - state->language_version / 100, - state->language_version % 100); - - $$ = ast_precision_medium; - } - | LOWP { - if (state->language_version < 130) - _mesa_glsl_error(& @1, state, - "precision qualifier forbidden " - "in GLSL %d.%d (1.30 or later " - "required)\n", - state->language_version / 100, - state->language_version % 100); - - $$ = ast_precision_low; - } + HIGHP { + if (!state->es_shader && state->language_version < 130) + _mesa_glsl_error(& @1, state, + "precision qualifier forbidden " + "in GLSL %d.%d (1.30 or later " + "required)\n", + state->language_version / 100, + state->language_version % 100); + + $$ = ast_precision_high; + } + | MEDIUMP { + if (!state->es_shader && state->language_version < 130) + _mesa_glsl_error(& @1, state, + "precision qualifier forbidden " + "in GLSL %d.%d (1.30 or later " + "required)\n", + state->language_version / 100, + state->language_version % 100); + + $$ = ast_precision_medium; + } + | LOWP { + if (!state->es_shader && state->language_version < 130) + _mesa_glsl_error(& @1, state, + "precision qualifier forbidden " + "in GLSL %d.%d (1.30 or later " + "required)\n", + state->language_version / 100, + state->language_version % 100); + + $$ = ast_precision_low; + } ; struct_specifier: |