diff options
Diffstat (limited to 'src/glsl')
-rw-r--r-- | src/glsl/.gitignore | 1 | ||||
-rw-r--r-- | src/glsl/ast.h | 28 | ||||
-rw-r--r-- | src/glsl/ast_to_hir.cpp | 161 | ||||
-rw-r--r-- | src/glsl/ast_type.cpp | 23 | ||||
-rw-r--r-- | src/glsl/glsl_parser.cpp | 860 | ||||
-rw-r--r-- | src/glsl/glsl_parser.h | 13 | ||||
-rw-r--r-- | src/glsl/glsl_parser.ypp | 22 | ||||
-rw-r--r-- | src/glsl/glsl_parser_extras.cpp | 6 | ||||
-rw-r--r-- | src/glsl/glsl_symbol_table.cpp | 9 | ||||
-rw-r--r-- | src/glsl/loop_analysis.cpp | 3 | ||||
-rw-r--r-- | src/glsl/loop_analysis.h | 2 |
11 files changed, 672 insertions, 456 deletions
diff --git a/src/glsl/.gitignore b/src/glsl/.gitignore index 162ed42be1f..d659d2e9a3b 100644 --- a/src/glsl/.gitignore +++ b/src/glsl/.gitignore @@ -1,3 +1,4 @@ glsl_compiler glsl_parser.output builtin_function.cpp +builtin_compiler diff --git a/src/glsl/ast.h b/src/glsl/ast.h index cd933cfc588..0e2811ca665 100644 --- a/src/glsl/ast.h +++ b/src/glsl/ast.h @@ -318,7 +318,8 @@ public: enum { - ast_precision_high = 0, /**< Default precision. */ + ast_precision_none = 0, /**< Absence of precision qualifier. */ + ast_precision_high, ast_precision_medium, ast_precision_low }; @@ -364,6 +365,23 @@ struct ast_type_qualifier { * This field is only valid if \c explicit_location is set. */ unsigned location; + + /** + * Return true if and only if an interpolation qualifier is present. + */ + bool has_interpolation() const; + + /** + * \brief Return string representation of interpolation qualifier. + * + * If an interpolation qualifier is present, then return that qualifier's + * string representation. Otherwise, return null. For example, if the + * noperspective bit is set, then this returns "noperspective". + * + * If multiple interpolation qualifiers are somehow present, then the + * returned string is undefined but not null. + */ + const char *interpolation_string() const; }; class ast_struct_specifier : public ast_node { @@ -444,7 +462,8 @@ public: /** Construct a type specifier from a type name */ ast_type_specifier(const char *name) : type_specifier(ast_type_name), type_name(name), structure(NULL), - is_array(false), array_size(NULL), precision(ast_precision_high) + is_array(false), array_size(NULL), precision(ast_precision_none), + is_precision_statement(false) { /* empty */ } @@ -452,7 +471,8 @@ public: /** Construct a type specifier from a structure definition */ ast_type_specifier(ast_struct_specifier *s) : type_specifier(ast_struct), type_name(s->name), structure(s), - is_array(false), array_size(NULL), precision(ast_precision_high) + is_array(false), array_size(NULL), precision(ast_precision_none), + is_precision_statement(false) { /* empty */ } @@ -474,6 +494,8 @@ public: ast_expression *array_size; unsigned precision:2; + + bool is_precision_statement; }; diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index 365a6e2676f..7a171f3a2bb 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -2277,6 +2277,112 @@ ast_declarator_list::hir(exec_list *instructions, } + /* Interpolation qualifiers cannot be applied to 'centroid' and + * 'centroid varying'. + * + * From page 29 (page 35 of the PDF) of the GLSL 1.30 spec: + * "interpolation qualifiers may only precede the qualifiers in, + * centroid in, out, or centroid out in a declaration. They do not apply + * to the deprecated storage qualifiers varying or centroid varying." + */ + if (state->language_version >= 130 + && this->type->qualifier.has_interpolation() + && this->type->qualifier.flags.q.varying) { + + const char *i = this->type->qualifier.interpolation_string(); + assert(i != NULL); + const char *s; + if (this->type->qualifier.flags.q.centroid) + s = "centroid varying"; + else + s = "varying"; + + _mesa_glsl_error(&loc, state, + "qualifier '%s' cannot be applied to the " + "deprecated storage qualifier '%s'", i, s); + } + + + /* Interpolation qualifiers can only apply to vertex shader outputs and + * fragment shader inputs. + * + * From page 29 (page 35 of the PDF) of the GLSL 1.30 spec: + * "Outputs from a vertex shader (out) and inputs to a fragment + * shader (in) can be further qualified with one or more of these + * interpolation qualifiers" + */ + if (state->language_version >= 130 + && this->type->qualifier.has_interpolation()) { + + const char *i = this->type->qualifier.interpolation_string(); + assert(i != NULL); + + switch (state->target) { + case vertex_shader: + if (this->type->qualifier.flags.q.in) { + _mesa_glsl_error(&loc, state, + "qualifier '%s' cannot be applied to vertex " + "shader inputs", i); + } + break; + case fragment_shader: + if (this->type->qualifier.flags.q.out) { + _mesa_glsl_error(&loc, state, + "qualifier '%s' cannot be applied to fragment " + "shader outputs", i); + } + break; + default: + assert(0); + } + } + + + /* From section 4.3.4 of the GLSL 1.30 spec: + * "It is an error to use centroid in in a vertex shader." + */ + if (state->language_version >= 130 + && this->type->qualifier.flags.q.centroid + && this->type->qualifier.flags.q.in + && state->target == vertex_shader) { + + _mesa_glsl_error(&loc, state, + "'centroid in' cannot be used in a vertex shader"); + } + + + /* Precision qualifiers exists only in GLSL versions 1.00 and >= 1.30. + */ + if (this->type->specifier->precision != ast_precision_none + && state->language_version != 100 + && state->language_version < 130) { + + _mesa_glsl_error(&loc, state, + "precision qualifiers are supported only in GLSL ES " + "1.00, and GLSL 1.30 and later"); + } + + + /* Precision qualifiers only apply to floating point and integer types. + * + * From section 4.5.2 of the GLSL 1.30 spec: + * "Any floating point or any integer declaration can have the type + * preceded by one of these precision qualifiers [...] Literal + * constants do not have precision qualifiers. Neither do Boolean + * variables. + */ + if (this->type->specifier->precision != ast_precision_none + && !var->type->is_float() + && !var->type->is_integer() + && !(var->type->is_array() + && (var->type->fields.array->is_float() + || var->type->fields.array->is_integer()))) { + + _mesa_glsl_error(&loc, state, + "precision qualifiers apply only to floating point " + "and integer types"); + } + /* Process the initializer and add its instructions to a temporary * list. This list will be added to the instruction stream (below) after * the declaration is added. This is done because in some cases (such as @@ -2403,7 +2509,8 @@ ast_declarator_list::hir(exec_list *instructions, */ if (this->type->qualifier.flags.q.constant && decl->initializer == NULL) { _mesa_glsl_error(& loc, state, - "const declaration of `%s' must be initialized"); + "const declaration of `%s' must be initialized", + decl->identifier); } /* Check if this declaration is actually a re-declaration, either to @@ -3132,6 +3239,58 @@ ir_rvalue * ast_type_specifier::hir(exec_list *instructions, struct _mesa_glsl_parse_state *state) { + if (!this->is_precision_statement && this->structure == NULL) + return NULL; + + YYLTYPE loc = this->get_location(); + + if (this->precision != ast_precision_none + && state->language_version != 100 + && state->language_version < 130) { + _mesa_glsl_error(&loc, state, + "precision qualifiers exist only in " + "GLSL ES 1.00, and GLSL 1.30 and later"); + return NULL; + } + if (this->precision != ast_precision_none + && this->structure != NULL) { + _mesa_glsl_error(&loc, state, + "precision qualifiers do not apply to structures"); + return NULL; + } + + /* If this is a precision statement, check that the type to which it is + * applied is either float or int. + * + * From section 4.5.3 of the GLSL 1.30 spec: + * "The precision statement + * precision precision-qualifier type; + * can be used to establish a default precision qualifier. The type + * field can be either int or float [...]. Any other types or + * qualifiers will result in an error. + */ + if (this->is_precision_statement) { + assert(this->precision != ast_precision_none); + assert(this->structure == NULL); /* The check for structures was + * performed above. */ + if (this->is_array) { + _mesa_glsl_error(&loc, state, + "default precision statements do not apply to " + "arrays"); + return NULL; + } + if (this->type_specifier != ast_float + && this->type_specifier != ast_int) { + _mesa_glsl_error(&loc, state, + "default precision statements apply only to types " + "float and int"); + return NULL; + } + + /* FINISHME: Translate precision statements into IR. */ + return NULL; + } + if (this->structure != NULL) return this->structure->hir(instructions, state); diff --git a/src/glsl/ast_type.cpp b/src/glsl/ast_type.cpp index b7488cf6e90..d14077473f0 100644 --- a/src/glsl/ast_type.cpp +++ b/src/glsl/ast_type.cpp @@ -49,7 +49,8 @@ ast_type_specifier::print(void) const ast_type_specifier::ast_type_specifier(int specifier) : type_specifier(ast_types(specifier)), type_name(NULL), structure(NULL), - is_array(false), array_size(NULL), precision(ast_precision_high) + is_array(false), array_size(NULL), precision(ast_precision_none), + is_precision_statement(false) { static const char *const names[] = { "void", @@ -116,3 +117,23 @@ ast_fully_specified_type::has_qualifiers() const { return this->qualifier.flags.i != 0; } + +bool ast_type_qualifier::has_interpolation() const +{ + return this->flags.q.smooth + || this->flags.q.flat + || this->flags.q.noperspective; +} + +const char* +ast_type_qualifier::interpolation_string() const +{ + if (this->flags.q.smooth) + return "smooth"; + else if (this->flags.q.flat) + return "flat"; + else if (this->flags.q.noperspective) + return "noperspective"; + else + return NULL; +} diff --git a/src/glsl/glsl_parser.cpp b/src/glsl/glsl_parser.cpp index 2190458e47d..8b196ae7fc6 100644 --- a/src/glsl/glsl_parser.cpp +++ b/src/glsl/glsl_parser.cpp @@ -1,10 +1,9 @@ - -/* A Bison parser, made by GNU Bison 2.4.1. */ +/* A Bison parser, made by GNU Bison 2.4.3. */ /* Skeleton implementation for Bison's Yacc-like parsers in C - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 - Free Software Foundation, Inc. + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -46,7 +45,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.4.1" +#define YYBISON_VERSION "2.4.3" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -114,7 +113,7 @@ /* Line 189 of yacc.c */ -#line 118 "glsl_parser.cpp" +#line 117 "glsl_parser.cpp" /* Enabling traces. */ #ifndef YYDEBUG @@ -375,7 +374,7 @@ typedef union YYSTYPE /* Line 214 of yacc.c */ -#line 379 "glsl_parser.cpp" +#line 378 "glsl_parser.cpp" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ @@ -400,7 +399,7 @@ typedef struct YYLTYPE /* Line 264 of yacc.c */ -#line 404 "glsl_parser.cpp" +#line 403 "glsl_parser.cpp" #ifdef short # undef short @@ -450,7 +449,7 @@ typedef short int yytype_int16; #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) #ifndef YY_ -# if YYENABLE_NLS +# if defined YYENABLE_NLS && YYENABLE_NLS # if ENABLE_NLS # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ # define YY_(msgid) dgettext ("bison-runtime", msgid) @@ -818,24 +817,24 @@ static const yytype_uint16 yyrline[] = 578, 587, 588, 597, 598, 607, 608, 617, 618, 627, 628, 637, 638, 647, 648, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667, 671, 675, 691, 695, - 699, 703, 717, 721, 722, 726, 731, 739, 750, 760, - 775, 782, 787, 798, 811, 814, 819, 824, 833, 837, - 838, 847, 856, 865, 874, 883, 896, 907, 916, 925, - 934, 943, 952, 961, 975, 982, 993, 1000, 1001, 1020, - 1049, 1090, 1095, 1100, 1108, 1116, 1117, 1118, 1123, 1124, - 1129, 1134, 1140, 1148, 1153, 1158, 1163, 1169, 1174, 1179, - 1184, 1189, 1197, 1198, 1206, 1207, 1213, 1222, 1228, 1234, - 1243, 1244, 1245, 1246, 1247, 1248, 1249, 1250, 1251, 1252, - 1253, 1254, 1255, 1256, 1257, 1258, 1259, 1260, 1261, 1262, - 1263, 1264, 1265, 1266, 1267, 1268, 1269, 1270, 1271, 1272, - 1273, 1274, 1275, 1276, 1277, 1278, 1279, 1280, 1281, 1282, - 1283, 1284, 1285, 1286, 1287, 1288, 1289, 1290, 1291, 1292, - 1293, 1297, 1307, 1317, 1330, 1336, 1345, 1350, 1358, 1373, - 1378, 1386, 1392, 1401, 1405, 1411, 1412, 1416, 1417, 1418, - 1419, 1420, 1421, 1422, 1426, 1432, 1441, 1442, 1446, 1452, - 1461, 1471, 1483, 1489, 1498, 1507, 1512, 1520, 1524, 1538, - 1542, 1543, 1547, 1554, 1561, 1571, 1572, 1576, 1578, 1584, - 1589, 1598, 1604, 1610, 1616, 1622, 1631, 1632, 1633, 1637 + 699, 703, 712, 716, 717, 721, 726, 734, 745, 755, + 770, 777, 782, 793, 806, 809, 814, 819, 828, 832, + 833, 842, 851, 860, 869, 878, 891, 902, 911, 920, + 929, 938, 947, 956, 970, 977, 988, 995, 996, 1015, + 1044, 1085, 1090, 1095, 1103, 1111, 1112, 1113, 1118, 1119, + 1124, 1129, 1135, 1143, 1148, 1153, 1158, 1164, 1169, 1174, + 1179, 1184, 1192, 1196, 1204, 1205, 1211, 1220, 1226, 1232, + 1241, 1242, 1243, 1244, 1245, 1246, 1247, 1248, 1249, 1250, + 1251, 1252, 1253, 1254, 1255, 1256, 1257, 1258, 1259, 1260, + 1261, 1262, 1263, 1264, 1265, 1266, 1267, 1268, 1269, 1270, + 1271, 1272, 1273, 1274, 1275, 1276, 1277, 1278, 1279, 1280, + 1281, 1282, 1283, 1284, 1285, 1286, 1287, 1288, 1289, 1290, + 1291, 1295, 1305, 1315, 1328, 1334, 1343, 1348, 1356, 1371, + 1376, 1384, 1390, 1399, 1403, 1409, 1410, 1414, 1415, 1416, + 1417, 1418, 1419, 1420, 1424, 1430, 1439, 1440, 1444, 1450, + 1459, 1469, 1481, 1487, 1496, 1505, 1510, 1518, 1522, 1536, + 1540, 1541, 1545, 1552, 1559, 1569, 1570, 1574, 1576, 1582, + 1587, 1596, 1602, 1608, 1614, 1620, 1629, 1630, 1631, 1635 }; #endif @@ -1961,9 +1960,18 @@ static const yytype_uint16 yystos[] = /* Like YYERROR except do call yyerror. This remains here temporarily to ease the transition to the new meaning of YYERROR, for GCC. - Once GCC version 2 has supplanted version 1, this can go. */ + Once GCC version 2 has supplanted version 1, this can go. However, + YYFAIL appears to be in use. Nevertheless, it is formally deprecated + in Bison 2.4.2's NEWS entry, where a plan to phase it out is + discussed. */ #define YYFAIL goto yyerrlab +#if defined YYFAIL + /* This is here to suppress warnings from the GCC cpp's + -Wunused-macros. Normally we don't worry about that warning, but + some users do, and we want to make it easy for users to remove + YYFAIL uses, which will produce warnings from Bison 2.5. */ +#endif #define YYRECOVERING() (!!yyerrstatus) @@ -2020,7 +2028,7 @@ while (YYID (0)) we won't break user code: when these are the locations we know. */ #ifndef YY_LOCATION_PRINT -# if YYLTYPE_IS_TRIVIAL +# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL # define YY_LOCATION_PRINT(File, Loc) \ fprintf (File, "%d.%d-%d.%d", \ (Loc).first_line, (Loc).first_column, \ @@ -2562,7 +2570,7 @@ YYLTYPE yylloc; YYLTYPE *yylsp; /* The locations where the error started and ended. */ - YYLTYPE yyerror_range[2]; + YYLTYPE yyerror_range[3]; YYSIZE_T yystacksize; @@ -2609,7 +2617,7 @@ YYLTYPE yylloc; yyvsp = yyvs; yylsp = yyls; -#if YYLTYPE_IS_TRIVIAL +#if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL /* Initialize the default location before parsing starts. */ yylloc.first_line = yylloc.last_line = 1; yylloc.first_column = yylloc.last_column = 1; @@ -2617,7 +2625,7 @@ YYLTYPE yylloc; /* User initialization code. */ -/* Line 1242 of yacc.c */ +/* Line 1251 of yacc.c */ #line 41 "glsl_parser.ypp" { yylloc.first_line = 1; @@ -2627,8 +2635,8 @@ YYLTYPE yylloc; yylloc.source = 0; } -/* Line 1242 of yacc.c */ -#line 2632 "glsl_parser.cpp" +/* Line 1251 of yacc.c */ +#line 2640 "glsl_parser.cpp" yylsp[0] = yylloc; goto yysetstate; @@ -2815,7 +2823,7 @@ yyreduce: { case 2: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 213 "glsl_parser.ypp" { _mesa_glsl_initialize_types(state); @@ -2824,7 +2832,7 @@ yyreduce: case 5: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 222 "glsl_parser.ypp" { switch ((yyvsp[(2) - (3)].n)) { @@ -2851,7 +2859,7 @@ yyreduce: case 10: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 251 "glsl_parser.ypp" { if (state->language_version < 120) { @@ -2866,7 +2874,7 @@ yyreduce: case 13: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 269 "glsl_parser.ypp" { if (!_mesa_glsl_process_extension((yyvsp[(2) - (5)].identifier), & (yylsp[(2) - (5)]), (yyvsp[(4) - (5)].identifier), & (yylsp[(4) - (5)]), state)) { @@ -2877,11 +2885,11 @@ yyreduce: case 14: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 278 "glsl_parser.ypp" { - /* FINISHME: The NULL test is only required because 'precision' - * FINISHME: statements are not yet supported. + /* FINISHME: The NULL test is required because pragmas are set to + * FINISHME: NULL. (See production rule for external_declaration.) */ if ((yyvsp[(1) - (1)].node) != NULL) state->translation_unit.push_tail(& (yyvsp[(1) - (1)].node)->link); @@ -2890,11 +2898,11 @@ yyreduce: case 15: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 286 "glsl_parser.ypp" { - /* FINISHME: The NULL test is only required because 'precision' - * FINISHME: statements are not yet supported. + /* FINISHME: The NULL test is required because pragmas are set to + * FINISHME: NULL. (See production rule for external_declaration.) */ if ((yyvsp[(2) - (2)].node) != NULL) state->translation_unit.push_tail(& (yyvsp[(2) - (2)].node)->link); @@ -2903,7 +2911,7 @@ yyreduce: case 17: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 301 "glsl_parser.ypp" { void *ctx = state; @@ -2915,7 +2923,7 @@ yyreduce: case 18: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 308 "glsl_parser.ypp" { void *ctx = state; @@ -2927,7 +2935,7 @@ yyreduce: case 19: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 315 "glsl_parser.ypp" { void *ctx = state; @@ -2939,7 +2947,7 @@ yyreduce: case 20: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 322 "glsl_parser.ypp" { void *ctx = state; @@ -2951,7 +2959,7 @@ yyreduce: case 21: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 329 "glsl_parser.ypp" { void *ctx = state; @@ -2963,7 +2971,7 @@ yyreduce: case 22: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 336 "glsl_parser.ypp" { (yyval.expression) = (yyvsp[(2) - (3)].expression); @@ -2972,7 +2980,7 @@ yyreduce: case 24: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 344 "glsl_parser.ypp" { void *ctx = state; @@ -2983,7 +2991,7 @@ yyreduce: case 25: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 350 "glsl_parser.ypp" { (yyval.expression) = (yyvsp[(1) - (1)].expression); @@ -2992,7 +3000,7 @@ yyreduce: case 26: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 354 "glsl_parser.ypp" { void *ctx = state; @@ -3004,7 +3012,7 @@ yyreduce: case 27: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 361 "glsl_parser.ypp" { void *ctx = state; @@ -3015,7 +3023,7 @@ yyreduce: case 28: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 367 "glsl_parser.ypp" { void *ctx = state; @@ -3026,7 +3034,7 @@ yyreduce: case 32: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 385 "glsl_parser.ypp" { void *ctx = state; @@ -3037,7 +3045,7 @@ yyreduce: case 37: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 404 "glsl_parser.ypp" { (yyval.expression) = (yyvsp[(1) - (2)].expression); @@ -3048,7 +3056,7 @@ yyreduce: case 38: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 410 "glsl_parser.ypp" { (yyval.expression) = (yyvsp[(1) - (3)].expression); @@ -3059,7 +3067,7 @@ yyreduce: case 40: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 426 "glsl_parser.ypp" { void *ctx = state; @@ -3070,7 +3078,7 @@ yyreduce: case 41: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 432 "glsl_parser.ypp" { void *ctx = state; @@ -3082,7 +3090,7 @@ yyreduce: case 42: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 439 "glsl_parser.ypp" { void *ctx = state; @@ -3094,7 +3102,7 @@ yyreduce: case 44: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 451 "glsl_parser.ypp" { void *ctx = state; @@ -3105,7 +3113,7 @@ yyreduce: case 45: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 457 "glsl_parser.ypp" { void *ctx = state; @@ -3116,7 +3124,7 @@ yyreduce: case 46: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 463 "glsl_parser.ypp" { void *ctx = state; @@ -3127,35 +3135,35 @@ yyreduce: case 47: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 472 "glsl_parser.ypp" { (yyval.n) = ast_plus; ;} break; case 48: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 473 "glsl_parser.ypp" { (yyval.n) = ast_neg; ;} break; case 49: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 474 "glsl_parser.ypp" { (yyval.n) = ast_logic_not; ;} break; case 50: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 475 "glsl_parser.ypp" { (yyval.n) = ast_bit_not; ;} break; case 52: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 481 "glsl_parser.ypp" { void *ctx = state; @@ -3166,7 +3174,7 @@ yyreduce: case 53: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 487 "glsl_parser.ypp" { void *ctx = state; @@ -3177,7 +3185,7 @@ yyreduce: case 54: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 493 "glsl_parser.ypp" { void *ctx = state; @@ -3188,7 +3196,7 @@ yyreduce: case 56: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 503 "glsl_parser.ypp" { void *ctx = state; @@ -3199,7 +3207,7 @@ yyreduce: case 57: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 509 "glsl_parser.ypp" { void *ctx = state; @@ -3210,7 +3218,7 @@ yyreduce: case 59: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 519 "glsl_parser.ypp" { void *ctx = state; @@ -3221,7 +3229,7 @@ yyreduce: case 60: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 525 "glsl_parser.ypp" { void *ctx = state; @@ -3232,7 +3240,7 @@ yyreduce: case 62: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 535 "glsl_parser.ypp" { void *ctx = state; @@ -3243,7 +3251,7 @@ yyreduce: case 63: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 541 "glsl_parser.ypp" { void *ctx = state; @@ -3254,7 +3262,7 @@ yyreduce: case 64: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 547 "glsl_parser.ypp" { void *ctx = state; @@ -3265,7 +3273,7 @@ yyreduce: case 65: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 553 "glsl_parser.ypp" { void *ctx = state; @@ -3276,7 +3284,7 @@ yyreduce: case 67: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 563 "glsl_parser.ypp" { void *ctx = state; @@ -3287,7 +3295,7 @@ yyreduce: case 68: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 569 "glsl_parser.ypp" { void *ctx = state; @@ -3298,7 +3306,7 @@ yyreduce: case 70: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 579 "glsl_parser.ypp" { void *ctx = state; @@ -3309,7 +3317,7 @@ yyreduce: case 72: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 589 "glsl_parser.ypp" { void *ctx = state; @@ -3320,7 +3328,7 @@ yyreduce: case 74: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 599 "glsl_parser.ypp" { void *ctx = state; @@ -3331,7 +3339,7 @@ yyreduce: case 76: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 609 "glsl_parser.ypp" { void *ctx = state; @@ -3342,7 +3350,7 @@ yyreduce: case 78: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 619 "glsl_parser.ypp" { void *ctx = state; @@ -3353,7 +3361,7 @@ yyreduce: case 80: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 629 "glsl_parser.ypp" { void *ctx = state; @@ -3364,7 +3372,7 @@ yyreduce: case 82: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 639 "glsl_parser.ypp" { void *ctx = state; @@ -3375,7 +3383,7 @@ yyreduce: case 84: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 649 "glsl_parser.ypp" { void *ctx = state; @@ -3386,84 +3394,84 @@ yyreduce: case 85: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 657 "glsl_parser.ypp" { (yyval.n) = ast_assign; ;} break; case 86: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 658 "glsl_parser.ypp" { (yyval.n) = ast_mul_assign; ;} break; case 87: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 659 "glsl_parser.ypp" { (yyval.n) = ast_div_assign; ;} break; case 88: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 660 "glsl_parser.ypp" { (yyval.n) = ast_mod_assign; ;} break; case 89: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 661 "glsl_parser.ypp" { (yyval.n) = ast_add_assign; ;} break; case 90: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 662 "glsl_parser.ypp" { (yyval.n) = ast_sub_assign; ;} break; case 91: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 663 "glsl_parser.ypp" { (yyval.n) = ast_ls_assign; ;} break; case 92: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 664 "glsl_parser.ypp" { (yyval.n) = ast_rs_assign; ;} break; case 93: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 665 "glsl_parser.ypp" { (yyval.n) = ast_and_assign; ;} break; case 94: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 666 "glsl_parser.ypp" { (yyval.n) = ast_xor_assign; ;} break; case 95: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 667 "glsl_parser.ypp" { (yyval.n) = ast_or_assign; ;} break; case 96: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 672 "glsl_parser.ypp" { (yyval.expression) = (yyvsp[(1) - (1)].expression); @@ -3472,7 +3480,7 @@ yyreduce: case 97: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 676 "glsl_parser.ypp" { void *ctx = state; @@ -3490,7 +3498,7 @@ yyreduce: case 99: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 696 "glsl_parser.ypp" { (yyval.node) = (yyvsp[(1) - (2)].function); @@ -3499,7 +3507,7 @@ yyreduce: case 100: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 700 "glsl_parser.ypp" { (yyval.node) = (yyvsp[(1) - (2)].declarator_list); @@ -3508,24 +3516,19 @@ yyreduce: case 101: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 704 "glsl_parser.ypp" { - if (((yyvsp[(3) - (4)].type_specifier)->type_specifier != ast_float) - && ((yyvsp[(3) - (4)].type_specifier)->type_specifier != ast_int)) { - _mesa_glsl_error(& (yylsp[(3) - (4)]), state, "global precision qualifier can " - "only be applied to `int' or `float'\n"); - YYERROR; - } - - (yyval.node) = NULL; /* FINISHME */ + (yyvsp[(3) - (4)].type_specifier)->precision = (yyvsp[(2) - (4)].n); + (yyvsp[(3) - (4)].type_specifier)->is_precision_statement = true; + (yyval.node) = (yyvsp[(3) - (4)].type_specifier); ;} break; case 105: -/* Line 1455 of yacc.c */ -#line 727 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 722 "glsl_parser.ypp" { (yyval.function) = (yyvsp[(1) - (2)].function); (yyval.function)->parameters.push_tail(& (yyvsp[(2) - (2)].parameter_declarator)->link); @@ -3534,8 +3537,8 @@ yyreduce: case 106: -/* Line 1455 of yacc.c */ -#line 732 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 727 "glsl_parser.ypp" { (yyval.function) = (yyvsp[(1) - (3)].function); (yyval.function)->parameters.push_tail(& (yyvsp[(3) - (3)].parameter_declarator)->link); @@ -3544,8 +3547,8 @@ yyreduce: case 107: -/* Line 1455 of yacc.c */ -#line 740 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 735 "glsl_parser.ypp" { void *ctx = state; (yyval.function) = new(ctx) ast_function(); @@ -3557,8 +3560,8 @@ yyreduce: case 108: -/* Line 1455 of yacc.c */ -#line 751 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 746 "glsl_parser.ypp" { void *ctx = state; (yyval.parameter_declarator) = new(ctx) ast_parameter_declarator(); @@ -3572,8 +3575,8 @@ yyreduce: case 109: -/* Line 1455 of yacc.c */ -#line 761 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 756 "glsl_parser.ypp" { void *ctx = state; (yyval.parameter_declarator) = new(ctx) ast_parameter_declarator(); @@ -3589,8 +3592,8 @@ yyreduce: case 110: -/* Line 1455 of yacc.c */ -#line 776 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 771 "glsl_parser.ypp" { (yyvsp[(1) - (3)].type_qualifier).flags.i |= (yyvsp[(2) - (3)].type_qualifier).flags.i; @@ -3601,8 +3604,8 @@ yyreduce: case 111: -/* Line 1455 of yacc.c */ -#line 783 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 778 "glsl_parser.ypp" { (yyval.parameter_declarator) = (yyvsp[(2) - (2)].parameter_declarator); (yyval.parameter_declarator)->type->qualifier = (yyvsp[(1) - (2)].type_qualifier); @@ -3611,8 +3614,8 @@ yyreduce: case 112: -/* Line 1455 of yacc.c */ -#line 788 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 783 "glsl_parser.ypp" { void *ctx = state; (yyvsp[(1) - (3)].type_qualifier).flags.i |= (yyvsp[(2) - (3)].type_qualifier).flags.i; @@ -3627,8 +3630,8 @@ yyreduce: case 113: -/* Line 1455 of yacc.c */ -#line 799 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 794 "glsl_parser.ypp" { void *ctx = state; (yyval.parameter_declarator) = new(ctx) ast_parameter_declarator(); @@ -3641,8 +3644,8 @@ yyreduce: case 114: -/* Line 1455 of yacc.c */ -#line 811 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 806 "glsl_parser.ypp" { memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier))); ;} @@ -3650,8 +3653,8 @@ yyreduce: case 115: -/* Line 1455 of yacc.c */ -#line 815 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 810 "glsl_parser.ypp" { memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier))); (yyval.type_qualifier).flags.q.in = 1; @@ -3660,8 +3663,8 @@ yyreduce: case 116: -/* Line 1455 of yacc.c */ -#line 820 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 815 "glsl_parser.ypp" { memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier))); (yyval.type_qualifier).flags.q.out = 1; @@ -3670,8 +3673,8 @@ yyreduce: case 117: -/* Line 1455 of yacc.c */ -#line 825 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 820 "glsl_parser.ypp" { memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier))); (yyval.type_qualifier).flags.q.in = 1; @@ -3681,8 +3684,8 @@ yyreduce: case 120: -/* Line 1455 of yacc.c */ -#line 839 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 834 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(3) - (3)].identifier), false, NULL, NULL); @@ -3695,8 +3698,8 @@ yyreduce: case 121: -/* Line 1455 of yacc.c */ -#line 848 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 843 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(3) - (5)].identifier), true, NULL, NULL); @@ -3709,8 +3712,8 @@ yyreduce: case 122: -/* Line 1455 of yacc.c */ -#line 857 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 852 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(3) - (6)].identifier), true, (yyvsp[(5) - (6)].expression), NULL); @@ -3723,8 +3726,8 @@ yyreduce: case 123: -/* Line 1455 of yacc.c */ -#line 866 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 861 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(3) - (7)].identifier), true, NULL, (yyvsp[(7) - (7)].expression)); @@ -3737,8 +3740,8 @@ yyreduce: case 124: -/* Line 1455 of yacc.c */ -#line 875 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 870 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(3) - (8)].identifier), true, (yyvsp[(5) - (8)].expression), (yyvsp[(8) - (8)].expression)); @@ -3751,8 +3754,8 @@ yyreduce: case 125: -/* Line 1455 of yacc.c */ -#line 884 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 879 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(3) - (5)].identifier), false, NULL, (yyvsp[(5) - (5)].expression)); @@ -3765,8 +3768,8 @@ yyreduce: case 126: -/* Line 1455 of yacc.c */ -#line 897 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 892 "glsl_parser.ypp" { void *ctx = state; if ((yyvsp[(1) - (1)].fully_specified_type)->specifier->type_specifier != ast_struct) { @@ -3781,8 +3784,8 @@ yyreduce: case 127: -/* Line 1455 of yacc.c */ -#line 908 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 903 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (2)].identifier), false, NULL, NULL); @@ -3795,8 +3798,8 @@ yyreduce: case 128: -/* Line 1455 of yacc.c */ -#line 917 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 912 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (4)].identifier), true, NULL, NULL); @@ -3809,8 +3812,8 @@ yyreduce: case 129: -/* Line 1455 of yacc.c */ -#line 926 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 921 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (5)].identifier), true, (yyvsp[(4) - (5)].expression), NULL); @@ -3823,8 +3826,8 @@ yyreduce: case 130: -/* Line 1455 of yacc.c */ -#line 935 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 930 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (6)].identifier), true, NULL, (yyvsp[(6) - (6)].expression)); @@ -3837,8 +3840,8 @@ yyreduce: case 131: -/* Line 1455 of yacc.c */ -#line 944 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 939 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (7)].identifier), true, (yyvsp[(4) - (7)].expression), (yyvsp[(7) - (7)].expression)); @@ -3851,8 +3854,8 @@ yyreduce: case 132: -/* Line 1455 of yacc.c */ -#line 953 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 948 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (4)].identifier), false, NULL, (yyvsp[(4) - (4)].expression)); @@ -3865,8 +3868,8 @@ yyreduce: case 133: -/* Line 1455 of yacc.c */ -#line 962 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 957 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (2)].identifier), false, NULL, NULL); @@ -3881,8 +3884,8 @@ yyreduce: case 134: -/* Line 1455 of yacc.c */ -#line 976 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 971 "glsl_parser.ypp" { void *ctx = state; (yyval.fully_specified_type) = new(ctx) ast_fully_specified_type(); @@ -3893,8 +3896,8 @@ yyreduce: case 135: -/* Line 1455 of yacc.c */ -#line 983 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 978 "glsl_parser.ypp" { void *ctx = state; (yyval.fully_specified_type) = new(ctx) ast_fully_specified_type(); @@ -3906,8 +3909,8 @@ yyreduce: case 136: -/* Line 1455 of yacc.c */ -#line 994 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 989 "glsl_parser.ypp" { (yyval.type_qualifier) = (yyvsp[(3) - (4)].type_qualifier); ;} @@ -3915,8 +3918,8 @@ yyreduce: case 138: -/* Line 1455 of yacc.c */ -#line 1002 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 997 "glsl_parser.ypp" { if (((yyvsp[(1) - (3)].type_qualifier).flags.i & (yyvsp[(3) - (3)].type_qualifier).flags.i) != 0) { _mesa_glsl_error(& (yylsp[(3) - (3)]), state, @@ -3936,8 +3939,8 @@ yyreduce: case 139: -/* Line 1455 of yacc.c */ -#line 1021 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1016 "glsl_parser.ypp" { bool got_one = false; @@ -3970,8 +3973,8 @@ yyreduce: case 140: -/* Line 1455 of yacc.c */ -#line 1050 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1045 "glsl_parser.ypp" { bool got_one = false; @@ -4013,8 +4016,8 @@ yyreduce: case 141: -/* Line 1455 of yacc.c */ -#line 1091 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1086 "glsl_parser.ypp" { memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier))); (yyval.type_qualifier).flags.q.smooth = 1; @@ -4023,8 +4026,8 @@ yyreduce: case 142: -/* Line 1455 of yacc.c */ -#line 1096 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1091 "glsl_parser.ypp" { memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier))); (yyval.type_qualifier).flags.q.flat = 1; @@ -4033,8 +4036,8 @@ yyreduce: case 143: -/* Line 1455 of yacc.c */ -#line 1101 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1096 "glsl_parser.ypp" { memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier))); (yyval.type_qualifier).flags.q.noperspective = 1; @@ -4043,8 +4046,8 @@ yyreduce: case 144: -/* Line 1455 of yacc.c */ -#line 1109 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1104 "glsl_parser.ypp" { memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier))); (yyval.type_qualifier).flags.q.constant = 1; @@ -4053,8 +4056,8 @@ yyreduce: case 147: -/* Line 1455 of yacc.c */ -#line 1119 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1114 "glsl_parser.ypp" { (yyval.type_qualifier) = (yyvsp[(1) - (2)].type_qualifier); (yyval.type_qualifier).flags.i |= (yyvsp[(2) - (2)].type_qualifier).flags.i; @@ -4063,8 +4066,8 @@ yyreduce: case 149: -/* Line 1455 of yacc.c */ -#line 1125 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1120 "glsl_parser.ypp" { (yyval.type_qualifier) = (yyvsp[(1) - (2)].type_qualifier); (yyval.type_qualifier).flags.i |= (yyvsp[(2) - (2)].type_qualifier).flags.i; @@ -4073,8 +4076,8 @@ yyreduce: case 150: -/* Line 1455 of yacc.c */ -#line 1130 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1125 "glsl_parser.ypp" { (yyval.type_qualifier) = (yyvsp[(2) - (2)].type_qualifier); (yyval.type_qualifier).flags.q.invariant = 1; @@ -4083,8 +4086,8 @@ yyreduce: case 151: -/* Line 1455 of yacc.c */ -#line 1135 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1130 "glsl_parser.ypp" { (yyval.type_qualifier) = (yyvsp[(2) - (3)].type_qualifier); (yyval.type_qualifier).flags.i |= (yyvsp[(3) - (3)].type_qualifier).flags.i; @@ -4094,8 +4097,8 @@ yyreduce: case 152: -/* Line 1455 of yacc.c */ -#line 1141 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1136 "glsl_parser.ypp" { memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier))); (yyval.type_qualifier).flags.q.invariant = 1; @@ -4104,8 +4107,8 @@ yyreduce: case 153: -/* Line 1455 of yacc.c */ -#line 1149 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1144 "glsl_parser.ypp" { memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier))); (yyval.type_qualifier).flags.q.constant = 1; @@ -4114,8 +4117,8 @@ yyreduce: case 154: -/* Line 1455 of yacc.c */ -#line 1154 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1149 "glsl_parser.ypp" { memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier))); (yyval.type_qualifier).flags.q.attribute = 1; @@ -4124,8 +4127,8 @@ yyreduce: case 155: -/* Line 1455 of yacc.c */ -#line 1159 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1154 "glsl_parser.ypp" { memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier))); (yyval.type_qualifier).flags.q.varying = 1; @@ -4134,8 +4137,8 @@ yyreduce: case 156: -/* Line 1455 of yacc.c */ -#line 1164 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1159 "glsl_parser.ypp" { memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier))); (yyval.type_qualifier).flags.q.centroid = 1; @@ -4145,8 +4148,8 @@ yyreduce: case 157: -/* Line 1455 of yacc.c */ -#line 1170 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1165 "glsl_parser.ypp" { memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier))); (yyval.type_qualifier).flags.q.in = 1; @@ -4155,8 +4158,8 @@ yyreduce: case 158: -/* Line 1455 of yacc.c */ -#line 1175 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1170 "glsl_parser.ypp" { memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier))); (yyval.type_qualifier).flags.q.out = 1; @@ -4165,8 +4168,8 @@ yyreduce: case 159: -/* Line 1455 of yacc.c */ -#line 1180 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1175 "glsl_parser.ypp" { memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier))); (yyval.type_qualifier).flags.q.centroid = 1; (yyval.type_qualifier).flags.q.in = 1; @@ -4175,8 +4178,8 @@ yyreduce: case 160: -/* Line 1455 of yacc.c */ -#line 1185 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1180 "glsl_parser.ypp" { memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier))); (yyval.type_qualifier).flags.q.centroid = 1; (yyval.type_qualifier).flags.q.out = 1; @@ -4185,18 +4188,27 @@ yyreduce: case 161: -/* Line 1455 of yacc.c */ -#line 1190 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1185 "glsl_parser.ypp" { memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier))); (yyval.type_qualifier).flags.q.uniform = 1; ;} break; + case 162: + +/* Line 1464 of yacc.c */ +#line 1193 "glsl_parser.ypp" + { + (yyval.type_specifier) = (yyvsp[(1) - (1)].type_specifier); + ;} + break; + case 163: -/* Line 1455 of yacc.c */ -#line 1199 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1197 "glsl_parser.ypp" { (yyval.type_specifier) = (yyvsp[(2) - (2)].type_specifier); (yyval.type_specifier)->precision = (yyvsp[(1) - (2)].n); @@ -4205,8 +4217,8 @@ yyreduce: case 165: -/* Line 1455 of yacc.c */ -#line 1208 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1206 "glsl_parser.ypp" { (yyval.type_specifier) = (yyvsp[(1) - (3)].type_specifier); (yyval.type_specifier)->is_array = true; @@ -4216,8 +4228,8 @@ yyreduce: case 166: -/* Line 1455 of yacc.c */ -#line 1214 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1212 "glsl_parser.ypp" { (yyval.type_specifier) = (yyvsp[(1) - (4)].type_specifier); (yyval.type_specifier)->is_array = true; @@ -4227,8 +4239,8 @@ yyreduce: case 167: -/* Line 1455 of yacc.c */ -#line 1223 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1221 "glsl_parser.ypp" { void *ctx = state; (yyval.type_specifier) = new(ctx) ast_type_specifier((yyvsp[(1) - (1)].n)); @@ -4238,8 +4250,8 @@ yyreduce: case 168: -/* Line 1455 of yacc.c */ -#line 1229 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1227 "glsl_parser.ypp" { void *ctx = state; (yyval.type_specifier) = new(ctx) ast_type_specifier((yyvsp[(1) - (1)].struct_specifier)); @@ -4249,8 +4261,8 @@ yyreduce: case 169: -/* Line 1455 of yacc.c */ -#line 1235 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1233 "glsl_parser.ypp" { void *ctx = state; (yyval.type_specifier) = new(ctx) ast_type_specifier((yyvsp[(1) - (1)].identifier)); @@ -4260,365 +4272,365 @@ yyreduce: case 170: -/* Line 1455 of yacc.c */ -#line 1243 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1241 "glsl_parser.ypp" { (yyval.n) = ast_void; ;} break; case 171: -/* Line 1455 of yacc.c */ -#line 1244 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1242 "glsl_parser.ypp" { (yyval.n) = ast_float; ;} break; case 172: -/* Line 1455 of yacc.c */ -#line 1245 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1243 "glsl_parser.ypp" { (yyval.n) = ast_int; ;} break; case 173: -/* Line 1455 of yacc.c */ -#line 1246 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1244 "glsl_parser.ypp" { (yyval.n) = ast_uint; ;} break; case 174: -/* Line 1455 of yacc.c */ -#line 1247 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1245 "glsl_parser.ypp" { (yyval.n) = ast_bool; ;} break; case 175: -/* Line 1455 of yacc.c */ -#line 1248 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1246 "glsl_parser.ypp" { (yyval.n) = ast_vec2; ;} break; case 176: -/* Line 1455 of yacc.c */ -#line 1249 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1247 "glsl_parser.ypp" { (yyval.n) = ast_vec3; ;} break; case 177: -/* Line 1455 of yacc.c */ -#line 1250 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1248 "glsl_parser.ypp" { (yyval.n) = ast_vec4; ;} break; case 178: -/* Line 1455 of yacc.c */ -#line 1251 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1249 "glsl_parser.ypp" { (yyval.n) = ast_bvec2; ;} break; case 179: -/* Line 1455 of yacc.c */ -#line 1252 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1250 "glsl_parser.ypp" { (yyval.n) = ast_bvec3; ;} break; case 180: -/* Line 1455 of yacc.c */ -#line 1253 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1251 "glsl_parser.ypp" { (yyval.n) = ast_bvec4; ;} break; case 181: -/* Line 1455 of yacc.c */ -#line 1254 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1252 "glsl_parser.ypp" { (yyval.n) = ast_ivec2; ;} break; case 182: -/* Line 1455 of yacc.c */ -#line 1255 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1253 "glsl_parser.ypp" { (yyval.n) = ast_ivec3; ;} break; case 183: -/* Line 1455 of yacc.c */ -#line 1256 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1254 "glsl_parser.ypp" { (yyval.n) = ast_ivec4; ;} break; case 184: -/* Line 1455 of yacc.c */ -#line 1257 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1255 "glsl_parser.ypp" { (yyval.n) = ast_uvec2; ;} break; case 185: -/* Line 1455 of yacc.c */ -#line 1258 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1256 "glsl_parser.ypp" { (yyval.n) = ast_uvec3; ;} break; case 186: -/* Line 1455 of yacc.c */ -#line 1259 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1257 "glsl_parser.ypp" { (yyval.n) = ast_uvec4; ;} break; case 187: -/* Line 1455 of yacc.c */ -#line 1260 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1258 "glsl_parser.ypp" { (yyval.n) = ast_mat2; ;} break; case 188: -/* Line 1455 of yacc.c */ -#line 1261 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1259 "glsl_parser.ypp" { (yyval.n) = ast_mat2x3; ;} break; case 189: -/* Line 1455 of yacc.c */ -#line 1262 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1260 "glsl_parser.ypp" { (yyval.n) = ast_mat2x4; ;} break; case 190: -/* Line 1455 of yacc.c */ -#line 1263 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1261 "glsl_parser.ypp" { (yyval.n) = ast_mat3x2; ;} break; case 191: -/* Line 1455 of yacc.c */ -#line 1264 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1262 "glsl_parser.ypp" { (yyval.n) = ast_mat3; ;} break; case 192: -/* Line 1455 of yacc.c */ -#line 1265 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1263 "glsl_parser.ypp" { (yyval.n) = ast_mat3x4; ;} break; case 193: -/* Line 1455 of yacc.c */ -#line 1266 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1264 "glsl_parser.ypp" { (yyval.n) = ast_mat4x2; ;} break; case 194: -/* Line 1455 of yacc.c */ -#line 1267 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1265 "glsl_parser.ypp" { (yyval.n) = ast_mat4x3; ;} break; case 195: -/* Line 1455 of yacc.c */ -#line 1268 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1266 "glsl_parser.ypp" { (yyval.n) = ast_mat4; ;} break; case 196: -/* Line 1455 of yacc.c */ -#line 1269 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1267 "glsl_parser.ypp" { (yyval.n) = ast_sampler1d; ;} break; case 197: -/* Line 1455 of yacc.c */ -#line 1270 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1268 "glsl_parser.ypp" { (yyval.n) = ast_sampler2d; ;} break; case 198: -/* Line 1455 of yacc.c */ -#line 1271 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1269 "glsl_parser.ypp" { (yyval.n) = ast_sampler2drect; ;} break; case 199: -/* Line 1455 of yacc.c */ -#line 1272 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1270 "glsl_parser.ypp" { (yyval.n) = ast_sampler3d; ;} break; case 200: -/* Line 1455 of yacc.c */ -#line 1273 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1271 "glsl_parser.ypp" { (yyval.n) = ast_samplercube; ;} break; case 201: -/* Line 1455 of yacc.c */ -#line 1274 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1272 "glsl_parser.ypp" { (yyval.n) = ast_sampler1dshadow; ;} break; case 202: -/* Line 1455 of yacc.c */ -#line 1275 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1273 "glsl_parser.ypp" { (yyval.n) = ast_sampler2dshadow; ;} break; case 203: -/* Line 1455 of yacc.c */ -#line 1276 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1274 "glsl_parser.ypp" { (yyval.n) = ast_sampler2drectshadow; ;} break; case 204: -/* Line 1455 of yacc.c */ -#line 1277 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1275 "glsl_parser.ypp" { (yyval.n) = ast_samplercubeshadow; ;} break; case 205: -/* Line 1455 of yacc.c */ -#line 1278 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1276 "glsl_parser.ypp" { (yyval.n) = ast_sampler1darray; ;} break; case 206: -/* Line 1455 of yacc.c */ -#line 1279 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1277 "glsl_parser.ypp" { (yyval.n) = ast_sampler2darray; ;} break; case 207: -/* Line 1455 of yacc.c */ -#line 1280 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1278 "glsl_parser.ypp" { (yyval.n) = ast_sampler1darrayshadow; ;} break; case 208: -/* Line 1455 of yacc.c */ -#line 1281 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1279 "glsl_parser.ypp" { (yyval.n) = ast_sampler2darrayshadow; ;} break; case 209: -/* Line 1455 of yacc.c */ -#line 1282 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1280 "glsl_parser.ypp" { (yyval.n) = ast_isampler1d; ;} break; case 210: -/* Line 1455 of yacc.c */ -#line 1283 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1281 "glsl_parser.ypp" { (yyval.n) = ast_isampler2d; ;} break; case 211: -/* Line 1455 of yacc.c */ -#line 1284 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1282 "glsl_parser.ypp" { (yyval.n) = ast_isampler3d; ;} break; case 212: -/* Line 1455 of yacc.c */ -#line 1285 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1283 "glsl_parser.ypp" { (yyval.n) = ast_isamplercube; ;} break; case 213: -/* Line 1455 of yacc.c */ -#line 1286 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1284 "glsl_parser.ypp" { (yyval.n) = ast_isampler1darray; ;} break; case 214: -/* Line 1455 of yacc.c */ -#line 1287 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1285 "glsl_parser.ypp" { (yyval.n) = ast_isampler2darray; ;} break; case 215: -/* Line 1455 of yacc.c */ -#line 1288 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1286 "glsl_parser.ypp" { (yyval.n) = ast_usampler1d; ;} break; case 216: -/* Line 1455 of yacc.c */ -#line 1289 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1287 "glsl_parser.ypp" { (yyval.n) = ast_usampler2d; ;} break; case 217: -/* Line 1455 of yacc.c */ -#line 1290 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1288 "glsl_parser.ypp" { (yyval.n) = ast_usampler3d; ;} break; case 218: -/* Line 1455 of yacc.c */ -#line 1291 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1289 "glsl_parser.ypp" { (yyval.n) = ast_usamplercube; ;} break; case 219: -/* Line 1455 of yacc.c */ -#line 1292 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1290 "glsl_parser.ypp" { (yyval.n) = ast_usampler1darray; ;} break; case 220: -/* Line 1455 of yacc.c */ -#line 1293 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1291 "glsl_parser.ypp" { (yyval.n) = ast_usampler2darray; ;} break; case 221: -/* Line 1455 of yacc.c */ -#line 1297 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1295 "glsl_parser.ypp" { if (!state->es_shader && state->language_version < 130) _mesa_glsl_error(& (yylsp[(1) - (1)]), state, @@ -4633,8 +4645,8 @@ yyreduce: case 222: -/* Line 1455 of yacc.c */ -#line 1307 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1305 "glsl_parser.ypp" { if (!state->es_shader && state->language_version < 130) _mesa_glsl_error(& (yylsp[(1) - (1)]), state, @@ -4649,8 +4661,8 @@ yyreduce: case 223: -/* Line 1455 of yacc.c */ -#line 1317 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1315 "glsl_parser.ypp" { if (!state->es_shader && state->language_version < 130) _mesa_glsl_error(& (yylsp[(1) - (1)]), state, @@ -4665,8 +4677,8 @@ yyreduce: case 224: -/* Line 1455 of yacc.c */ -#line 1331 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1329 "glsl_parser.ypp" { void *ctx = state; (yyval.struct_specifier) = new(ctx) ast_struct_specifier((yyvsp[(2) - (5)].identifier), (yyvsp[(4) - (5)].node)); @@ -4676,8 +4688,8 @@ yyreduce: case 225: -/* Line 1455 of yacc.c */ -#line 1337 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1335 "glsl_parser.ypp" { void *ctx = state; (yyval.struct_specifier) = new(ctx) ast_struct_specifier(NULL, (yyvsp[(3) - (4)].node)); @@ -4687,8 +4699,8 @@ yyreduce: case 226: -/* Line 1455 of yacc.c */ -#line 1346 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1344 "glsl_parser.ypp" { (yyval.node) = (ast_node *) (yyvsp[(1) - (1)].declarator_list); (yyvsp[(1) - (1)].declarator_list)->link.self_link(); @@ -4697,8 +4709,8 @@ yyreduce: case 227: -/* Line 1455 of yacc.c */ -#line 1351 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1349 "glsl_parser.ypp" { (yyval.node) = (ast_node *) (yyvsp[(1) - (2)].node); (yyval.node)->link.insert_before(& (yyvsp[(2) - (2)].declarator_list)->link); @@ -4707,8 +4719,8 @@ yyreduce: case 228: -/* Line 1455 of yacc.c */ -#line 1359 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1357 "glsl_parser.ypp" { void *ctx = state; ast_fully_specified_type *type = new(ctx) ast_fully_specified_type(); @@ -4724,8 +4736,8 @@ yyreduce: case 229: -/* Line 1455 of yacc.c */ -#line 1374 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1372 "glsl_parser.ypp" { (yyval.declaration) = (yyvsp[(1) - (1)].declaration); (yyvsp[(1) - (1)].declaration)->link.self_link(); @@ -4734,8 +4746,8 @@ yyreduce: case 230: -/* Line 1455 of yacc.c */ -#line 1379 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1377 "glsl_parser.ypp" { (yyval.declaration) = (yyvsp[(1) - (3)].declaration); (yyval.declaration)->link.insert_before(& (yyvsp[(3) - (3)].declaration)->link); @@ -4744,8 +4756,8 @@ yyreduce: case 231: -/* Line 1455 of yacc.c */ -#line 1387 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1385 "glsl_parser.ypp" { void *ctx = state; (yyval.declaration) = new(ctx) ast_declaration((yyvsp[(1) - (1)].identifier), false, NULL, NULL); @@ -4755,8 +4767,8 @@ yyreduce: case 232: -/* Line 1455 of yacc.c */ -#line 1393 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1391 "glsl_parser.ypp" { void *ctx = state; (yyval.declaration) = new(ctx) ast_declaration((yyvsp[(1) - (4)].identifier), true, (yyvsp[(3) - (4)].expression), NULL); @@ -4766,29 +4778,29 @@ yyreduce: case 235: -/* Line 1455 of yacc.c */ -#line 1411 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1409 "glsl_parser.ypp" { (yyval.node) = (ast_node *) (yyvsp[(1) - (1)].compound_statement); ;} break; case 240: -/* Line 1455 of yacc.c */ -#line 1419 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1417 "glsl_parser.ypp" { (yyval.node) = NULL; ;} break; case 241: -/* Line 1455 of yacc.c */ -#line 1420 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1418 "glsl_parser.ypp" { (yyval.node) = NULL; ;} break; case 244: -/* Line 1455 of yacc.c */ -#line 1427 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1425 "glsl_parser.ypp" { void *ctx = state; (yyval.compound_statement) = new(ctx) ast_compound_statement(true, NULL); @@ -4798,8 +4810,8 @@ yyreduce: case 245: -/* Line 1455 of yacc.c */ -#line 1433 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1431 "glsl_parser.ypp" { void *ctx = state; (yyval.compound_statement) = new(ctx) ast_compound_statement(true, (yyvsp[(2) - (3)].node)); @@ -4809,15 +4821,15 @@ yyreduce: case 246: -/* Line 1455 of yacc.c */ -#line 1441 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1439 "glsl_parser.ypp" { (yyval.node) = (ast_node *) (yyvsp[(1) - (1)].compound_statement); ;} break; case 248: -/* Line 1455 of yacc.c */ -#line 1447 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1445 "glsl_parser.ypp" { void *ctx = state; (yyval.compound_statement) = new(ctx) ast_compound_statement(false, NULL); @@ -4827,8 +4839,8 @@ yyreduce: case 249: -/* Line 1455 of yacc.c */ -#line 1453 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1451 "glsl_parser.ypp" { void *ctx = state; (yyval.compound_statement) = new(ctx) ast_compound_statement(false, (yyvsp[(2) - (3)].node)); @@ -4838,8 +4850,8 @@ yyreduce: case 250: -/* Line 1455 of yacc.c */ -#line 1462 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1460 "glsl_parser.ypp" { if ((yyvsp[(1) - (1)].node) == NULL) { _mesa_glsl_error(& (yylsp[(1) - (1)]), state, "<nil> statement\n"); @@ -4853,8 +4865,8 @@ yyreduce: case 251: -/* Line 1455 of yacc.c */ -#line 1472 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1470 "glsl_parser.ypp" { if ((yyvsp[(2) - (2)].node) == NULL) { _mesa_glsl_error(& (yylsp[(2) - (2)]), state, "<nil> statement\n"); @@ -4867,8 +4879,8 @@ yyreduce: case 252: -/* Line 1455 of yacc.c */ -#line 1484 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1482 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_expression_statement(NULL); @@ -4878,8 +4890,8 @@ yyreduce: case 253: -/* Line 1455 of yacc.c */ -#line 1490 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1488 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_expression_statement((yyvsp[(1) - (2)].expression)); @@ -4889,8 +4901,8 @@ yyreduce: case 254: -/* Line 1455 of yacc.c */ -#line 1499 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1497 "glsl_parser.ypp" { (yyval.node) = new(state) ast_selection_statement((yyvsp[(3) - (5)].expression), (yyvsp[(5) - (5)].selection_rest_statement).then_statement, (yyvsp[(5) - (5)].selection_rest_statement).else_statement); @@ -4900,8 +4912,8 @@ yyreduce: case 255: -/* Line 1455 of yacc.c */ -#line 1508 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1506 "glsl_parser.ypp" { (yyval.selection_rest_statement).then_statement = (yyvsp[(1) - (3)].node); (yyval.selection_rest_statement).else_statement = (yyvsp[(3) - (3)].node); @@ -4910,8 +4922,8 @@ yyreduce: case 256: -/* Line 1455 of yacc.c */ -#line 1513 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1511 "glsl_parser.ypp" { (yyval.selection_rest_statement).then_statement = (yyvsp[(1) - (1)].node); (yyval.selection_rest_statement).else_statement = NULL; @@ -4920,8 +4932,8 @@ yyreduce: case 257: -/* Line 1455 of yacc.c */ -#line 1521 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1519 "glsl_parser.ypp" { (yyval.node) = (ast_node *) (yyvsp[(1) - (1)].expression); ;} @@ -4929,8 +4941,8 @@ yyreduce: case 258: -/* Line 1455 of yacc.c */ -#line 1525 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1523 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (4)].identifier), false, NULL, (yyvsp[(4) - (4)].expression)); @@ -4945,8 +4957,8 @@ yyreduce: case 262: -/* Line 1455 of yacc.c */ -#line 1548 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1546 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_iteration_statement(ast_iteration_statement::ast_while, @@ -4957,8 +4969,8 @@ yyreduce: case 263: -/* Line 1455 of yacc.c */ -#line 1555 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1553 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_iteration_statement(ast_iteration_statement::ast_do_while, @@ -4969,8 +4981,8 @@ yyreduce: case 264: -/* Line 1455 of yacc.c */ -#line 1562 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1560 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_iteration_statement(ast_iteration_statement::ast_for, @@ -4981,8 +4993,8 @@ yyreduce: case 268: -/* Line 1455 of yacc.c */ -#line 1578 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1576 "glsl_parser.ypp" { (yyval.node) = NULL; ;} @@ -4990,8 +5002,8 @@ yyreduce: case 269: -/* Line 1455 of yacc.c */ -#line 1585 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1583 "glsl_parser.ypp" { (yyval.for_rest_statement).cond = (yyvsp[(1) - (2)].node); (yyval.for_rest_statement).rest = NULL; @@ -5000,8 +5012,8 @@ yyreduce: case 270: -/* Line 1455 of yacc.c */ -#line 1590 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1588 "glsl_parser.ypp" { (yyval.for_rest_statement).cond = (yyvsp[(1) - (3)].node); (yyval.for_rest_statement).rest = (yyvsp[(3) - (3)].expression); @@ -5010,8 +5022,8 @@ yyreduce: case 271: -/* Line 1455 of yacc.c */ -#line 1599 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1597 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_continue, NULL); @@ -5021,8 +5033,8 @@ yyreduce: case 272: -/* Line 1455 of yacc.c */ -#line 1605 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1603 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_break, NULL); @@ -5032,8 +5044,8 @@ yyreduce: case 273: -/* Line 1455 of yacc.c */ -#line 1611 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1609 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_return, NULL); @@ -5043,8 +5055,8 @@ yyreduce: case 274: -/* Line 1455 of yacc.c */ -#line 1617 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1615 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_return, (yyvsp[(2) - (3)].expression)); @@ -5054,8 +5066,8 @@ yyreduce: case 275: -/* Line 1455 of yacc.c */ -#line 1623 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1621 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_discard, NULL); @@ -5065,29 +5077,29 @@ yyreduce: case 276: -/* Line 1455 of yacc.c */ -#line 1631 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1629 "glsl_parser.ypp" { (yyval.node) = (yyvsp[(1) - (1)].function_definition); ;} break; case 277: -/* Line 1455 of yacc.c */ -#line 1632 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1630 "glsl_parser.ypp" { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; case 278: -/* Line 1455 of yacc.c */ -#line 1633 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1631 "glsl_parser.ypp" { (yyval.node) = NULL; ;} break; case 279: -/* Line 1455 of yacc.c */ -#line 1638 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1636 "glsl_parser.ypp" { void *ctx = state; (yyval.function_definition) = new(ctx) ast_function_definition(); @@ -5099,8 +5111,8 @@ yyreduce: -/* Line 1455 of yacc.c */ -#line 5104 "glsl_parser.cpp" +/* Line 1464 of yacc.c */ +#line 5116 "glsl_parser.cpp" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -5172,7 +5184,7 @@ yyerrlab: #endif } - yyerror_range[0] = yylloc; + yyerror_range[1] = yylloc; if (yyerrstatus == 3) { @@ -5209,7 +5221,7 @@ yyerrorlab: if (/*CONSTCOND*/ 0) goto yyerrorlab; - yyerror_range[0] = yylsp[1-yylen]; + yyerror_range[1] = yylsp[1-yylen]; /* Do not reclaim the symbols of the rule which action triggered this YYERROR. */ YYPOPSTACK (yylen); @@ -5243,7 +5255,7 @@ yyerrlab1: if (yyssp == yyss) YYABORT; - yyerror_range[0] = *yylsp; + yyerror_range[1] = *yylsp; yydestruct ("Error: popping", yystos[yystate], yyvsp, yylsp, state); YYPOPSTACK (1); @@ -5253,10 +5265,10 @@ yyerrlab1: *++yyvsp = yylval; - yyerror_range[1] = yylloc; + yyerror_range[2] = yylloc; /* Using YYLLOC is tempting, but would change the location of the lookahead. YYLOC is available though. */ - YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2); + YYLLOC_DEFAULT (yyloc, yyerror_range, 2); *++yylsp = yyloc; /* Shift the error token. */ diff --git a/src/glsl/glsl_parser.h b/src/glsl/glsl_parser.h index 01b407d4dbe..1bf3b3538c7 100644 --- a/src/glsl/glsl_parser.h +++ b/src/glsl/glsl_parser.h @@ -1,10 +1,9 @@ - -/* A Bison parser, made by GNU Bison 2.4.1. */ +/* A Bison parser, made by GNU Bison 2.4.3. */ /* Skeleton interface for Bison's Yacc-like parsers in C - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 - Free Software Foundation, Inc. + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -239,7 +238,7 @@ typedef union YYSTYPE { -/* Line 1676 of yacc.c */ +/* Line 1685 of yacc.c */ #line 52 "glsl_parser.ypp" int n; @@ -272,8 +271,8 @@ typedef union YYSTYPE -/* Line 1676 of yacc.c */ -#line 277 "glsl_parser.h" +/* Line 1685 of yacc.c */ +#line 276 "glsl_parser.h" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ diff --git a/src/glsl/glsl_parser.ypp b/src/glsl/glsl_parser.ypp index 124ee18356d..3982167c482 100644 --- a/src/glsl/glsl_parser.ypp +++ b/src/glsl/glsl_parser.ypp @@ -276,16 +276,16 @@ extension_statement: external_declaration_list: external_declaration { - /* FINISHME: The NULL test is only required because 'precision' - * FINISHME: statements are not yet supported. + /* FINISHME: The NULL test is required because pragmas are set to + * FINISHME: NULL. (See production rule for external_declaration.) */ if ($1 != NULL) state->translation_unit.push_tail(& $1->link); } | external_declaration_list external_declaration { - /* FINISHME: The NULL test is only required because 'precision' - * FINISHME: statements are not yet supported. + /* FINISHME: The NULL test is required because pragmas are set to + * FINISHME: NULL. (See production rule for external_declaration.) */ if ($2 != NULL) state->translation_unit.push_tail(& $2->link); @@ -702,14 +702,9 @@ declaration: } | PRECISION precision_qualifier type_specifier_no_prec ';' { - if (($3->type_specifier != ast_float) - && ($3->type_specifier != ast_int)) { - _mesa_glsl_error(& @3, state, "global precision qualifier can " - "only be applied to `int' or `float'\n"); - YYERROR; - } - - $$ = NULL; /* FINISHME */ + $3->precision = $2; + $3->is_precision_statement = true; + $$ = $3; } ; @@ -1195,6 +1190,9 @@ storage_qualifier: type_specifier: type_specifier_no_prec + { + $$ = $1; + } | precision_qualifier type_specifier_no_prec { $$ = $2; diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp index cbeacd5633f..77885d4e1e3 100644 --- a/src/glsl/glsl_parser_extras.cpp +++ b/src/glsl/glsl_parser_extras.cpp @@ -748,8 +748,10 @@ do_common_optimization(exec_list *ir, bool linked, unsigned max_unroll_iteration progress = optimize_redundant_jumps(ir) || progress; loop_state *ls = analyze_loop_variables(ir); - progress = set_loop_controls(ir, ls) || progress; - progress = unroll_loops(ir, ls, max_unroll_iterations) || progress; + if (ls->loop_found) { + progress = set_loop_controls(ir, ls) || progress; + progress = unroll_loops(ir, ls, max_unroll_iterations) || progress; + } delete ls; return progress; diff --git a/src/glsl/glsl_symbol_table.cpp b/src/glsl/glsl_symbol_table.cpp index 3dcd928016a..6fcfe07b9c2 100644 --- a/src/glsl/glsl_symbol_table.cpp +++ b/src/glsl/glsl_symbol_table.cpp @@ -35,13 +35,10 @@ public: return entry; } - /* If the user *does* call delete, that's OK, we will just - * talloc_free in that case. Here, C++ will have already called the - * destructor so tell talloc not to do that again. */ - static void operator delete(void *table) + /* If the user *does* call delete, that's OK, we will just talloc_free. */ + static void operator delete(void *entry) { - talloc_set_destructor(table, NULL); - talloc_free(table); + talloc_free(entry); } symbol_table_entry(ir_variable *v) : v(v), f(0), t(0) {} diff --git a/src/glsl/loop_analysis.cpp b/src/glsl/loop_analysis.cpp index ff7adf00a21..3cf86ebaa38 100644 --- a/src/glsl/loop_analysis.cpp +++ b/src/glsl/loop_analysis.cpp @@ -38,6 +38,7 @@ loop_state::loop_state() this->ht = hash_table_ctor(0, hash_table_pointer_hash, hash_table_pointer_compare); this->mem_ctx = talloc_init("loop state"); + this->loop_found = false; } @@ -52,7 +53,9 @@ loop_variable_state * loop_state::insert(ir_loop *ir) { loop_variable_state *ls = new(this->mem_ctx) loop_variable_state; + hash_table_insert(this->ht, ls, ir); + this->loop_found = true; return ls; } diff --git a/src/glsl/loop_analysis.h b/src/glsl/loop_analysis.h index 7b0511fbbec..229730836a8 100644 --- a/src/glsl/loop_analysis.h +++ b/src/glsl/loop_analysis.h @@ -214,6 +214,8 @@ public: loop_variable_state *insert(ir_loop *ir); + bool loop_found; + private: loop_state(); |