From e0c9f67be5c47273416a50e011f70aa9e2021a65 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 5 Oct 2010 16:02:38 -0700 Subject: glcpp: Add the define for ARB_explicit_attrib_location when present --- src/glsl/glcpp/glcpp-parse.y | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/glsl/glcpp') diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y index 43513ebb66..b31a18f87d 100644 --- a/src/glsl/glcpp/glcpp-parse.y +++ b/src/glsl/glcpp/glcpp-parse.y @@ -1094,6 +1094,9 @@ glcpp_parser_create (const struct gl_extensions *extensions, int api) if (extensions->ARB_fragment_coord_conventions) add_builtin_define(parser, "GL_ARB_fragment_coord_conventions", 1); + + if (extensions->ARB_explicit_attrib_location) + add_builtin_define(parser, "GL_ARB_explicit_attrib_location", 1); } language_version = 110; -- cgit v1.2.3 From eafebed5bdfd853c6ec7f7275e219378e441c49c Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 5 Oct 2010 16:03:12 -0700 Subject: glcpp: Regenerate files changes by previous commit --- src/glsl/glcpp/glcpp-parse.c | 237 +++++++++++++++++++++---------------------- src/glsl/glcpp/glcpp-parse.h | 7 +- 2 files changed, 120 insertions(+), 124 deletions(-) (limited to 'src/glsl/glcpp') diff --git a/src/glsl/glcpp/glcpp-parse.c b/src/glsl/glcpp/glcpp-parse.c index 1773ca5c13..30b6fd6ef9 100644 --- a/src/glsl/glcpp/glcpp-parse.c +++ b/src/glsl/glcpp/glcpp-parse.c @@ -1,9 +1,10 @@ -/* A Bison parser, made by GNU Bison 2.4.3. */ + +/* A Bison parser, made by GNU Bison 2.4.1. */ /* Skeleton implementation for Bison's Yacc-like parsers in C - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006, - 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + 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 @@ -45,7 +46,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.4.3" +#define YYBISON_VERSION "2.4.1" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -219,7 +220,7 @@ add_builtin_define(glcpp_parser_t *parser, const char *name, int value); /* Line 189 of yacc.c */ -#line 223 "glcpp/glcpp-parse.c" +#line 224 "glcpp/glcpp-parse.c" /* Enabling traces. */ #ifndef YYDEBUG @@ -307,7 +308,7 @@ typedef struct YYLTYPE /* Line 264 of yacc.c */ -#line 311 "glcpp/glcpp-parse.c" +#line 312 "glcpp/glcpp-parse.c" #ifdef short # undef short @@ -357,7 +358,7 @@ typedef short int yytype_int16; #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) #ifndef YY_ -# if defined YYENABLE_NLS && YYENABLE_NLS +# if YYENABLE_NLS # if ENABLE_NLS # include /* INFRINGES ON USER NAME SPACE */ # define YY_(msgid) dgettext ("bison-runtime", msgid) @@ -945,18 +946,9 @@ static const yytype_uint8 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. 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. */ + Once GCC version 2 has supplanted version 1, this can go. */ #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) @@ -1013,7 +1005,7 @@ while (YYID (0)) we won't break user code: when these are the locations we know. */ #ifndef YY_LOCATION_PRINT -# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL +# if YYLTYPE_IS_TRIVIAL # define YY_LOCATION_PRINT(File, Loc) \ fprintf (File, "%d.%d-%d.%d", \ (Loc).first_line, (Loc).first_column, \ @@ -1555,7 +1547,7 @@ YYLTYPE yylloc; YYLTYPE *yylsp; /* The locations where the error started and ended. */ - YYLTYPE yyerror_range[3]; + YYLTYPE yyerror_range[2]; YYSIZE_T yystacksize; @@ -1602,7 +1594,7 @@ YYLTYPE yylloc; yyvsp = yyvs; yylsp = yyls; -#if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL +#if YYLTYPE_IS_TRIVIAL /* Initialize the default location before parsing starts. */ yylloc.first_line = yylloc.last_line = 1; yylloc.first_column = yylloc.last_column = 1; @@ -1610,7 +1602,7 @@ YYLTYPE yylloc; /* User initialization code. */ -/* Line 1251 of yacc.c */ +/* Line 1242 of yacc.c */ #line 155 "glcpp/glcpp-parse.y" { yylloc.first_line = 1; @@ -1620,8 +1612,8 @@ YYLTYPE yylloc; yylloc.source = 0; } -/* Line 1251 of yacc.c */ -#line 1625 "glcpp/glcpp-parse.c" +/* Line 1242 of yacc.c */ +#line 1617 "glcpp/glcpp-parse.c" yylsp[0] = yylloc; goto yysetstate; @@ -1808,7 +1800,7 @@ yyreduce: { case 4: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 194 "glcpp/glcpp-parse.y" { glcpp_print(parser->output, "\n"); @@ -1817,7 +1809,7 @@ yyreduce: case 5: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 197 "glcpp/glcpp-parse.y" { _glcpp_parser_print_expanded_token_list (parser, (yyvsp[(1) - (1)].token_list)); @@ -1828,7 +1820,7 @@ yyreduce: case 8: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 207 "glcpp/glcpp-parse.y" { _glcpp_parser_skip_stack_push_if (parser, & (yylsp[(1) - (3)]), (yyvsp[(2) - (3)].ival)); @@ -1837,7 +1829,7 @@ yyreduce: case 9: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 210 "glcpp/glcpp-parse.y" { _glcpp_parser_skip_stack_change_if (parser, & (yylsp[(1) - (3)]), "elif", (yyvsp[(2) - (3)].ival)); @@ -1846,7 +1838,7 @@ yyreduce: case 10: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 216 "glcpp/glcpp-parse.y" { _define_object_macro (parser, & (yylsp[(2) - (4)]), (yyvsp[(2) - (4)].str), (yyvsp[(3) - (4)].token_list)); @@ -1855,7 +1847,7 @@ yyreduce: case 11: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 219 "glcpp/glcpp-parse.y" { _define_function_macro (parser, & (yylsp[(2) - (6)]), (yyvsp[(2) - (6)].str), NULL, (yyvsp[(5) - (6)].token_list)); @@ -1864,7 +1856,7 @@ yyreduce: case 12: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 222 "glcpp/glcpp-parse.y" { _define_function_macro (parser, & (yylsp[(2) - (7)]), (yyvsp[(2) - (7)].str), (yyvsp[(4) - (7)].string_list), (yyvsp[(6) - (7)].token_list)); @@ -1873,7 +1865,7 @@ yyreduce: case 13: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 225 "glcpp/glcpp-parse.y" { macro_t *macro = hash_table_find (parser->defines, (yyvsp[(2) - (3)].str)); @@ -1887,7 +1879,7 @@ yyreduce: case 14: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 233 "glcpp/glcpp-parse.y" { /* Be careful to only evaluate the 'if' expression if @@ -1912,7 +1904,7 @@ yyreduce: case 15: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 252 "glcpp/glcpp-parse.y" { /* #if without an expression is only an error if we @@ -1928,7 +1920,7 @@ yyreduce: case 16: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 262 "glcpp/glcpp-parse.y" { macro_t *macro = hash_table_find (parser->defines, (yyvsp[(2) - (4)].str)); @@ -1939,7 +1931,7 @@ yyreduce: case 17: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 267 "glcpp/glcpp-parse.y" { macro_t *macro = hash_table_find (parser->defines, (yyvsp[(2) - (4)].str)); @@ -1950,7 +1942,7 @@ yyreduce: case 18: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 272 "glcpp/glcpp-parse.y" { /* Be careful to only evaluate the 'elif' expression @@ -1975,7 +1967,7 @@ yyreduce: case 19: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 291 "glcpp/glcpp-parse.y" { /* #elif without an expression is an error unless we @@ -1996,7 +1988,7 @@ yyreduce: case 20: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 306 "glcpp/glcpp-parse.y" { _glcpp_parser_skip_stack_change_if (parser, & (yylsp[(1) - (2)]), "else", 1); @@ -2005,7 +1997,7 @@ yyreduce: case 21: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 309 "glcpp/glcpp-parse.y" { _glcpp_parser_skip_stack_pop (parser, & (yylsp[(1) - (2)])); @@ -2014,7 +2006,7 @@ yyreduce: case 22: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 312 "glcpp/glcpp-parse.y" { macro_t *macro = hash_table_find (parser->defines, "__VERSION__"); @@ -2033,7 +2025,7 @@ yyreduce: case 24: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 329 "glcpp/glcpp-parse.y" { if (strlen ((yyvsp[(1) - (1)].str)) >= 3 && strncmp ((yyvsp[(1) - (1)].str), "0x", 2) == 0) { @@ -2048,7 +2040,7 @@ yyreduce: case 25: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 338 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (1)].ival); @@ -2057,7 +2049,7 @@ yyreduce: case 27: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 344 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) || (yyvsp[(3) - (3)].ival); @@ -2066,7 +2058,7 @@ yyreduce: case 28: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 347 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) && (yyvsp[(3) - (3)].ival); @@ -2075,7 +2067,7 @@ yyreduce: case 29: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 350 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) | (yyvsp[(3) - (3)].ival); @@ -2084,7 +2076,7 @@ yyreduce: case 30: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 353 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) ^ (yyvsp[(3) - (3)].ival); @@ -2093,7 +2085,7 @@ yyreduce: case 31: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 356 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) & (yyvsp[(3) - (3)].ival); @@ -2102,7 +2094,7 @@ yyreduce: case 32: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 359 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) != (yyvsp[(3) - (3)].ival); @@ -2111,7 +2103,7 @@ yyreduce: case 33: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 362 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) == (yyvsp[(3) - (3)].ival); @@ -2120,7 +2112,7 @@ yyreduce: case 34: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 365 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) >= (yyvsp[(3) - (3)].ival); @@ -2129,7 +2121,7 @@ yyreduce: case 35: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 368 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) <= (yyvsp[(3) - (3)].ival); @@ -2138,7 +2130,7 @@ yyreduce: case 36: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 371 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) > (yyvsp[(3) - (3)].ival); @@ -2147,7 +2139,7 @@ yyreduce: case 37: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 374 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) < (yyvsp[(3) - (3)].ival); @@ -2156,7 +2148,7 @@ yyreduce: case 38: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 377 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) >> (yyvsp[(3) - (3)].ival); @@ -2165,7 +2157,7 @@ yyreduce: case 39: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 380 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) << (yyvsp[(3) - (3)].ival); @@ -2174,7 +2166,7 @@ yyreduce: case 40: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 383 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) - (yyvsp[(3) - (3)].ival); @@ -2183,7 +2175,7 @@ yyreduce: case 41: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 386 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) + (yyvsp[(3) - (3)].ival); @@ -2192,7 +2184,7 @@ yyreduce: case 42: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 389 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) % (yyvsp[(3) - (3)].ival); @@ -2201,7 +2193,7 @@ yyreduce: case 43: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 392 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) / (yyvsp[(3) - (3)].ival); @@ -2210,7 +2202,7 @@ yyreduce: case 44: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 395 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) * (yyvsp[(3) - (3)].ival); @@ -2219,7 +2211,7 @@ yyreduce: case 45: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 398 "glcpp/glcpp-parse.y" { (yyval.ival) = ! (yyvsp[(2) - (2)].ival); @@ -2228,7 +2220,7 @@ yyreduce: case 46: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 401 "glcpp/glcpp-parse.y" { (yyval.ival) = ~ (yyvsp[(2) - (2)].ival); @@ -2237,7 +2229,7 @@ yyreduce: case 47: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 404 "glcpp/glcpp-parse.y" { (yyval.ival) = - (yyvsp[(2) - (2)].ival); @@ -2246,7 +2238,7 @@ yyreduce: case 48: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 407 "glcpp/glcpp-parse.y" { (yyval.ival) = + (yyvsp[(2) - (2)].ival); @@ -2255,7 +2247,7 @@ yyreduce: case 49: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 410 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(2) - (3)].ival); @@ -2264,7 +2256,7 @@ yyreduce: case 50: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 416 "glcpp/glcpp-parse.y" { (yyval.string_list) = _string_list_create (parser); @@ -2275,7 +2267,7 @@ yyreduce: case 51: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 421 "glcpp/glcpp-parse.y" { (yyval.string_list) = (yyvsp[(1) - (3)].string_list); @@ -2286,14 +2278,14 @@ yyreduce: case 52: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 429 "glcpp/glcpp-parse.y" { (yyval.token_list) = NULL; ;} break; case 54: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 434 "glcpp/glcpp-parse.y" { yyerror (& (yylsp[(1) - (2)]), parser, "Invalid tokens after #"); @@ -2302,14 +2294,14 @@ yyreduce: case 55: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 440 "glcpp/glcpp-parse.y" { (yyval.token_list) = NULL; ;} break; case 58: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 446 "glcpp/glcpp-parse.y" { glcpp_warning(&(yylsp[(1) - (1)]), parser, "extra tokens at end of directive"); @@ -2318,7 +2310,7 @@ yyreduce: case 59: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 453 "glcpp/glcpp-parse.y" { int v = hash_table_find (parser->defines, (yyvsp[(2) - (2)].str)) ? 1 : 0; @@ -2328,7 +2320,7 @@ yyreduce: case 60: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 457 "glcpp/glcpp-parse.y" { int v = hash_table_find (parser->defines, (yyvsp[(3) - (4)].str)) ? 1 : 0; @@ -2338,7 +2330,7 @@ yyreduce: case 62: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 466 "glcpp/glcpp-parse.y" { parser->space_tokens = 1; @@ -2350,7 +2342,7 @@ yyreduce: case 63: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 472 "glcpp/glcpp-parse.y" { (yyval.token_list) = (yyvsp[(1) - (2)].token_list); @@ -2361,7 +2353,7 @@ yyreduce: case 64: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 480 "glcpp/glcpp-parse.y" { parser->space_tokens = 1; @@ -2373,7 +2365,7 @@ yyreduce: case 65: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 486 "glcpp/glcpp-parse.y" { (yyval.token_list) = (yyvsp[(1) - (2)].token_list); @@ -2384,7 +2376,7 @@ yyreduce: case 66: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 494 "glcpp/glcpp-parse.y" { (yyval.token) = _token_create_str (parser, IDENTIFIER, (yyvsp[(1) - (1)].str)); @@ -2394,7 +2386,7 @@ yyreduce: case 67: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 498 "glcpp/glcpp-parse.y" { (yyval.token) = _token_create_str (parser, INTEGER_STRING, (yyvsp[(1) - (1)].str)); @@ -2404,7 +2396,7 @@ yyreduce: case 68: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 502 "glcpp/glcpp-parse.y" { (yyval.token) = _token_create_ival (parser, (yyvsp[(1) - (1)].ival), (yyvsp[(1) - (1)].ival)); @@ -2414,7 +2406,7 @@ yyreduce: case 69: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 506 "glcpp/glcpp-parse.y" { (yyval.token) = _token_create_str (parser, OTHER, (yyvsp[(1) - (1)].str)); @@ -2424,7 +2416,7 @@ yyreduce: case 70: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 510 "glcpp/glcpp-parse.y" { (yyval.token) = _token_create_ival (parser, SPACE, SPACE); @@ -2434,225 +2426,225 @@ yyreduce: case 71: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 517 "glcpp/glcpp-parse.y" { (yyval.ival) = '['; ;} break; case 72: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 518 "glcpp/glcpp-parse.y" { (yyval.ival) = ']'; ;} break; case 73: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 519 "glcpp/glcpp-parse.y" { (yyval.ival) = '('; ;} break; case 74: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 520 "glcpp/glcpp-parse.y" { (yyval.ival) = ')'; ;} break; case 75: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 521 "glcpp/glcpp-parse.y" { (yyval.ival) = '{'; ;} break; case 76: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 522 "glcpp/glcpp-parse.y" { (yyval.ival) = '}'; ;} break; case 77: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 523 "glcpp/glcpp-parse.y" { (yyval.ival) = '.'; ;} break; case 78: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 524 "glcpp/glcpp-parse.y" { (yyval.ival) = '&'; ;} break; case 79: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 525 "glcpp/glcpp-parse.y" { (yyval.ival) = '*'; ;} break; case 80: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 526 "glcpp/glcpp-parse.y" { (yyval.ival) = '+'; ;} break; case 81: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 527 "glcpp/glcpp-parse.y" { (yyval.ival) = '-'; ;} break; case 82: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 528 "glcpp/glcpp-parse.y" { (yyval.ival) = '~'; ;} break; case 83: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 529 "glcpp/glcpp-parse.y" { (yyval.ival) = '!'; ;} break; case 84: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 530 "glcpp/glcpp-parse.y" { (yyval.ival) = '/'; ;} break; case 85: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 531 "glcpp/glcpp-parse.y" { (yyval.ival) = '%'; ;} break; case 86: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 532 "glcpp/glcpp-parse.y" { (yyval.ival) = LEFT_SHIFT; ;} break; case 87: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 533 "glcpp/glcpp-parse.y" { (yyval.ival) = RIGHT_SHIFT; ;} break; case 88: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 534 "glcpp/glcpp-parse.y" { (yyval.ival) = '<'; ;} break; case 89: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 535 "glcpp/glcpp-parse.y" { (yyval.ival) = '>'; ;} break; case 90: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 536 "glcpp/glcpp-parse.y" { (yyval.ival) = LESS_OR_EQUAL; ;} break; case 91: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 537 "glcpp/glcpp-parse.y" { (yyval.ival) = GREATER_OR_EQUAL; ;} break; case 92: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 538 "glcpp/glcpp-parse.y" { (yyval.ival) = EQUAL; ;} break; case 93: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 539 "glcpp/glcpp-parse.y" { (yyval.ival) = NOT_EQUAL; ;} break; case 94: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 540 "glcpp/glcpp-parse.y" { (yyval.ival) = '^'; ;} break; case 95: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 541 "glcpp/glcpp-parse.y" { (yyval.ival) = '|'; ;} break; case 96: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 542 "glcpp/glcpp-parse.y" { (yyval.ival) = AND; ;} break; case 97: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 543 "glcpp/glcpp-parse.y" { (yyval.ival) = OR; ;} break; case 98: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 544 "glcpp/glcpp-parse.y" { (yyval.ival) = ';'; ;} break; case 99: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 545 "glcpp/glcpp-parse.y" { (yyval.ival) = ','; ;} break; case 100: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 546 "glcpp/glcpp-parse.y" { (yyval.ival) = '='; ;} break; case 101: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 547 "glcpp/glcpp-parse.y" { (yyval.ival) = PASTE; ;} break; -/* Line 1464 of yacc.c */ -#line 2656 "glcpp/glcpp-parse.c" +/* Line 1455 of yacc.c */ +#line 2648 "glcpp/glcpp-parse.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -2724,7 +2716,7 @@ yyerrlab: #endif } - yyerror_range[1] = yylloc; + yyerror_range[0] = yylloc; if (yyerrstatus == 3) { @@ -2761,7 +2753,7 @@ yyerrorlab: if (/*CONSTCOND*/ 0) goto yyerrorlab; - yyerror_range[1] = yylsp[1-yylen]; + yyerror_range[0] = yylsp[1-yylen]; /* Do not reclaim the symbols of the rule which action triggered this YYERROR. */ YYPOPSTACK (yylen); @@ -2795,7 +2787,7 @@ yyerrlab1: if (yyssp == yyss) YYABORT; - yyerror_range[1] = *yylsp; + yyerror_range[0] = *yylsp; yydestruct ("Error: popping", yystos[yystate], yyvsp, yylsp, parser); YYPOPSTACK (1); @@ -2805,10 +2797,10 @@ yyerrlab1: *++yyvsp = yylval; - yyerror_range[2] = yylloc; + yyerror_range[1] = yylloc; /* Using YYLLOC is tempting, but would change the location of the lookahead. YYLOC is available though. */ - YYLLOC_DEFAULT (yyloc, yyerror_range, 2); + YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2); *++yylsp = yyloc; /* Shift the error token. */ @@ -2870,7 +2862,7 @@ yyreturn: -/* Line 1684 of yacc.c */ +/* Line 1675 of yacc.c */ #line 550 "glcpp/glcpp-parse.y" @@ -3419,6 +3411,9 @@ glcpp_parser_create (const struct gl_extensions *extensions, int api) if (extensions->ARB_fragment_coord_conventions) add_builtin_define(parser, "GL_ARB_fragment_coord_conventions", 1); + + if (extensions->ARB_explicit_attrib_location) + add_builtin_define(parser, "GL_ARB_explicit_attrib_location", 1); } language_version = 110; diff --git a/src/glsl/glcpp/glcpp-parse.h b/src/glsl/glcpp/glcpp-parse.h index 40556854f3..50758930e9 100644 --- a/src/glsl/glcpp/glcpp-parse.h +++ b/src/glsl/glcpp/glcpp-parse.h @@ -1,9 +1,10 @@ -/* A Bison parser, made by GNU Bison 2.4.3. */ + +/* A Bison parser, made by GNU Bison 2.4.1. */ /* Skeleton interface for Bison's Yacc-like parsers in C - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006, - 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + 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 -- cgit v1.2.3 From 3322fbaf3b5e305ce00c1d08c26965bb98e0cef0 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 14 Oct 2010 13:28:42 -0700 Subject: glsl: Slightly change the semantic of _LinkedShaders Previously _LinkedShaders was a compact array of the linked shaders for each shader stage. Now it is arranged such that each slot, indexed by the MESA_SHADER_* defines, refers to a specific shader stage. As a result, some slots will be NULL. This makes things a little more complex in the linker, but it simplifies things in other places. As a side effect _NumLinkedShaders is removed. NOTE: This may be a candidate for the 7.9 branch. If there are other patches that get backported to 7.9 that use _LinkedShader, this patch should be cherry picked also. --- src/glsl/glcpp/glcpp.c | 8 +++ src/glsl/linker.cpp | 83 ++++++++++++++++++++++++-------- src/glsl/main.cpp | 13 ++++- src/mesa/drivers/dri/i965/brw_fs.cpp | 17 ++----- src/mesa/drivers/dri/i965/brw_program.c | 12 ++--- src/mesa/drivers/dri/i965/brw_wm_state.c | 13 ++--- src/mesa/main/context.c | 22 ++++----- src/mesa/main/mtypes.h | 9 ++-- src/mesa/main/shaderobj.c | 8 +-- src/mesa/program/ir_to_mesa.cpp | 16 ++++-- 10 files changed, 129 insertions(+), 72 deletions(-) (limited to 'src/glsl/glcpp') diff --git a/src/glsl/glcpp/glcpp.c b/src/glsl/glcpp/glcpp.c index 8d1ced571b..062eb6b72d 100644 --- a/src/glsl/glcpp/glcpp.c +++ b/src/glsl/glcpp/glcpp.c @@ -29,9 +29,17 @@ #include #include "glcpp.h" #include "main/mtypes.h" +#include "main/shaderobj.h" extern int yydebug; +void +_mesa_reference_shader(struct gl_context *ctx, struct gl_shader **ptr, + struct gl_shader *sh) +{ + *ptr = sh; +} + /* Read from fd until EOF and return a string of everything read. */ static char * diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index db1b76b371..ffff08b17b 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -80,6 +80,10 @@ extern "C" { #include "linker.h" #include "ir_optimization.h" +extern "C" { +#include "main/shaderobj.h" +} + /** * Visitor that determines whether or not a variable is ever written. */ @@ -321,6 +325,9 @@ cross_validate_globals(struct gl_shader_program *prog, */ glsl_symbol_table variables; for (unsigned i = 0; i < num_shaders; i++) { + if (shader_list[i] == NULL) + continue; + foreach_list(node, shader_list[i]->ir) { ir_variable *const var = ((ir_instruction *) node)->as_variable(); @@ -420,7 +427,7 @@ bool cross_validate_uniforms(struct gl_shader_program *prog) { return cross_validate_globals(prog, prog->_LinkedShaders, - prog->_NumLinkedShaders, true); + MESA_SHADER_TYPES, true); } @@ -876,7 +883,10 @@ struct uniform_node { static void update_array_sizes(struct gl_shader_program *prog) { - for (unsigned i = 0; i < prog->_NumLinkedShaders; i++) { + for (unsigned i = 0; i < MESA_SHADER_TYPES; i++) { + if (prog->_LinkedShaders[i] == NULL) + continue; + foreach_list(node, prog->_LinkedShaders[i]->ir) { ir_variable *const var = ((ir_instruction *) node)->as_variable(); @@ -887,7 +897,10 @@ update_array_sizes(struct gl_shader_program *prog) continue; unsigned int size = var->max_array_access; - for (unsigned j = 0; j < prog->_NumLinkedShaders; j++) { + for (unsigned j = 0; j < MESA_SHADER_TYPES; j++) { + if (prog->_LinkedShaders[j] == NULL) + continue; + foreach_list(node2, prog->_LinkedShaders[j]->ir) { ir_variable *other_var = ((ir_instruction *) node2)->as_variable(); if (!other_var) @@ -999,7 +1012,10 @@ assign_uniform_locations(struct gl_shader_program *prog) hash_table_string_compare); void *mem_ctx = talloc_new(NULL); - for (unsigned i = 0; i < prog->_NumLinkedShaders; i++) { + for (unsigned i = 0; i < MESA_SHADER_TYPES; i++) { + if (prog->_LinkedShaders[i] == NULL) + continue; + unsigned next_position = 0; foreach_list(node, prog->_LinkedShaders[i]->ir) { @@ -1449,13 +1465,15 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog) prog->Version = max_version; - for (unsigned int i = 0; i < prog->_NumLinkedShaders; i++) { - ctx->Driver.DeleteShader(ctx, prog->_LinkedShaders[i]); + for (unsigned int i = 0; i < MESA_SHADER_TYPES; i++) { + if (prog->_LinkedShaders[i] != NULL) + ctx->Driver.DeleteShader(ctx, prog->_LinkedShaders[i]); + + prog->_LinkedShaders[i] = NULL; } /* Link all shaders for a particular stage and validate the result. */ - prog->_NumLinkedShaders = 0; if (num_vert_shaders > 0) { gl_shader *const sh = link_intrastage_shaders(ctx, prog, vert_shader_list, num_vert_shaders); @@ -1466,8 +1484,8 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog) if (!validate_vertex_shader_executable(prog, sh)) goto done; - prog->_LinkedShaders[prog->_NumLinkedShaders] = sh; - prog->_NumLinkedShaders++; + _mesa_reference_shader(ctx, &prog->_LinkedShaders[MESA_SHADER_VERTEX], + sh); } if (num_frag_shaders > 0) { @@ -1480,8 +1498,8 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog) if (!validate_fragment_shader_executable(prog, sh)) goto done; - prog->_LinkedShaders[prog->_NumLinkedShaders] = sh; - prog->_NumLinkedShaders++; + _mesa_reference_shader(ctx, &prog->_LinkedShaders[MESA_SHADER_FRAGMENT], + sh); } /* Here begins the inter-stage linking phase. Some initial validation is @@ -1489,14 +1507,26 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog) * varyings. */ if (cross_validate_uniforms(prog)) { + unsigned prev; + + for (prev = 0; prev < MESA_SHADER_TYPES; prev++) { + if (prog->_LinkedShaders[prev] != NULL) + break; + } + /* Validate the inputs of each stage with the output of the preceeding * stage. */ - for (unsigned i = 1; i < prog->_NumLinkedShaders; i++) { + for (unsigned i = prev + 1; i < MESA_SHADER_TYPES; i++) { + if (prog->_LinkedShaders[i] == NULL) + continue; + if (!cross_validate_outputs_to_inputs(prog, - prog->_LinkedShaders[i - 1], + prog->_LinkedShaders[prev], prog->_LinkedShaders[i])) goto done; + + prev = i; } prog->LinkStatus = true; @@ -1506,7 +1536,10 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog) * uniforms, and varyings. Later optimization could possibly make * some of that unused. */ - for (unsigned i = 0; i < prog->_NumLinkedShaders; i++) { + for (unsigned i = 0; i < MESA_SHADER_TYPES; i++) { + if (prog->_LinkedShaders[i] == NULL) + continue; + while (do_common_optimization(prog->_LinkedShaders[i]->ir, true, 32)) ; } @@ -1515,7 +1548,7 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog) assign_uniform_locations(prog); - if (prog->_NumLinkedShaders && prog->_LinkedShaders[0]->Type == GL_VERTEX_SHADER) { + if (prog->_LinkedShaders[MESA_SHADER_VERTEX] != NULL) { /* FINISHME: The value of the max_attribute_index parameter is * FINISHME: implementation dependent based on the value of * FINISHME: GL_MAX_VERTEX_ATTRIBS. GL_MAX_VERTEX_ATTRIBS must be @@ -1526,14 +1559,26 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog) goto done; } - if (prog->_NumLinkedShaders == 1) - demote_unread_shader_outputs(prog->_LinkedShaders[0]); + if ((prog->_LinkedShaders[MESA_SHADER_GEOMETRY] == NULL) + && (prog->_LinkedShaders[MESA_SHADER_FRAGMENT] == NULL)) + demote_unread_shader_outputs(prog->_LinkedShaders[MESA_SHADER_VERTEX]); } - for (unsigned i = 1; i < prog->_NumLinkedShaders; i++) + unsigned prev; + for (prev = 0; prev < MESA_SHADER_TYPES; prev++) { + if (prog->_LinkedShaders[prev] != NULL) + break; + } + + for (unsigned i = prev + 1; i < MESA_SHADER_TYPES; i++) { + if (prog->_LinkedShaders[i] == NULL) + continue; + assign_varying_locations(prog, - prog->_LinkedShaders[i - 1], + prog->_LinkedShaders[prev], prog->_LinkedShaders[i]); + prev = i; + } /* FINISHME: Assign fragment shader output locations. */ diff --git a/src/glsl/main.cpp b/src/glsl/main.cpp index 9350592196..08a44c96e5 100644 --- a/src/glsl/main.cpp +++ b/src/glsl/main.cpp @@ -40,8 +40,19 @@ extern "C" struct gl_shader * _mesa_new_shader(struct gl_context *ctx, GLuint name, GLenum type); +extern "C" void +_mesa_reference_shader(struct gl_context *ctx, struct gl_shader **ptr, + struct gl_shader *sh); + /* Copied from shader_api.c for the stand-alone compiler. */ +void +_mesa_reference_shader(struct gl_context *ctx, struct gl_shader **ptr, + struct gl_shader *sh) +{ + *ptr = sh; +} + struct gl_shader * _mesa_new_shader(struct gl_context *ctx, GLuint name, GLenum type) { @@ -319,7 +330,7 @@ main(int argc, char **argv) printf("Info log for linking:\n%s\n", whole_program->InfoLog); } - for (unsigned i = 0; i < whole_program->_NumLinkedShaders; i++) + for (unsigned i = 0; i < MESA_SHADER_TYPES; i++) talloc_free(whole_program->_LinkedShaders[i]); talloc_free(whole_program); diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 41cb9a3be4..4745b87f13 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -91,10 +91,9 @@ brw_link_shader(struct gl_context *ctx, struct gl_shader_program *prog) { struct intel_context *intel = intel_context(ctx); - for (unsigned i = 0; i < prog->_NumLinkedShaders; i++) { - struct brw_shader *shader = (struct brw_shader *)prog->_LinkedShaders[i]; - - if (shader->base.Type == GL_FRAGMENT_SHADER) { + struct brw_shader *shader = + (struct brw_shader *)prog->_LinkedShaders[MESA_SHADER_FRAGMENT]; + if (shader != NULL) { void *mem_ctx = talloc_new(NULL); bool progress; @@ -142,7 +141,6 @@ brw_link_shader(struct gl_context *ctx, struct gl_shader_program *prog) reparent_ir(shader->ir, shader->ir); talloc_free(mem_ctx); - } } if (!_mesa_ir_link_shader(ctx, prog)) @@ -3182,18 +3180,13 @@ brw_wm_fs_emit(struct brw_context *brw, struct brw_wm_compile *c) struct brw_compile *p = &c->func; struct intel_context *intel = &brw->intel; struct gl_context *ctx = &intel->ctx; - struct brw_shader *shader = NULL; struct gl_shader_program *prog = ctx->Shader.CurrentProgram; if (!prog) return GL_FALSE; - for (unsigned int i = 0; i < prog->_NumLinkedShaders; i++) { - if (prog->_LinkedShaders[i]->Type == GL_FRAGMENT_SHADER) { - shader = (struct brw_shader *)prog->_LinkedShaders[i]; - break; - } - } + struct brw_shader *shader = + (brw_shader *) prog->_LinkedShaders[MESA_SHADER_FRAGMENT]; if (!shader) return GL_FALSE; diff --git a/src/mesa/drivers/dri/i965/brw_program.c b/src/mesa/drivers/dri/i965/brw_program.c index 8bc255a1c0..1367d81469 100644 --- a/src/mesa/drivers/dri/i965/brw_program.c +++ b/src/mesa/drivers/dri/i965/brw_program.c @@ -148,15 +148,9 @@ static GLboolean brwProgramStringNotify( struct gl_context *ctx, * using the new FS backend. */ shader_program = _mesa_lookup_shader_program(ctx, prog->Id); - if (shader_program) { - for (i = 0; i < shader_program->_NumLinkedShaders; i++) { - struct brw_shader *shader; - - shader = (struct brw_shader *)shader_program->_LinkedShaders[i]; - if (shader->base.Type == GL_FRAGMENT_SHADER && shader->ir) { - return GL_TRUE; - } - } + if (shader_program + && shader_program->_LinkedShaders[MESA_SHADER_FRAGMENT]) { + return GL_TRUE; } } else if (target == GL_VERTEX_PROGRAM_ARB) { diff --git a/src/mesa/drivers/dri/i965/brw_wm_state.c b/src/mesa/drivers/dri/i965/brw_wm_state.c index 8cadedadfd..817adefb0c 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_state.c @@ -108,16 +108,11 @@ wm_unit_populate_key(struct brw_context *brw, struct brw_wm_unit_key *key) * 8-wide. */ if (ctx->Shader.CurrentProgram) { - int i; + struct brw_shader *shader = (struct brw_shader *) + ctx->Shader.CurrentProgram->_LinkedShaders[MESA_SHADER_FRAGMENT]; - for (i = 0; i < ctx->Shader.CurrentProgram->_NumLinkedShaders; i++) { - struct brw_shader *shader = - (struct brw_shader *)ctx->Shader.CurrentProgram->_LinkedShaders[i];; - - if (shader->base.Type == GL_FRAGMENT_SHADER && - shader->ir != NULL) { - key->is_glsl = GL_TRUE; - } + if (shader != NULL && shader->ir != NULL) { + key->is_glsl = GL_TRUE; } } diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 10166ae5a2..1625e4c501 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1702,10 +1702,10 @@ _mesa_valid_to_render(struct gl_context *ctx, const char *where) _mesa_update_state(ctx); if (ctx->Shader.CurrentProgram) { - unsigned i; + struct gl_shader_program *const prog = ctx->Shader.CurrentProgram; /* using shaders */ - if (!ctx->Shader.CurrentProgram->LinkStatus) { + if (!prog->LinkStatus) { _mesa_error(ctx, GL_INVALID_OPERATION, "%s(shader not linked)", where); return GL_FALSE; @@ -1713,10 +1713,9 @@ _mesa_valid_to_render(struct gl_context *ctx, const char *where) #if 0 /* not normally enabled */ { char errMsg[100]; - if (!_mesa_validate_shader_program(ctx, ctx->Shader.CurrentProgram, - errMsg)) { + if (!_mesa_validate_shader_program(ctx, prog, errMsg)) { _mesa_warning(ctx, "Shader program %u is invalid: %s", - ctx->Shader.CurrentProgram->Name, errMsg); + prog->Name, errMsg); } } #endif @@ -1725,13 +1724,12 @@ _mesa_valid_to_render(struct gl_context *ctx, const char *where) * any stages that are not provided, the corresponding assembly shader * target will be validated below. */ - for (i = 0; i < ctx->Shader.CurrentProgram->_NumLinkedShaders; i++) { - switch (ctx->Shader.CurrentProgram->_LinkedShaders[i]->Type) { - case GL_VERTEX_SHADER: vert_from_glsl_shader = true; break; - case GL_GEOMETRY_SHADER_ARB: geom_from_glsl_shader = true; break; - case GL_FRAGMENT_SHADER: frag_from_glsl_shader = true; break; - } - } + vert_from_glsl_shader = + prog->_LinkedShaders[MESA_SHADER_VERTEX] != NULL; + geom_from_glsl_shader = + prog->_LinkedShaders[MESA_SHADER_GEOMETRY] != NULL; + frag_from_glsl_shader = + prog->_LinkedShaders[MESA_SHADER_FRAGMENT] != NULL; } diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 6702032679..13aa66fc1e 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2117,11 +2117,12 @@ struct gl_shader_program /** * Per-stage shaders resulting from the first stage of linking. + * + * Set of linked shaders for this program. The array is accessed using the + * \c MESA_SHADER_* defines. Entries for non-existent stages will be + * \c NULL. */ - /*@{*/ - GLuint _NumLinkedShaders; - struct gl_shader *_LinkedShaders[2]; - /*@}*/ + struct gl_shader *_LinkedShaders[MESA_SHADER_TYPES]; }; diff --git a/src/mesa/main/shaderobj.c b/src/mesa/main/shaderobj.c index e0ffa2f289..b6594cbe6f 100644 --- a/src/mesa/main/shaderobj.c +++ b/src/mesa/main/shaderobj.c @@ -326,10 +326,12 @@ _mesa_free_shader_program_data(struct gl_context *ctx, shProg->TransformFeedback.NumVarying = 0; - for (i = 0; i < shProg->_NumLinkedShaders; i++) { - ctx->Driver.DeleteShader(ctx, shProg->_LinkedShaders[i]); + for (i = 0; i < MESA_SHADER_TYPES; i++) { + if (shProg->_LinkedShaders[i] != NULL) { + ctx->Driver.DeleteShader(ctx, shProg->_LinkedShaders[i]); + shProg->_LinkedShaders[i] = NULL; + } } - shProg->_NumLinkedShaders = 0; } diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index 524130ca59..bdd3fd92ff 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -2238,8 +2238,12 @@ set_uniform_initializers(struct gl_context *ctx, { void *mem_ctx = NULL; - for (unsigned int i = 0; i < shader_program->_NumLinkedShaders; i++) { + for (unsigned int i = 0; i < MESA_SHADER_TYPES; i++) { struct gl_shader *shader = shader_program->_LinkedShaders[i]; + + if (shader == NULL) + continue; + foreach_iter(exec_list_iterator, iter, *shader->ir) { ir_instruction *ir = (ir_instruction *)iter.get(); ir_variable *var = ir->as_variable(); @@ -2467,7 +2471,10 @@ _mesa_ir_link_shader(struct gl_context *ctx, struct gl_shader_program *prog) { assert(prog->LinkStatus); - for (unsigned i = 0; i < prog->_NumLinkedShaders; i++) { + for (unsigned i = 0; i < MESA_SHADER_TYPES; i++) { + if (prog->_LinkedShaders[i] == NULL) + continue; + bool progress; exec_list *ir = prog->_LinkedShaders[i]->ir; const struct gl_shader_compiler_options *options = @@ -2511,10 +2518,13 @@ _mesa_ir_link_shader(struct gl_context *ctx, struct gl_shader_program *prog) validate_ir_tree(ir); } - for (unsigned i = 0; i < prog->_NumLinkedShaders; i++) { + for (unsigned i = 0; i < MESA_SHADER_TYPES; i++) { struct gl_program *linked_prog; bool ok = true; + if (prog->_LinkedShaders[i] == NULL) + continue; + linked_prog = get_mesa_program(ctx, prog, prog->_LinkedShaders[i]); switch (prog->_LinkedShaders[i]->Type) { -- cgit v1.2.3