diff options
-rw-r--r-- | src/glsl/glcpp/glcpp-parse.c | 175 |
1 files changed, 90 insertions, 85 deletions
diff --git a/src/glsl/glcpp/glcpp-parse.c b/src/glsl/glcpp/glcpp-parse.c index d3eeb794775..0cd1fe5d598 100644 --- a/src/glsl/glcpp/glcpp-parse.c +++ b/src/glsl/glcpp/glcpp-parse.c @@ -634,15 +634,15 @@ static const yytype_uint16 yyrline[] = { 0, 188, 188, 190, 194, 197, 202, 203, 207, 210, 216, 219, 222, 225, 233, 252, 262, 267, 272, 291, - 306, 309, 312, 328, 332, 341, 346, 347, 350, 353, - 356, 359, 362, 365, 368, 371, 374, 377, 380, 383, - 386, 389, 392, 395, 398, 401, 404, 407, 410, 413, - 419, 424, 432, 433, 437, 443, 444, 447, 449, 456, - 460, 464, 469, 475, 483, 489, 497, 501, 505, 509, - 513, 520, 521, 522, 523, 524, 525, 526, 527, 528, - 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, - 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, - 549, 550 + 306, 309, 312, 333, 337, 346, 351, 352, 355, 358, + 361, 364, 367, 370, 373, 376, 379, 382, 385, 388, + 391, 394, 397, 400, 403, 406, 409, 412, 415, 418, + 424, 429, 437, 438, 442, 448, 449, 452, 454, 461, + 465, 469, 474, 480, 488, 494, 502, 506, 510, 514, + 518, 525, 526, 527, 528, 529, 530, 531, 532, 533, + 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, + 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, + 554, 555 }; #endif @@ -2027,7 +2027,12 @@ yyreduce: if ((yyvsp[(2) - (3)].ival) == 100) add_builtin_define (parser, "GL_ES", 1); - if ((yyvsp[(2) - (3)].ival) >= 130) + /* Currently, all ES2 implementations support highp in the + * fragment shader, so we always define this macro in ES2. + * If we ever get a driver that doesn't support highp, we'll + * need to add a flag to the gl_context and check that here. + */ + if ((yyvsp[(2) - (3)].ival) >= 130 || (yyvsp[(2) - (3)].ival) == 100) add_builtin_define (parser, "GL_FRAGMENT_PRECISION_HIGH", 1); glcpp_printf(parser->output, "#version %" PRIiMAX, (yyvsp[(2) - (3)].ival)); @@ -2037,7 +2042,7 @@ yyreduce: case 24: /* Line 1464 of yacc.c */ -#line 332 "glcpp/glcpp-parse.y" +#line 337 "glcpp/glcpp-parse.y" { if (strlen ((yyvsp[(1) - (1)].str)) >= 3 && strncmp ((yyvsp[(1) - (1)].str), "0x", 2) == 0) { (yyval.ival) = strtoll ((yyvsp[(1) - (1)].str) + 2, NULL, 16); @@ -2052,7 +2057,7 @@ yyreduce: case 25: /* Line 1464 of yacc.c */ -#line 341 "glcpp/glcpp-parse.y" +#line 346 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (1)].ival); ;} @@ -2061,7 +2066,7 @@ yyreduce: case 27: /* Line 1464 of yacc.c */ -#line 347 "glcpp/glcpp-parse.y" +#line 352 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) || (yyvsp[(3) - (3)].ival); ;} @@ -2070,7 +2075,7 @@ yyreduce: case 28: /* Line 1464 of yacc.c */ -#line 350 "glcpp/glcpp-parse.y" +#line 355 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) && (yyvsp[(3) - (3)].ival); ;} @@ -2079,7 +2084,7 @@ yyreduce: case 29: /* Line 1464 of yacc.c */ -#line 353 "glcpp/glcpp-parse.y" +#line 358 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) | (yyvsp[(3) - (3)].ival); ;} @@ -2088,7 +2093,7 @@ yyreduce: case 30: /* Line 1464 of yacc.c */ -#line 356 "glcpp/glcpp-parse.y" +#line 361 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) ^ (yyvsp[(3) - (3)].ival); ;} @@ -2097,7 +2102,7 @@ yyreduce: case 31: /* Line 1464 of yacc.c */ -#line 359 "glcpp/glcpp-parse.y" +#line 364 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) & (yyvsp[(3) - (3)].ival); ;} @@ -2106,7 +2111,7 @@ yyreduce: case 32: /* Line 1464 of yacc.c */ -#line 362 "glcpp/glcpp-parse.y" +#line 367 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) != (yyvsp[(3) - (3)].ival); ;} @@ -2115,7 +2120,7 @@ yyreduce: case 33: /* Line 1464 of yacc.c */ -#line 365 "glcpp/glcpp-parse.y" +#line 370 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) == (yyvsp[(3) - (3)].ival); ;} @@ -2124,7 +2129,7 @@ yyreduce: case 34: /* Line 1464 of yacc.c */ -#line 368 "glcpp/glcpp-parse.y" +#line 373 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) >= (yyvsp[(3) - (3)].ival); ;} @@ -2133,7 +2138,7 @@ yyreduce: case 35: /* Line 1464 of yacc.c */ -#line 371 "glcpp/glcpp-parse.y" +#line 376 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) <= (yyvsp[(3) - (3)].ival); ;} @@ -2142,7 +2147,7 @@ yyreduce: case 36: /* Line 1464 of yacc.c */ -#line 374 "glcpp/glcpp-parse.y" +#line 379 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) > (yyvsp[(3) - (3)].ival); ;} @@ -2151,7 +2156,7 @@ yyreduce: case 37: /* Line 1464 of yacc.c */ -#line 377 "glcpp/glcpp-parse.y" +#line 382 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) < (yyvsp[(3) - (3)].ival); ;} @@ -2160,7 +2165,7 @@ yyreduce: case 38: /* Line 1464 of yacc.c */ -#line 380 "glcpp/glcpp-parse.y" +#line 385 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) >> (yyvsp[(3) - (3)].ival); ;} @@ -2169,7 +2174,7 @@ yyreduce: case 39: /* Line 1464 of yacc.c */ -#line 383 "glcpp/glcpp-parse.y" +#line 388 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) << (yyvsp[(3) - (3)].ival); ;} @@ -2178,7 +2183,7 @@ yyreduce: case 40: /* Line 1464 of yacc.c */ -#line 386 "glcpp/glcpp-parse.y" +#line 391 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) - (yyvsp[(3) - (3)].ival); ;} @@ -2187,7 +2192,7 @@ yyreduce: case 41: /* Line 1464 of yacc.c */ -#line 389 "glcpp/glcpp-parse.y" +#line 394 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) + (yyvsp[(3) - (3)].ival); ;} @@ -2196,7 +2201,7 @@ yyreduce: case 42: /* Line 1464 of yacc.c */ -#line 392 "glcpp/glcpp-parse.y" +#line 397 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) % (yyvsp[(3) - (3)].ival); ;} @@ -2205,7 +2210,7 @@ yyreduce: case 43: /* Line 1464 of yacc.c */ -#line 395 "glcpp/glcpp-parse.y" +#line 400 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) / (yyvsp[(3) - (3)].ival); ;} @@ -2214,7 +2219,7 @@ yyreduce: case 44: /* Line 1464 of yacc.c */ -#line 398 "glcpp/glcpp-parse.y" +#line 403 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) * (yyvsp[(3) - (3)].ival); ;} @@ -2223,7 +2228,7 @@ yyreduce: case 45: /* Line 1464 of yacc.c */ -#line 401 "glcpp/glcpp-parse.y" +#line 406 "glcpp/glcpp-parse.y" { (yyval.ival) = ! (yyvsp[(2) - (2)].ival); ;} @@ -2232,7 +2237,7 @@ yyreduce: case 46: /* Line 1464 of yacc.c */ -#line 404 "glcpp/glcpp-parse.y" +#line 409 "glcpp/glcpp-parse.y" { (yyval.ival) = ~ (yyvsp[(2) - (2)].ival); ;} @@ -2241,7 +2246,7 @@ yyreduce: case 47: /* Line 1464 of yacc.c */ -#line 407 "glcpp/glcpp-parse.y" +#line 412 "glcpp/glcpp-parse.y" { (yyval.ival) = - (yyvsp[(2) - (2)].ival); ;} @@ -2250,7 +2255,7 @@ yyreduce: case 48: /* Line 1464 of yacc.c */ -#line 410 "glcpp/glcpp-parse.y" +#line 415 "glcpp/glcpp-parse.y" { (yyval.ival) = + (yyvsp[(2) - (2)].ival); ;} @@ -2259,7 +2264,7 @@ yyreduce: case 49: /* Line 1464 of yacc.c */ -#line 413 "glcpp/glcpp-parse.y" +#line 418 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(2) - (3)].ival); ;} @@ -2268,7 +2273,7 @@ yyreduce: case 50: /* Line 1464 of yacc.c */ -#line 419 "glcpp/glcpp-parse.y" +#line 424 "glcpp/glcpp-parse.y" { (yyval.string_list) = _string_list_create (parser); _string_list_append_item ((yyval.string_list), (yyvsp[(1) - (1)].str)); @@ -2279,7 +2284,7 @@ yyreduce: case 51: /* Line 1464 of yacc.c */ -#line 424 "glcpp/glcpp-parse.y" +#line 429 "glcpp/glcpp-parse.y" { (yyval.string_list) = (yyvsp[(1) - (3)].string_list); _string_list_append_item ((yyval.string_list), (yyvsp[(3) - (3)].str)); @@ -2290,14 +2295,14 @@ yyreduce: case 52: /* Line 1464 of yacc.c */ -#line 432 "glcpp/glcpp-parse.y" +#line 437 "glcpp/glcpp-parse.y" { (yyval.token_list) = NULL; ;} break; case 54: /* Line 1464 of yacc.c */ -#line 437 "glcpp/glcpp-parse.y" +#line 442 "glcpp/glcpp-parse.y" { yyerror (& (yylsp[(1) - (2)]), parser, "Invalid tokens after #"); ;} @@ -2306,14 +2311,14 @@ yyreduce: case 55: /* Line 1464 of yacc.c */ -#line 443 "glcpp/glcpp-parse.y" +#line 448 "glcpp/glcpp-parse.y" { (yyval.token_list) = NULL; ;} break; case 58: /* Line 1464 of yacc.c */ -#line 449 "glcpp/glcpp-parse.y" +#line 454 "glcpp/glcpp-parse.y" { glcpp_warning(&(yylsp[(1) - (1)]), parser, "extra tokens at end of directive"); ;} @@ -2322,7 +2327,7 @@ yyreduce: case 59: /* Line 1464 of yacc.c */ -#line 456 "glcpp/glcpp-parse.y" +#line 461 "glcpp/glcpp-parse.y" { int v = hash_table_find (parser->defines, (yyvsp[(2) - (2)].str)) ? 1 : 0; (yyval.token) = _token_create_ival (parser, INTEGER, v); @@ -2332,7 +2337,7 @@ yyreduce: case 60: /* Line 1464 of yacc.c */ -#line 460 "glcpp/glcpp-parse.y" +#line 465 "glcpp/glcpp-parse.y" { int v = hash_table_find (parser->defines, (yyvsp[(3) - (4)].str)) ? 1 : 0; (yyval.token) = _token_create_ival (parser, INTEGER, v); @@ -2342,7 +2347,7 @@ yyreduce: case 62: /* Line 1464 of yacc.c */ -#line 469 "glcpp/glcpp-parse.y" +#line 474 "glcpp/glcpp-parse.y" { parser->space_tokens = 1; (yyval.token_list) = _token_list_create (parser); @@ -2354,7 +2359,7 @@ yyreduce: case 63: /* Line 1464 of yacc.c */ -#line 475 "glcpp/glcpp-parse.y" +#line 480 "glcpp/glcpp-parse.y" { (yyval.token_list) = (yyvsp[(1) - (2)].token_list); _token_list_append ((yyval.token_list), (yyvsp[(2) - (2)].token)); @@ -2365,7 +2370,7 @@ yyreduce: case 64: /* Line 1464 of yacc.c */ -#line 483 "glcpp/glcpp-parse.y" +#line 488 "glcpp/glcpp-parse.y" { parser->space_tokens = 1; (yyval.token_list) = _token_list_create (parser); @@ -2377,7 +2382,7 @@ yyreduce: case 65: /* Line 1464 of yacc.c */ -#line 489 "glcpp/glcpp-parse.y" +#line 494 "glcpp/glcpp-parse.y" { (yyval.token_list) = (yyvsp[(1) - (2)].token_list); _token_list_append ((yyval.token_list), (yyvsp[(2) - (2)].token)); @@ -2388,7 +2393,7 @@ yyreduce: case 66: /* Line 1464 of yacc.c */ -#line 497 "glcpp/glcpp-parse.y" +#line 502 "glcpp/glcpp-parse.y" { (yyval.token) = _token_create_str (parser, IDENTIFIER, (yyvsp[(1) - (1)].str)); (yyval.token)->location = yylloc; @@ -2398,7 +2403,7 @@ yyreduce: case 67: /* Line 1464 of yacc.c */ -#line 501 "glcpp/glcpp-parse.y" +#line 506 "glcpp/glcpp-parse.y" { (yyval.token) = _token_create_str (parser, INTEGER_STRING, (yyvsp[(1) - (1)].str)); (yyval.token)->location = yylloc; @@ -2408,7 +2413,7 @@ yyreduce: case 68: /* Line 1464 of yacc.c */ -#line 505 "glcpp/glcpp-parse.y" +#line 510 "glcpp/glcpp-parse.y" { (yyval.token) = _token_create_ival (parser, (yyvsp[(1) - (1)].ival), (yyvsp[(1) - (1)].ival)); (yyval.token)->location = yylloc; @@ -2418,7 +2423,7 @@ yyreduce: case 69: /* Line 1464 of yacc.c */ -#line 509 "glcpp/glcpp-parse.y" +#line 514 "glcpp/glcpp-parse.y" { (yyval.token) = _token_create_str (parser, OTHER, (yyvsp[(1) - (1)].str)); (yyval.token)->location = yylloc; @@ -2428,7 +2433,7 @@ yyreduce: case 70: /* Line 1464 of yacc.c */ -#line 513 "glcpp/glcpp-parse.y" +#line 518 "glcpp/glcpp-parse.y" { (yyval.token) = _token_create_ival (parser, SPACE, SPACE); (yyval.token)->location = yylloc; @@ -2438,224 +2443,224 @@ yyreduce: case 71: /* Line 1464 of yacc.c */ -#line 520 "glcpp/glcpp-parse.y" +#line 525 "glcpp/glcpp-parse.y" { (yyval.ival) = '['; ;} break; case 72: /* Line 1464 of yacc.c */ -#line 521 "glcpp/glcpp-parse.y" +#line 526 "glcpp/glcpp-parse.y" { (yyval.ival) = ']'; ;} break; case 73: /* Line 1464 of yacc.c */ -#line 522 "glcpp/glcpp-parse.y" +#line 527 "glcpp/glcpp-parse.y" { (yyval.ival) = '('; ;} break; case 74: /* Line 1464 of yacc.c */ -#line 523 "glcpp/glcpp-parse.y" +#line 528 "glcpp/glcpp-parse.y" { (yyval.ival) = ')'; ;} break; case 75: /* Line 1464 of yacc.c */ -#line 524 "glcpp/glcpp-parse.y" +#line 529 "glcpp/glcpp-parse.y" { (yyval.ival) = '{'; ;} break; case 76: /* Line 1464 of yacc.c */ -#line 525 "glcpp/glcpp-parse.y" +#line 530 "glcpp/glcpp-parse.y" { (yyval.ival) = '}'; ;} break; case 77: /* Line 1464 of yacc.c */ -#line 526 "glcpp/glcpp-parse.y" +#line 531 "glcpp/glcpp-parse.y" { (yyval.ival) = '.'; ;} break; case 78: /* Line 1464 of yacc.c */ -#line 527 "glcpp/glcpp-parse.y" +#line 532 "glcpp/glcpp-parse.y" { (yyval.ival) = '&'; ;} break; case 79: /* Line 1464 of yacc.c */ -#line 528 "glcpp/glcpp-parse.y" +#line 533 "glcpp/glcpp-parse.y" { (yyval.ival) = '*'; ;} break; case 80: /* Line 1464 of yacc.c */ -#line 529 "glcpp/glcpp-parse.y" +#line 534 "glcpp/glcpp-parse.y" { (yyval.ival) = '+'; ;} break; case 81: /* Line 1464 of yacc.c */ -#line 530 "glcpp/glcpp-parse.y" +#line 535 "glcpp/glcpp-parse.y" { (yyval.ival) = '-'; ;} break; case 82: /* Line 1464 of yacc.c */ -#line 531 "glcpp/glcpp-parse.y" +#line 536 "glcpp/glcpp-parse.y" { (yyval.ival) = '~'; ;} break; case 83: /* Line 1464 of yacc.c */ -#line 532 "glcpp/glcpp-parse.y" +#line 537 "glcpp/glcpp-parse.y" { (yyval.ival) = '!'; ;} break; case 84: /* Line 1464 of yacc.c */ -#line 533 "glcpp/glcpp-parse.y" +#line 538 "glcpp/glcpp-parse.y" { (yyval.ival) = '/'; ;} break; case 85: /* Line 1464 of yacc.c */ -#line 534 "glcpp/glcpp-parse.y" +#line 539 "glcpp/glcpp-parse.y" { (yyval.ival) = '%'; ;} break; case 86: /* Line 1464 of yacc.c */ -#line 535 "glcpp/glcpp-parse.y" +#line 540 "glcpp/glcpp-parse.y" { (yyval.ival) = LEFT_SHIFT; ;} break; case 87: /* Line 1464 of yacc.c */ -#line 536 "glcpp/glcpp-parse.y" +#line 541 "glcpp/glcpp-parse.y" { (yyval.ival) = RIGHT_SHIFT; ;} break; case 88: /* Line 1464 of yacc.c */ -#line 537 "glcpp/glcpp-parse.y" +#line 542 "glcpp/glcpp-parse.y" { (yyval.ival) = '<'; ;} break; case 89: /* Line 1464 of yacc.c */ -#line 538 "glcpp/glcpp-parse.y" +#line 543 "glcpp/glcpp-parse.y" { (yyval.ival) = '>'; ;} break; case 90: /* Line 1464 of yacc.c */ -#line 539 "glcpp/glcpp-parse.y" +#line 544 "glcpp/glcpp-parse.y" { (yyval.ival) = LESS_OR_EQUAL; ;} break; case 91: /* Line 1464 of yacc.c */ -#line 540 "glcpp/glcpp-parse.y" +#line 545 "glcpp/glcpp-parse.y" { (yyval.ival) = GREATER_OR_EQUAL; ;} break; case 92: /* Line 1464 of yacc.c */ -#line 541 "glcpp/glcpp-parse.y" +#line 546 "glcpp/glcpp-parse.y" { (yyval.ival) = EQUAL; ;} break; case 93: /* Line 1464 of yacc.c */ -#line 542 "glcpp/glcpp-parse.y" +#line 547 "glcpp/glcpp-parse.y" { (yyval.ival) = NOT_EQUAL; ;} break; case 94: /* Line 1464 of yacc.c */ -#line 543 "glcpp/glcpp-parse.y" +#line 548 "glcpp/glcpp-parse.y" { (yyval.ival) = '^'; ;} break; case 95: /* Line 1464 of yacc.c */ -#line 544 "glcpp/glcpp-parse.y" +#line 549 "glcpp/glcpp-parse.y" { (yyval.ival) = '|'; ;} break; case 96: /* Line 1464 of yacc.c */ -#line 545 "glcpp/glcpp-parse.y" +#line 550 "glcpp/glcpp-parse.y" { (yyval.ival) = AND; ;} break; case 97: /* Line 1464 of yacc.c */ -#line 546 "glcpp/glcpp-parse.y" +#line 551 "glcpp/glcpp-parse.y" { (yyval.ival) = OR; ;} break; case 98: /* Line 1464 of yacc.c */ -#line 547 "glcpp/glcpp-parse.y" +#line 552 "glcpp/glcpp-parse.y" { (yyval.ival) = ';'; ;} break; case 99: /* Line 1464 of yacc.c */ -#line 548 "glcpp/glcpp-parse.y" +#line 553 "glcpp/glcpp-parse.y" { (yyval.ival) = ','; ;} break; case 100: /* Line 1464 of yacc.c */ -#line 549 "glcpp/glcpp-parse.y" +#line 554 "glcpp/glcpp-parse.y" { (yyval.ival) = '='; ;} break; case 101: /* Line 1464 of yacc.c */ -#line 550 "glcpp/glcpp-parse.y" +#line 555 "glcpp/glcpp-parse.y" { (yyval.ival) = PASTE; ;} break; /* Line 1464 of yacc.c */ -#line 2659 "glcpp/glcpp-parse.c" +#line 2664 "glcpp/glcpp-parse.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -2874,7 +2879,7 @@ yyreturn: /* Line 1684 of yacc.c */ -#line 553 "glcpp/glcpp-parse.y" +#line 558 "glcpp/glcpp-parse.y" string_list_t * |