2 /* A Bison parser, made by GNU Bison 2.4.1. */
4 /* Skeleton implementation for Bison's Yacc-like parsers in C
6 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
7 Free Software Foundation, Inc.
9 This program is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>. */
22 /* As a special exception, you may create a larger work that contains
23 part or all of the Bison parser skeleton and distribute that work
24 under terms of your choice, so long as that work isn't itself a
25 parser generator using the skeleton or a modified version thereof
26 as a parser skeleton. Alternatively, if you modify or redistribute
27 the parser skeleton itself, you may (at your option) remove this
28 special exception, which will cause the skeleton and the resulting
29 Bison output files to be licensed under the GNU General Public
30 License without this special exception.
32 This special exception was added by the Free Software Foundation in
33 version 2.2 of Bison. */
35 /* C LALR(1) parser skeleton written by Richard Stallman, by
36 simplifying the original so-called "semantic" parser. */
38 /* All symbols defined below should begin with yy or YY, to avoid
39 infringing on user name space. This should be done even for local
40 variables, as they might otherwise be expanded by user macros.
41 There are some unavoidable exceptions within include files to
42 define necessary library symbols; they are noted "INFRINGES ON
43 USER NAME SPACE" below. */
45 /* Identify Bison output. */
49 #define YYBISON_VERSION "2.4.1"
52 #define YYSKELETON_NAME "yacc.c"
63 /* Using locations. */
64 #define YYLSP_NEEDED 1
68 /* Copy the first part of user declarations. */
70 /* Line 189 of yacc.c */
71 #line 1 "program_parse.y"
74 * Copyright © 2009 Intel Corporation
76 * Permission is hereby granted, free of charge, to any person obtaining a
77 * copy of this software and associated documentation files (the "Software"),
78 * to deal in the Software without restriction, including without limitation
79 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
80 * and/or sell copies of the Software, and to permit persons to whom the
81 * Software is furnished to do so, subject to the following conditions:
83 * The above copyright notice and this permission notice (including the next
84 * paragraph) shall be included in all copies or substantial portions of the
87 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
88 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
89 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
90 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
91 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
93 * DEALINGS IN THE SOFTWARE.
99 #include "main/mtypes.h"
100 #include "main/imports.h"
102 #include "prog_parameter.h"
103 #include "prog_parameter_layout.h"
104 #include "prog_statevars.h"
105 #include "prog_instruction.h"
107 #include "symbol_table.h"
108 #include "program_parser.h"
110 extern void *yy_scan_string(char *);
111 extern void yy_delete_buffer(void *);
113 static struct asm_symbol
*declare_variable(struct asm_parser_state
*state
,
114 char *name
, enum asm_type t
, struct YYLTYPE
*locp
);
116 static int add_state_reference(struct gl_program_parameter_list
*param_list
,
117 const gl_state_index tokens
[STATE_LENGTH
]);
119 static int initialize_symbol_from_state(struct gl_program
*prog
,
120 struct asm_symbol
*param_var
, const gl_state_index tokens
[STATE_LENGTH
]);
122 static int initialize_symbol_from_param(struct gl_program
*prog
,
123 struct asm_symbol
*param_var
, const gl_state_index tokens
[STATE_LENGTH
]);
125 static int initialize_symbol_from_const(struct gl_program
*prog
,
126 struct asm_symbol
*param_var
, const struct asm_vector
*vec
);
128 static int yyparse(struct asm_parser_state
*state
);
130 static char *make_error_string(const char *fmt
, ...);
132 static void yyerror(struct YYLTYPE
*locp
, struct asm_parser_state
*state
,
135 static int validate_inputs(struct YYLTYPE
*locp
,
136 struct asm_parser_state
*state
);
138 static void init_dst_reg(struct prog_dst_register
*r
);
140 static void init_src_reg(struct asm_src_register
*r
);
142 static void asm_instruction_set_operands(struct asm_instruction
*inst
,
143 const struct prog_dst_register
*dst
, const struct asm_src_register
*src0
,
144 const struct asm_src_register
*src1
, const struct asm_src_register
*src2
);
146 static struct asm_instruction
*asm_instruction_ctor(gl_inst_opcode op
,
147 const struct prog_dst_register
*dst
, const struct asm_src_register
*src0
,
148 const struct asm_src_register
*src1
, const struct asm_src_register
*src2
);
150 static struct asm_instruction
*asm_instruction_copy_ctor(
151 const struct prog_instruction
*base
, const struct prog_dst_register
*dst
,
152 const struct asm_src_register
*src0
, const struct asm_src_register
*src1
,
153 const struct asm_src_register
*src2
);
157 #define TRUE (!FALSE)
160 #define YYLLOC_DEFAULT(Current, Rhs, N) \
163 (Current).first_line = YYRHSLOC(Rhs, 1).first_line; \
164 (Current).first_column = YYRHSLOC(Rhs, 1).first_column; \
165 (Current).position = YYRHSLOC(Rhs, 1).position; \
166 (Current).last_line = YYRHSLOC(Rhs, N).last_line; \
167 (Current).last_column = YYRHSLOC(Rhs, N).last_column; \
169 (Current).first_line = YYRHSLOC(Rhs, 0).last_line; \
170 (Current).last_line = (Current).first_line; \
171 (Current).first_column = YYRHSLOC(Rhs, 0).last_column; \
172 (Current).last_column = (Current).first_column; \
173 (Current).position = YYRHSLOC(Rhs, 0).position \
174 + (Current).first_column; \
178 #define YYLEX_PARAM state->scanner
181 /* Line 189 of yacc.c */
182 #line 183 "program_parse.tab.c"
184 /* Enabling traces. */
189 /* Enabling verbose error messages. */
190 #ifdef YYERROR_VERBOSE
191 # undef YYERROR_VERBOSE
192 # define YYERROR_VERBOSE 1
194 # define YYERROR_VERBOSE 1
197 /* Enabling the token table. */
198 #ifndef YYTOKEN_TABLE
199 # define YYTOKEN_TABLE 0
206 /* Put the tokens into the symbol table, so that GDB and other debuggers
297 TEX_SHADOWRECT
= 346,
300 TEX_ARRAYSHADOW1D
= 349,
301 TEX_ARRAYSHADOW2D
= 350,
318 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
319 typedef union YYSTYPE
322 /* Line 214 of yacc.c */
323 #line 116 "program_parse.y"
325 struct asm_instruction
*inst
;
326 struct asm_symbol
*sym
;
327 struct asm_symbol temp_sym
;
328 struct asm_swizzle_mask swiz_mask
;
329 struct asm_src_register src_reg
;
330 struct prog_dst_register dst_reg
;
331 struct prog_instruction temp_inst
;
339 struct asm_vector vector
;
340 gl_inst_opcode opcode
;
344 unsigned rgba_valid
:1;
345 unsigned xyzw_valid
:1;
351 /* Line 214 of yacc.c */
352 #line 353 "program_parse.tab.c"
354 # define YYSTYPE_IS_TRIVIAL 1
355 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
356 # define YYSTYPE_IS_DECLARED 1
359 #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
360 typedef struct YYLTYPE
367 # define yyltype YYLTYPE /* obsolescent; will be withdrawn */
368 # define YYLTYPE_IS_DECLARED 1
369 # define YYLTYPE_IS_TRIVIAL 1
373 /* Copy the second part of user declarations. */
375 /* Line 264 of yacc.c */
376 #line 258 "program_parse.y"
378 extern int yylex(YYSTYPE
*yylval_param
, YYLTYPE
*yylloc_param
,
382 /* Line 264 of yacc.c */
383 #line 384 "program_parse.tab.c"
390 typedef YYTYPE_UINT8 yytype_uint8
;
392 typedef unsigned char yytype_uint8
;
396 typedef YYTYPE_INT8 yytype_int8
;
397 #elif (defined __STDC__ || defined __C99__FUNC__ \
398 || defined __cplusplus || defined _MSC_VER)
399 typedef signed char yytype_int8
;
401 typedef short int yytype_int8
;
405 typedef YYTYPE_UINT16 yytype_uint16
;
407 typedef unsigned short int yytype_uint16
;
411 typedef YYTYPE_INT16 yytype_int16
;
413 typedef short int yytype_int16
;
417 # ifdef __SIZE_TYPE__
418 # define YYSIZE_T __SIZE_TYPE__
419 # elif defined size_t
420 # define YYSIZE_T size_t
421 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
422 || defined __cplusplus || defined _MSC_VER)
423 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
424 # define YYSIZE_T size_t
426 # define YYSIZE_T unsigned int
430 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
435 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
436 # define YY_(msgid) dgettext ("bison-runtime", msgid)
440 # define YY_(msgid) msgid
444 /* Suppress unused-variable warnings by "using" E. */
445 #if ! defined lint || defined __GNUC__
446 # define YYUSE(e) ((void) (e))
448 # define YYUSE(e) /* empty */
451 /* Identity function, used to suppress warnings about constant conditions. */
455 #if (defined __STDC__ || defined __C99__FUNC__ \
456 || defined __cplusplus || defined _MSC_VER)
469 #if ! defined yyoverflow || YYERROR_VERBOSE
471 /* The parser invokes alloca or malloc; define the necessary symbols. */
473 # ifdef YYSTACK_USE_ALLOCA
474 # if YYSTACK_USE_ALLOCA
476 # define YYSTACK_ALLOC __builtin_alloca
477 # elif defined __BUILTIN_VA_ARG_INCR
478 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
480 # define YYSTACK_ALLOC __alloca
481 # elif defined _MSC_VER
482 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
483 # define alloca _alloca
485 # define YYSTACK_ALLOC alloca
486 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
487 || defined __cplusplus || defined _MSC_VER)
488 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
497 # ifdef YYSTACK_ALLOC
498 /* Pacify GCC's `empty if-body' warning. */
499 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
500 # ifndef YYSTACK_ALLOC_MAXIMUM
501 /* The OS might guarantee only one guard page at the bottom of the stack,
502 and a page size can be as small as 4096 bytes. So we cannot safely
503 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
504 to allow for a few compiler-allocated temporary stack slots. */
505 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
508 # define YYSTACK_ALLOC YYMALLOC
509 # define YYSTACK_FREE YYFREE
510 # ifndef YYSTACK_ALLOC_MAXIMUM
511 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
513 # if (defined __cplusplus && ! defined _STDLIB_H \
514 && ! ((defined YYMALLOC || defined malloc) \
515 && (defined YYFREE || defined free)))
516 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
522 # define YYMALLOC malloc
523 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
524 || defined __cplusplus || defined _MSC_VER)
525 void *malloc (YYSIZE_T
); /* INFRINGES ON USER NAME SPACE */
530 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
531 || defined __cplusplus || defined _MSC_VER)
532 void free (void *); /* INFRINGES ON USER NAME SPACE */
536 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
539 #if (! defined yyoverflow \
540 && (! defined __cplusplus \
541 || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \
542 && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
544 /* A type that is properly aligned for any stack member. */
547 yytype_int16 yyss_alloc
;
552 /* The size of the maximum gap between one aligned stack and the next. */
553 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
555 /* The size of an array large to enough to hold all stacks, each with
557 # define YYSTACK_BYTES(N) \
558 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
559 + 2 * YYSTACK_GAP_MAXIMUM)
561 /* Copy COUNT objects from FROM to TO. The source and destination do
564 # if defined __GNUC__ && 1 < __GNUC__
565 # define YYCOPY(To, From, Count) \
566 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
568 # define YYCOPY(To, From, Count) \
572 for (yyi = 0; yyi < (Count); yyi++) \
573 (To)[yyi] = (From)[yyi]; \
579 /* Relocate STACK from its old location to the new one. The
580 local variables YYSIZE and YYSTACKSIZE give the old and new number of
581 elements in the stack, and YYPTR gives the new location of the
582 stack. Advance YYPTR to a properly aligned location for the next
584 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
587 YYSIZE_T yynewbytes; \
588 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
589 Stack = &yyptr->Stack_alloc; \
590 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
591 yyptr += yynewbytes / sizeof (*yyptr); \
597 /* YYFINAL -- State number of the termination state. */
599 /* YYLAST -- Last index in YYTABLE. */
602 /* YYNTOKENS -- Number of terminals. */
603 #define YYNTOKENS 117
604 /* YYNNTS -- Number of nonterminals. */
606 /* YYNRULES -- Number of rules. */
608 /* YYNRULES -- Number of states. */
609 #define YYNSTATES 456
611 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
613 #define YYMAXUTOK 361
615 #define YYTRANSLATE(YYX) \
616 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
618 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
619 static const yytype_uint8 yytranslate
[] =
621 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
622 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
623 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
624 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
625 2, 2, 2, 112, 108, 113, 2, 2, 2, 2,
626 2, 2, 2, 2, 2, 2, 2, 2, 2, 107,
627 2, 114, 2, 2, 2, 2, 2, 2, 2, 2,
628 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
629 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
630 2, 110, 2, 111, 2, 2, 2, 2, 2, 2,
631 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
632 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
633 2, 2, 2, 115, 109, 116, 2, 2, 2, 2,
634 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
635 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
636 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
637 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
638 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
639 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
640 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
641 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
642 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
643 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
644 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
645 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
646 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
647 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
648 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
649 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
650 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
651 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
652 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
653 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
654 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
655 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
656 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
661 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
663 static const yytype_uint16 yyprhs
[] =
665 0, 0, 3, 8, 10, 12, 15, 16, 20, 23,
666 24, 27, 30, 32, 34, 36, 38, 40, 42, 44,
667 46, 48, 50, 52, 54, 59, 64, 69, 76, 83,
668 92, 101, 104, 117, 120, 122, 124, 126, 128, 130,
669 132, 134, 136, 138, 140, 142, 144, 151, 154, 159,
670 162, 164, 168, 174, 177, 180, 188, 191, 193, 195,
671 197, 199, 204, 206, 208, 210, 212, 214, 216, 218,
672 222, 223, 226, 229, 231, 233, 235, 237, 239, 241,
673 243, 245, 247, 248, 250, 252, 254, 256, 257, 259,
674 261, 263, 265, 267, 269, 274, 277, 280, 282, 285,
675 287, 290, 292, 295, 300, 305, 307, 308, 312, 314,
676 316, 319, 321, 324, 326, 328, 332, 339, 340, 342,
677 345, 350, 352, 356, 358, 360, 362, 364, 366, 368,
678 370, 372, 374, 376, 379, 382, 385, 388, 391, 394,
679 397, 400, 403, 406, 409, 412, 416, 418, 420, 422,
680 428, 430, 432, 434, 437, 439, 441, 444, 446, 449,
681 456, 458, 462, 464, 466, 468, 470, 472, 477, 479,
682 481, 483, 485, 487, 489, 492, 494, 496, 502, 504,
683 507, 509, 511, 517, 520, 521, 528, 532, 533, 535,
684 537, 539, 541, 543, 546, 548, 550, 553, 558, 563,
685 564, 566, 568, 570, 572, 575, 577, 579, 581, 583,
686 589, 591, 595, 601, 607, 609, 613, 619, 621, 623,
687 625, 627, 629, 631, 633, 635, 637, 641, 647, 655,
688 665, 668, 671, 673, 675, 676, 677, 681, 682, 686,
689 690, 692, 697, 700, 703, 706, 709, 713, 716, 720,
690 721, 723, 725, 726, 728, 730, 731, 733, 735, 736,
691 738, 740, 741, 745, 746, 750, 751, 755, 757, 759,
695 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
696 static const yytype_int16 yyrhs
[] =
698 118, 0, -1, 119, 120, 122, 12, -1, 3, -1,
699 4, -1, 120, 121, -1, -1, 8, 99, 107, -1,
700 122, 123, -1, -1, 124, 107, -1, 162, 107, -1,
701 125, -1, 126, -1, 127, -1, 128, -1, 129, -1,
702 130, -1, 131, -1, 132, -1, 138, -1, 133, -1,
703 134, -1, 135, -1, 19, 143, 108, 139, -1, 18,
704 142, 108, 141, -1, 16, 142, 108, 139, -1, 14,
705 142, 108, 139, 108, 139, -1, 13, 142, 108, 141,
706 108, 141, -1, 17, 142, 108, 141, 108, 141, 108,
707 141, -1, 15, 142, 108, 141, 108, 136, 108, 137,
708 -1, 20, 141, -1, 22, 142, 108, 141, 108, 141,
709 108, 141, 108, 136, 108, 137, -1, 83, 247, -1,
710 84, -1, 85, -1, 86, -1, 87, -1, 88, -1,
711 89, -1, 90, -1, 91, -1, 92, -1, 93, -1,
712 94, -1, 95, -1, 21, 142, 108, 147, 108, 144,
713 -1, 233, 140, -1, 233, 109, 140, 109, -1, 147,
714 159, -1, 230, -1, 233, 147, 160, -1, 233, 109,
715 147, 160, 109, -1, 148, 161, -1, 156, 158, -1,
716 145, 108, 145, 108, 145, 108, 145, -1, 233, 146,
717 -1, 23, -1, 99, -1, 99, -1, 164, -1, 149,
718 110, 150, 111, -1, 178, -1, 240, -1, 99, -1,
719 99, -1, 151, -1, 152, -1, 23, -1, 156, 157,
720 153, -1, -1, 112, 154, -1, 113, 155, -1, 23,
721 -1, 23, -1, 99, -1, 103, -1, 103, -1, 103,
722 -1, 103, -1, 100, -1, 104, -1, -1, 100, -1,
723 101, -1, 102, -1, 103, -1, -1, 163, -1, 170,
724 -1, 234, -1, 236, -1, 239, -1, 252, -1, 7,
725 99, 114, 164, -1, 96, 165, -1, 38, 169, -1,
726 60, -1, 98, 167, -1, 53, -1, 29, 245, -1,
727 37, -1, 74, 246, -1, 50, 110, 168, 111, -1,
728 97, 110, 166, 111, -1, 23, -1, -1, 110, 168,
729 111, -1, 23, -1, 60, -1, 29, 245, -1, 37,
730 -1, 74, 246, -1, 171, -1, 172, -1, 10, 99,
731 174, -1, 10, 99, 110, 173, 111, 175, -1, -1,
732 23, -1, 114, 177, -1, 114, 115, 176, 116, -1,
733 179, -1, 176, 108, 179, -1, 181, -1, 217, -1,
734 227, -1, 181, -1, 217, -1, 228, -1, 180, -1,
735 218, -1, 227, -1, 181, -1, 73, 205, -1, 73,
736 182, -1, 73, 184, -1, 73, 187, -1, 73, 189,
737 -1, 73, 195, -1, 73, 191, -1, 73, 198, -1,
738 73, 200, -1, 73, 202, -1, 73, 204, -1, 73,
739 216, -1, 47, 244, 183, -1, 193, -1, 33, -1,
740 69, -1, 43, 110, 194, 111, 185, -1, 193, -1,
741 60, -1, 26, -1, 72, 186, -1, 40, -1, 32,
742 -1, 44, 188, -1, 25, -1, 244, 67, -1, 45,
743 110, 194, 111, 244, 190, -1, 193, -1, 75, 248,
744 192, -1, 29, -1, 25, -1, 31, -1, 71, -1,
745 23, -1, 76, 246, 196, 197, -1, 35, -1, 54,
746 -1, 79, -1, 80, -1, 78, -1, 77, -1, 36,
747 199, -1, 29, -1, 56, -1, 28, 110, 201, 111,
748 57, -1, 23, -1, 58, 203, -1, 70, -1, 26,
749 -1, 207, 66, 110, 210, 111, -1, 207, 206, -1,
750 -1, 66, 110, 210, 105, 210, 111, -1, 49, 211,
751 208, -1, -1, 209, -1, 41, -1, 82, -1, 42,
752 -1, 23, -1, 51, 212, -1, 63, -1, 52, -1,
753 81, 246, -1, 55, 110, 214, 111, -1, 48, 110,
754 215, 111, -1, -1, 213, -1, 23, -1, 23, -1,
755 23, -1, 30, 64, -1, 221, -1, 224, -1, 219,
756 -1, 222, -1, 62, 34, 110, 220, 111, -1, 225,
757 -1, 225, 105, 225, -1, 62, 34, 110, 225, 111,
758 -1, 62, 46, 110, 223, 111, -1, 226, -1, 226,
759 105, 226, -1, 62, 46, 110, 226, 111, -1, 23,
760 -1, 23, -1, 229, -1, 231, -1, 230, -1, 231,
761 -1, 232, -1, 24, -1, 23, -1, 115, 232, 116,
762 -1, 115, 232, 108, 232, 116, -1, 115, 232, 108,
763 232, 108, 232, 116, -1, 115, 232, 108, 232, 108,
764 232, 108, 232, 116, -1, 233, 24, -1, 233, 23,
765 -1, 112, -1, 113, -1, -1, -1, 11, 235, 238,
766 -1, -1, 5, 237, 238, -1, 238, 108, 99, -1,
767 99, -1, 9, 99, 114, 240, -1, 65, 60, -1,
768 65, 37, -1, 65, 241, -1, 65, 59, -1, 65,
769 74, 246, -1, 65, 30, -1, 29, 242, 243, -1,
770 -1, 39, -1, 27, -1, -1, 61, -1, 68, -1,
771 -1, 39, -1, 27, -1, -1, 61, -1, 68, -1,
772 -1, 110, 249, 111, -1, -1, 110, 250, 111, -1,
773 -1, 110, 251, 111, -1, 23, -1, 23, -1, 23,
774 -1, 6, 99, 114, 99, -1
777 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
778 static const yytype_uint16 yyrline
[] =
780 0, 265, 265, 268, 276, 288, 289, 292, 314, 315,
781 318, 333, 336, 341, 348, 349, 350, 351, 352, 353,
782 354, 357, 358, 359, 362, 368, 374, 380, 387, 393,
783 400, 444, 451, 495, 501, 502, 503, 504, 505, 506,
784 507, 508, 509, 510, 511, 512, 515, 527, 535, 552,
785 559, 578, 589, 609, 631, 640, 673, 680, 695, 745,
786 787, 798, 819, 829, 835, 866, 883, 883, 885, 892,
787 904, 905, 906, 909, 921, 933, 951, 962, 974, 976,
788 977, 978, 979, 982, 982, 982, 982, 983, 986, 987,
789 988, 989, 990, 991, 994, 1012, 1016, 1022, 1026, 1030,
790 1034, 1043, 1052, 1056, 1061, 1067, 1078, 1078, 1079, 1081,
791 1085, 1089, 1093, 1099, 1099, 1101, 1117, 1140, 1143, 1154,
792 1160, 1166, 1167, 1174, 1180, 1186, 1194, 1200, 1206, 1214,
793 1220, 1226, 1234, 1235, 1238, 1239, 1240, 1241, 1242, 1243,
794 1244, 1245, 1246, 1247, 1248, 1251, 1260, 1264, 1268, 1274,
795 1283, 1287, 1291, 1300, 1304, 1310, 1316, 1323, 1328, 1336,
796 1346, 1348, 1356, 1362, 1366, 1370, 1376, 1387, 1396, 1400,
797 1405, 1409, 1413, 1417, 1423, 1430, 1434, 1440, 1448, 1459,
798 1466, 1470, 1476, 1486, 1497, 1501, 1519, 1528, 1531, 1537,
799 1541, 1545, 1551, 1562, 1567, 1572, 1577, 1582, 1587, 1595,
800 1598, 1603, 1616, 1624, 1635, 1643, 1643, 1645, 1645, 1647,
801 1657, 1662, 1669, 1679, 1688, 1693, 1700, 1710, 1720, 1732,
802 1732, 1733, 1733, 1735, 1745, 1753, 1763, 1771, 1779, 1788,
803 1799, 1803, 1809, 1810, 1811, 1814, 1814, 1817, 1817, 1820,
804 1826, 1834, 1847, 1856, 1865, 1869, 1878, 1887, 1898, 1905,
805 1910, 1919, 1931, 1934, 1943, 1954, 1955, 1956, 1959, 1960,
806 1961, 1964, 1965, 1968, 1969, 1972, 1973, 1976, 1987, 1998,
811 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
812 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
813 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
814 static const char *const yytname
[] =
816 "$end", "error", "$undefined", "ARBvp_10", "ARBfp_10", "ADDRESS",
817 "ALIAS", "ATTRIB", "OPTION", "OUTPUT", "PARAM", "TEMP", "END", "BIN_OP",
818 "BINSC_OP", "SAMPLE_OP", "SCALAR_OP", "TRI_OP", "VECTOR_OP", "ARL",
819 "KIL", "SWZ", "TXD_OP", "INTEGER", "REAL", "AMBIENT", "ATTENUATION",
820 "BACK", "CLIP", "COLOR", "DEPTH", "DIFFUSE", "DIRECTION", "EMISSION",
821 "ENV", "EYE", "FOG", "FOGCOORD", "FRAGMENT", "FRONT", "HALF", "INVERSE",
822 "INVTRANS", "LIGHT", "LIGHTMODEL", "LIGHTPROD", "LOCAL", "MATERIAL",
823 "MAT_PROGRAM", "MATRIX", "MATRIXINDEX", "MODELVIEW", "MVP", "NORMAL",
824 "OBJECT", "PALETTE", "PARAMS", "PLANE", "POINT", "POINTSIZE", "POSITION",
825 "PRIMARY", "PROGRAM", "PROJECTION", "RANGE", "RESULT", "ROW",
826 "SCENECOLOR", "SECONDARY", "SHININESS", "SIZE", "SPECULAR", "SPOT",
827 "STATE", "TEXCOORD", "TEXENV", "TEXGEN", "TEXGEN_Q", "TEXGEN_R",
828 "TEXGEN_S", "TEXGEN_T", "TEXTURE", "TRANSPOSE", "TEXTURE_UNIT", "TEX_1D",
829 "TEX_2D", "TEX_3D", "TEX_CUBE", "TEX_RECT", "TEX_SHADOW1D",
830 "TEX_SHADOW2D", "TEX_SHADOWRECT", "TEX_ARRAY1D", "TEX_ARRAY2D",
831 "TEX_ARRAYSHADOW1D", "TEX_ARRAYSHADOW2D", "VERTEX", "VTXATTRIB",
832 "WEIGHT", "IDENTIFIER", "MASK4", "MASK3", "MASK2", "MASK1", "SWIZZLE",
833 "DOT_DOT", "DOT", "';'", "','", "'|'", "'['", "']'", "'+'", "'-'", "'='",
834 "'{'", "'}'", "$accept", "program", "language", "optionSequence",
835 "option", "statementSequence", "statement", "instruction",
836 "ALU_instruction", "TexInstruction", "ARL_instruction",
837 "VECTORop_instruction", "SCALARop_instruction", "BINSCop_instruction",
838 "BINop_instruction", "TRIop_instruction", "SAMPLE_instruction",
839 "KIL_instruction", "TXD_instruction", "texImageUnit", "texTarget",
840 "SWZ_instruction", "scalarSrcReg", "scalarUse", "swizzleSrcReg",
841 "maskedDstReg", "maskedAddrReg", "extendedSwizzle", "extSwizComp",
842 "extSwizSel", "srcReg", "dstReg", "progParamArray", "progParamArrayMem",
843 "progParamArrayAbs", "progParamArrayRel", "addrRegRelOffset",
844 "addrRegPosOffset", "addrRegNegOffset", "addrReg", "addrComponent",
845 "addrWriteMask", "scalarSuffix", "swizzleSuffix", "optionalMask",
846 "namingStatement", "ATTRIB_statement", "attribBinding", "vtxAttribItem",
847 "vtxAttribNum", "vtxOptWeightNum", "vtxWeightNum", "fragAttribItem",
848 "PARAM_statement", "PARAM_singleStmt", "PARAM_multipleStmt",
849 "optArraySize", "paramSingleInit", "paramMultipleInit",
850 "paramMultInitList", "paramSingleItemDecl", "paramSingleItemUse",
851 "paramMultipleItem", "stateMultipleItem", "stateSingleItem",
852 "stateMaterialItem", "stateMatProperty", "stateLightItem",
853 "stateLightProperty", "stateSpotProperty", "stateLightModelItem",
854 "stateLModProperty", "stateLightProdItem", "stateLProdProperty",
855 "stateTexEnvItem", "stateTexEnvProperty", "ambDiffSpecProperty",
856 "stateLightNumber", "stateTexGenItem", "stateTexGenType",
857 "stateTexGenCoord", "stateFogItem", "stateFogProperty",
858 "stateClipPlaneItem", "stateClipPlaneNum", "statePointItem",
859 "statePointProperty", "stateMatrixRow", "stateMatrixRows",
860 "optMatrixRows", "stateMatrixItem", "stateOptMatModifier",
861 "stateMatModifier", "stateMatrixRowNum", "stateMatrixName",
862 "stateOptModMatNum", "stateModMatNum", "statePaletteMatNum",
863 "stateProgramMatNum", "stateDepthItem", "programSingleItem",
864 "programMultipleItem", "progEnvParams", "progEnvParamNums",
865 "progEnvParam", "progLocalParams", "progLocalParamNums",
866 "progLocalParam", "progEnvParamNum", "progLocalParamNum",
867 "paramConstDecl", "paramConstUse", "paramConstScalarDecl",
868 "paramConstScalarUse", "paramConstVector", "signedFloatConstant",
869 "optionalSign", "TEMP_statement", "@1", "ADDRESS_statement", "@2",
870 "varNameList", "OUTPUT_statement", "resultBinding", "resultColBinding",
871 "optResultFaceType", "optResultColorType", "optFaceType", "optColorType",
872 "optTexCoordUnitNum", "optTexImageUnitNum", "optLegacyTexUnitNum",
873 "texCoordUnitNum", "texImageUnitNum", "legacyTexUnitNum",
879 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
881 static const yytype_uint16 yytoknum
[] =
883 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
884 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
885 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
886 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
887 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
888 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
889 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
890 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
891 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
892 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
893 355, 356, 357, 358, 359, 360, 361, 59, 44, 124,
894 91, 93, 43, 45, 61, 123, 125
898 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
899 static const yytype_uint8 yyr1
[] =
901 0, 117, 118, 119, 119, 120, 120, 121, 122, 122,
902 123, 123, 124, 124, 125, 125, 125, 125, 125, 125,
903 125, 126, 126, 126, 127, 128, 129, 130, 131, 132,
904 133, 134, 135, 136, 137, 137, 137, 137, 137, 137,
905 137, 137, 137, 137, 137, 137, 138, 139, 139, 140,
906 140, 141, 141, 142, 143, 144, 145, 146, 146, 147,
907 147, 147, 147, 148, 148, 149, 150, 150, 151, 152,
908 153, 153, 153, 154, 155, 156, 157, 158, 159, 160,
909 160, 160, 160, 161, 161, 161, 161, 161, 162, 162,
910 162, 162, 162, 162, 163, 164, 164, 165, 165, 165,
911 165, 165, 165, 165, 165, 166, 167, 167, 168, 169,
912 169, 169, 169, 170, 170, 171, 172, 173, 173, 174,
913 175, 176, 176, 177, 177, 177, 178, 178, 178, 179,
914 179, 179, 180, 180, 181, 181, 181, 181, 181, 181,
915 181, 181, 181, 181, 181, 182, 183, 183, 183, 184,
916 185, 185, 185, 185, 185, 186, 187, 188, 188, 189,
917 190, 191, 192, 193, 193, 193, 194, 195, 196, 196,
918 197, 197, 197, 197, 198, 199, 199, 200, 201, 202,
919 203, 203, 204, 205, 206, 206, 207, 208, 208, 209,
920 209, 209, 210, 211, 211, 211, 211, 211, 211, 212,
921 212, 213, 214, 215, 216, 217, 217, 218, 218, 219,
922 220, 220, 221, 222, 223, 223, 224, 225, 226, 227,
923 227, 228, 228, 229, 230, 230, 231, 231, 231, 231,
924 232, 232, 233, 233, 233, 235, 234, 237, 236, 238,
925 238, 239, 240, 240, 240, 240, 240, 240, 241, 242,
926 242, 242, 243, 243, 243, 244, 244, 244, 245, 245,
927 245, 246, 246, 247, 247, 248, 248, 249, 250, 251,
931 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
932 static const yytype_uint8 yyr2
[] =
934 0, 2, 4, 1, 1, 2, 0, 3, 2, 0,
935 2, 2, 1, 1, 1, 1, 1, 1, 1, 1,
936 1, 1, 1, 1, 4, 4, 4, 6, 6, 8,
937 8, 2, 12, 2, 1, 1, 1, 1, 1, 1,
938 1, 1, 1, 1, 1, 1, 6, 2, 4, 2,
939 1, 3, 5, 2, 2, 7, 2, 1, 1, 1,
940 1, 4, 1, 1, 1, 1, 1, 1, 1, 3,
941 0, 2, 2, 1, 1, 1, 1, 1, 1, 1,
942 1, 1, 0, 1, 1, 1, 1, 0, 1, 1,
943 1, 1, 1, 1, 4, 2, 2, 1, 2, 1,
944 2, 1, 2, 4, 4, 1, 0, 3, 1, 1,
945 2, 1, 2, 1, 1, 3, 6, 0, 1, 2,
946 4, 1, 3, 1, 1, 1, 1, 1, 1, 1,
947 1, 1, 1, 2, 2, 2, 2, 2, 2, 2,
948 2, 2, 2, 2, 2, 3, 1, 1, 1, 5,
949 1, 1, 1, 2, 1, 1, 2, 1, 2, 6,
950 1, 3, 1, 1, 1, 1, 1, 4, 1, 1,
951 1, 1, 1, 1, 2, 1, 1, 5, 1, 2,
952 1, 1, 5, 2, 0, 6, 3, 0, 1, 1,
953 1, 1, 1, 2, 1, 1, 2, 4, 4, 0,
954 1, 1, 1, 1, 2, 1, 1, 1, 1, 5,
955 1, 3, 5, 5, 1, 3, 5, 1, 1, 1,
956 1, 1, 1, 1, 1, 1, 3, 5, 7, 9,
957 2, 2, 1, 1, 0, 0, 3, 0, 3, 3,
958 1, 4, 2, 2, 2, 2, 3, 2, 3, 0,
959 1, 1, 0, 1, 1, 0, 1, 1, 0, 1,
960 1, 0, 3, 0, 3, 0, 3, 1, 1, 1,
964 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
965 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
966 means the default is an error. */
967 static const yytype_uint16 yydefact
[] =
969 0, 3, 4, 0, 6, 1, 9, 0, 5, 0,
970 0, 237, 0, 0, 0, 0, 235, 2, 0, 0,
971 0, 0, 0, 0, 0, 234, 0, 0, 8, 0,
972 12, 13, 14, 15, 16, 17, 18, 19, 21, 22,
973 23, 20, 0, 88, 89, 113, 114, 90, 91, 92,
974 93, 7, 0, 0, 0, 0, 0, 0, 0, 64,
975 0, 87, 63, 0, 0, 0, 0, 0, 75, 0,
976 0, 232, 233, 31, 0, 0, 0, 10, 11, 240,
977 238, 0, 0, 0, 117, 234, 115, 236, 249, 247,
978 243, 245, 242, 261, 244, 234, 83, 84, 85, 86,
979 53, 234, 234, 234, 234, 234, 234, 77, 54, 225,
980 224, 0, 0, 0, 0, 59, 0, 234, 82, 0,
981 60, 62, 126, 127, 205, 206, 128, 221, 222, 0,
982 234, 0, 270, 94, 241, 118, 0, 119, 123, 124,
983 125, 219, 220, 223, 0, 251, 250, 252, 0, 246,
984 0, 0, 0, 0, 26, 0, 25, 24, 258, 111,
985 109, 261, 96, 0, 0, 0, 0, 0, 0, 255,
986 0, 255, 0, 0, 265, 261, 134, 135, 136, 137,
987 139, 138, 140, 141, 142, 143, 0, 144, 258, 101,
988 0, 99, 97, 261, 0, 106, 95, 82, 0, 80,
989 79, 81, 51, 0, 0, 0, 239, 0, 231, 230,
990 253, 254, 248, 267, 0, 234, 234, 0, 47, 0,
991 50, 0, 234, 259, 260, 110, 112, 0, 0, 0,
992 204, 175, 176, 174, 0, 157, 257, 256, 156, 0,
993 0, 0, 0, 199, 195, 0, 194, 261, 187, 181,
994 180, 179, 0, 0, 0, 0, 100, 0, 102, 0,
995 0, 98, 0, 234, 226, 68, 0, 66, 67, 0,
996 234, 234, 0, 116, 262, 28, 27, 0, 78, 49,
997 263, 0, 0, 217, 0, 218, 0, 178, 0, 166,
998 0, 158, 0, 163, 164, 147, 148, 165, 145, 146,
999 0, 201, 193, 200, 0, 196, 189, 191, 190, 186,
1000 188, 269, 0, 162, 161, 168, 169, 0, 0, 108,
1001 0, 105, 0, 0, 52, 0, 61, 76, 70, 46,
1002 0, 0, 0, 234, 48, 0, 33, 0, 234, 212,
1003 216, 0, 0, 255, 203, 0, 202, 0, 266, 173,
1004 172, 170, 171, 167, 192, 0, 103, 104, 107, 234,
1005 227, 0, 0, 69, 234, 57, 58, 56, 234, 0,
1006 0, 0, 121, 129, 132, 130, 207, 208, 131, 268,
1007 0, 34, 35, 36, 37, 38, 39, 40, 41, 42,
1008 43, 44, 45, 30, 29, 177, 152, 154, 151, 0,
1009 149, 150, 0, 198, 197, 182, 0, 73, 71, 74,
1010 72, 0, 0, 0, 0, 133, 184, 234, 120, 264,
1011 155, 153, 159, 160, 234, 228, 234, 0, 0, 0,
1012 0, 183, 122, 0, 0, 0, 0, 210, 0, 214,
1013 0, 229, 234, 0, 209, 0, 213, 0, 0, 55,
1014 32, 211, 215, 0, 0, 185
1017 /* YYDEFGOTO[NTERM-NUM]. */
1018 static const yytype_int16 yydefgoto
[] =
1020 -1, 3, 4, 6, 8, 9, 28, 29, 30, 31,
1021 32, 33, 34, 35, 36, 37, 38, 39, 40, 281,
1022 393, 41, 151, 218, 73, 60, 69, 329, 330, 367,
1023 219, 61, 119, 266, 267, 268, 363, 408, 410, 70,
1024 328, 108, 279, 202, 100, 42, 43, 120, 196, 322,
1025 261, 320, 162, 44, 45, 46, 136, 86, 273, 371,
1026 137, 121, 372, 373, 122, 176, 298, 177, 400, 421,
1027 178, 238, 179, 422, 180, 314, 299, 290, 181, 317,
1028 353, 182, 233, 183, 288, 184, 251, 185, 415, 431,
1029 186, 309, 310, 355, 248, 302, 303, 347, 345, 187,
1030 123, 375, 376, 436, 124, 377, 438, 125, 284, 286,
1031 378, 126, 141, 127, 128, 143, 74, 47, 57, 48,
1032 52, 80, 49, 62, 94, 147, 212, 239, 225, 149,
1033 336, 253, 214, 380, 312, 50
1036 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
1038 #define YYPACT_NINF -403
1039 static const yytype_int16 yypact
[] =
1041 62, -403, -403, 41, -403, -403, 81, -36, -403, 198,
1042 -8, -403, -5, 18, 20, 35, -403, -403, -23, -23,
1043 -23, -23, -23, -23, 45, 131, -23, -23, -403, 58,
1044 -403, -403, -403, -403, -403, -403, -403, -403, -403, -403,
1045 -403, -403, 67, -403, -403, -403, -403, -403, -403, -403,
1046 -403, -403, 63, 86, 92, 128, 84, 63, 99, -403,
1047 69, 133, -403, 87, 89, 129, 145, 146, -403, 147,
1048 154, -403, -403, -403, -13, 150, 151, -403, -403, -403,
1049 152, 162, -14, 197, 240, -34, -403, 152, 98, -403,
1050 -403, -403, -403, 155, -403, 131, -403, -403, -403, -403,
1051 -403, 131, 131, 131, 131, 131, 131, -403, -403, -403,
1052 -403, 72, 105, 77, 17, 156, 12, 131, 68, 157,
1053 -403, -403, -403, -403, -403, -403, -403, -403, -403, 12,
1054 131, 165, -403, -403, -403, -403, 158, -403, -403, -403,
1055 -403, -403, -403, -403, 223, -403, -403, -16, 245, -403,
1056 163, 164, -9, 167, -403, 168, -403, -403, 55, -403,
1057 -403, 155, -403, 170, 171, 172, 206, 2, 173, 34,
1058 174, 127, 112, 1, 175, 155, -403, -403, -403, -403,
1059 -403, -403, -403, -403, -403, -403, 207, -403, 55, -403,
1060 177, -403, -403, 155, 178, 179, -403, 68, 22, -403,
1061 -403, -403, -403, -6, 169, 182, -403, 180, -403, -403,
1062 -403, -403, -403, -403, 181, 131, 131, 12, -403, 188,
1063 190, 195, 131, -403, -403, -403, -403, 272, 273, 274,
1064 -403, -403, -403, -403, 275, -403, -403, -403, -403, 232,
1065 275, 79, 191, 277, -403, 192, -403, 155, 15, -403,
1066 -403, -403, 280, 276, 8, 194, -403, 283, -403, 284,
1067 283, -403, 199, 131, -403, -403, 200, -403, -403, 209,
1068 131, 131, 201, -403, -403, -403, -403, 204, -403, -403,
1069 205, 210, 211, -403, 203, -403, 212, -403, 213, -403,
1070 214, -403, 215, -403, -403, -403, -403, -403, -403, -403,
1071 286, -403, -403, -403, 294, -403, -403, -403, -403, -403,
1072 -403, -403, 216, -403, -403, -403, -403, 161, 297, -403,
1073 217, -403, 218, 219, -403, 76, -403, -403, 139, -403,
1074 227, -4, 228, 30, -403, 298, -403, 137, 131, -403,
1075 -403, 265, 130, 127, -403, 220, -403, 226, -403, -403,
1076 -403, -403, -403, -403, -403, 229, -403, -403, -403, 131,
1077 -403, 315, 319, -403, 131, -403, -403, -403, 131, 123,
1078 77, 80, -403, -403, -403, -403, -403, -403, -403, -403,
1079 233, -403, -403, -403, -403, -403, -403, -403, -403, -403,
1080 -403, -403, -403, -403, -403, -403, -403, -403, -403, 311,
1081 -403, -403, 9, -403, -403, -403, 83, -403, -403, -403,
1082 -403, 237, 238, 239, 241, -403, 281, 30, -403, -403,
1083 -403, -403, -403, -403, 131, -403, 131, 195, 272, 273,
1084 242, -403, -403, 234, 246, 247, 248, 243, 249, 251,
1085 297, -403, 131, 137, -403, 272, -403, 273, 36, -403,
1086 -403, -403, -403, 297, 250, -403
1089 /* YYPGOTO[NTERM-NUM]. */
1090 static const yytype_int16 yypgoto
[] =
1092 -403, -403, -403, -403, -403, -403, -403, -403, -403, -403,
1093 -403, -403, -403, -403, -403, -403, -403, -403, -403, -74,
1094 -81, -403, -98, 141, -82, 160, -403, -403, -358, -403,
1095 -41, -403, -403, -403, -403, -403, -403, -403, -403, 166,
1096 -403, -403, -403, 176, -403, -403, -403, 282, -403, -403,
1097 -403, 103, -403, -403, -403, -403, -403, -403, -403, -403,
1098 -403, -403, -52, -403, -84, -403, -403, -403, -403, -403,
1099 -403, -403, -403, -403, -403, -403, -333, 126, -403, -403,
1100 -403, -403, -403, -403, -403, -403, -403, -403, -403, -403,
1101 -3, -403, -403, -402, -403, -403, -403, -403, -403, -403,
1102 285, -403, -403, -403, -403, -403, -403, -403, -398, -392,
1103 287, -403, -403, -145, -83, -114, -85, -403, -403, -403,
1104 -403, 314, -403, 291, -403, -403, -403, -167, 187, -149,
1105 -403, -403, -403, -403, -403, -403
1108 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
1109 positive, shift that token. If negative, reduce the rule which
1110 number is the opposite. If zero, do what YYDEFACT says.
1111 If YYTABLE_NINF, syntax error. */
1112 #define YYTABLE_NINF -222
1113 static const yytype_int16 yytable
[] =
1115 144, 138, 142, 198, 241, 154, 411, 220, 157, 401,
1116 109, 110, 226, 150, 109, 110, 152, 265, 152, 365,
1117 153, 152, 155, 156, 111, 111, 254, 249, 112, 111,
1118 437, 231, 144, 118, 293, 109, 110, 439, 448, 113,
1119 294, 5, 58, 315, 258, 210, 188, 451, 205, 112,
1120 111, 454, 211, 112, 189, 452, 306, 307, 232, 235,
1121 113, 236, 316, 10, 113, 1, 2, 190, 434, 423,
1122 191, 250, 220, 237, 112, 197, 59, 192, 71, 72,
1123 297, 117, 114, 114, 449, 113, 115, 114, 204, 7,
1124 115, 193, 369, 68, 53, 366, 116, 308, 305, 51,
1125 217, 158, 117, 370, 293, 165, 117, 166, 114, 159,
1126 294, 115, 295, 167, 194, 195, 223, 54, 276, 55,
1127 168, 169, 170, 224, 171, 145, 172, 117, 88, 89,
1128 263, 152, 160, 275, 56, 173, 90, 146, 264, 163,
1129 282, 453, 71, 72, 68, 117, 161, 405, 296, 325,
1130 297, 164, 174, 175, 236, 293, 396, 413, 91, 92,
1131 242, 294, 79, 243, 244, 77, 237, 245, 199, 414,
1132 397, 200, 201, 93, 78, 246, 402, 95, 144, 63,
1133 64, 65, 66, 67, 359, 331, 75, 76, 417, 332,
1134 398, 424, 360, 247, 84, 101, 418, 102, 85, 425,
1135 81, 297, 399, 11, 12, 13, 82, 14, 15, 16,
1136 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
1137 27, 381, 382, 383, 384, 385, 386, 387, 388, 389,
1138 390, 391, 392, 96, 97, 98, 99, 103, 349, 350,
1139 351, 352, 83, 71, 72, 406, 208, 209, 144, 374,
1140 142, 361, 362, 104, 105, 106, 394, 107, 129, 130,
1141 131, 132, 58, 135, 206, 148, -65, 203, 213, 207,
1142 230, 215, 216, 255, 144, 221, 222, 270, 280, 331,
1143 227, 228, 229, 234, 240, 252, 412, 257, 259, 260,
1144 271, 278, 274, -221, 272, 283, 285, 287, 289, 291,
1145 301, 300, 304, 311, 318, 313, 319, 321, 324, 344,
1146 433, 326, 327, 334, 339, 335, 333, 346, 337, 338,
1147 354, 379, 395, 340, 341, 342, 343, 348, 356, 357,
1148 358, 403, 144, 374, 142, 364, 368, 404, 407, 144,
1149 405, 331, 409, 420, 419, 426, 427, 430, 445, 428,
1150 441, 429, 440, 435, 442, 443, 447, 331, 277, 444,
1151 446, 455, 450, 323, 133, 432, 292, 416, 0, 269,
1152 139, 87, 140, 262, 134, 256
1155 static const yytype_int16 yycheck
[] =
1157 85, 85, 85, 117, 171, 103, 364, 152, 106, 342,
1158 23, 24, 161, 95, 23, 24, 101, 23, 103, 23,
1159 102, 106, 104, 105, 38, 38, 175, 26, 62, 38,
1160 428, 29, 117, 74, 25, 23, 24, 429, 440, 73,
1161 31, 0, 65, 35, 193, 61, 29, 445, 130, 62,
1162 38, 453, 68, 62, 37, 447, 41, 42, 56, 25,
1163 73, 27, 54, 99, 73, 3, 4, 50, 426, 402,
1164 53, 70, 217, 39, 62, 116, 99, 60, 112, 113,
1165 71, 115, 96, 96, 442, 73, 99, 96, 129, 8,
1166 99, 74, 62, 99, 99, 99, 109, 82, 247, 107,
1167 109, 29, 115, 73, 25, 28, 115, 30, 96, 37,
1168 31, 99, 33, 36, 97, 98, 61, 99, 216, 99,
1169 43, 44, 45, 68, 47, 27, 49, 115, 29, 30,
1170 108, 216, 60, 215, 99, 58, 37, 39, 116, 34,
1171 222, 105, 112, 113, 99, 115, 74, 111, 69, 263,
1172 71, 46, 75, 76, 27, 25, 26, 34, 59, 60,
1173 48, 31, 99, 51, 52, 107, 39, 55, 100, 46,
1174 40, 103, 104, 74, 107, 63, 343, 108, 263, 19,
1175 20, 21, 22, 23, 108, 270, 26, 27, 108, 271,
1176 60, 108, 116, 81, 110, 108, 116, 108, 114, 116,
1177 114, 71, 72, 5, 6, 7, 114, 9, 10, 11,
1178 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
1179 22, 84, 85, 86, 87, 88, 89, 90, 91, 92,
1180 93, 94, 95, 100, 101, 102, 103, 108, 77, 78,
1181 79, 80, 114, 112, 113, 359, 23, 24, 333, 333,
1182 333, 112, 113, 108, 108, 108, 338, 103, 108, 108,
1183 108, 99, 65, 23, 99, 110, 110, 110, 23, 111,
1184 64, 108, 108, 66, 359, 108, 108, 108, 83, 364,
1185 110, 110, 110, 110, 110, 110, 368, 110, 110, 110,
1186 108, 103, 111, 103, 114, 23, 23, 23, 23, 67,
1187 23, 110, 110, 23, 110, 29, 23, 23, 109, 23,
1188 424, 111, 103, 109, 111, 110, 115, 23, 108, 108,
1189 23, 23, 57, 111, 111, 111, 111, 111, 111, 111,
1190 111, 111, 417, 417, 417, 108, 108, 111, 23, 424,
1191 111, 426, 23, 32, 111, 108, 108, 66, 105, 110,
1192 116, 110, 110, 427, 108, 108, 105, 442, 217, 111,
1193 111, 111, 443, 260, 82, 417, 240, 370, -1, 203,
1194 85, 57, 85, 197, 83, 188
1197 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
1198 symbol of state STATE-NUM. */
1199 static const yytype_uint8 yystos
[] =
1201 0, 3, 4, 118, 119, 0, 120, 8, 121, 122,
1202 99, 5, 6, 7, 9, 10, 11, 12, 13, 14,
1203 15, 16, 17, 18, 19, 20, 21, 22, 123, 124,
1204 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
1205 135, 138, 162, 163, 170, 171, 172, 234, 236, 239,
1206 252, 107, 237, 99, 99, 99, 99, 235, 65, 99,
1207 142, 148, 240, 142, 142, 142, 142, 142, 99, 143,
1208 156, 112, 113, 141, 233, 142, 142, 107, 107, 99,
1209 238, 114, 114, 114, 110, 114, 174, 238, 29, 30,
1210 37, 59, 60, 74, 241, 108, 100, 101, 102, 103,
1211 161, 108, 108, 108, 108, 108, 108, 103, 158, 23,
1212 24, 38, 62, 73, 96, 99, 109, 115, 147, 149,
1213 164, 178, 181, 217, 221, 224, 228, 230, 231, 108,
1214 108, 108, 99, 164, 240, 23, 173, 177, 181, 217,
1215 227, 229, 231, 232, 233, 27, 39, 242, 110, 246,
1216 141, 139, 233, 141, 139, 141, 141, 139, 29, 37,
1217 60, 74, 169, 34, 46, 28, 30, 36, 43, 44,
1218 45, 47, 49, 58, 75, 76, 182, 184, 187, 189,
1219 191, 195, 198, 200, 202, 204, 207, 216, 29, 37,
1220 50, 53, 60, 74, 97, 98, 165, 147, 232, 100,
1221 103, 104, 160, 110, 147, 141, 99, 111, 23, 24,
1222 61, 68, 243, 23, 249, 108, 108, 109, 140, 147,
1223 230, 108, 108, 61, 68, 245, 246, 110, 110, 110,
1224 64, 29, 56, 199, 110, 25, 27, 39, 188, 244,
1225 110, 244, 48, 51, 52, 55, 63, 81, 211, 26,
1226 70, 203, 110, 248, 246, 66, 245, 110, 246, 110,
1227 110, 167, 160, 108, 116, 23, 150, 151, 152, 156,
1228 108, 108, 114, 175, 111, 141, 139, 140, 103, 159,
1229 83, 136, 141, 23, 225, 23, 226, 23, 201, 23,
1230 194, 67, 194, 25, 31, 33, 69, 71, 183, 193,
1231 110, 23, 212, 213, 110, 246, 41, 42, 82, 208,
1232 209, 23, 251, 29, 192, 35, 54, 196, 110, 23,
1233 168, 23, 166, 168, 109, 232, 111, 103, 157, 144,
1234 145, 233, 141, 115, 109, 110, 247, 108, 108, 111,
1235 111, 111, 111, 111, 23, 215, 23, 214, 111, 77,
1236 78, 79, 80, 197, 23, 210, 111, 111, 111, 108,
1237 116, 112, 113, 153, 108, 23, 99, 146, 108, 62,
1238 73, 176, 179, 180, 181, 218, 219, 222, 227, 23,
1239 250, 84, 85, 86, 87, 88, 89, 90, 91, 92,
1240 93, 94, 95, 137, 141, 57, 26, 40, 60, 72,
1241 185, 193, 244, 111, 111, 111, 232, 23, 154, 23,
1242 155, 145, 141, 34, 46, 205, 207, 108, 116, 111,
1243 32, 186, 190, 193, 108, 116, 108, 108, 110, 110,
1244 66, 206, 179, 232, 145, 136, 220, 225, 223, 226,
1245 110, 116, 108, 108, 111, 105, 111, 105, 210, 145,
1246 137, 225, 226, 105, 210, 111
1249 #define yyerrok (yyerrstatus = 0)
1250 #define yyclearin (yychar = YYEMPTY)
1251 #define YYEMPTY (-2)
1254 #define YYACCEPT goto yyacceptlab
1255 #define YYABORT goto yyabortlab
1256 #define YYERROR goto yyerrorlab
1259 /* Like YYERROR except do call yyerror. This remains here temporarily
1260 to ease the transition to the new meaning of YYERROR, for GCC.
1261 Once GCC version 2 has supplanted version 1, this can go. */
1263 #define YYFAIL goto yyerrlab
1265 #define YYRECOVERING() (!!yyerrstatus)
1267 #define YYBACKUP(Token, Value) \
1269 if (yychar == YYEMPTY && yylen == 1) \
1273 yytoken = YYTRANSLATE (yychar); \
1279 yyerror (&yylloc, state, YY_("syntax error: cannot back up")); \
1286 #define YYERRCODE 256
1289 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
1290 If N is 0, then set CURRENT to the empty location which ends
1291 the previous symbol: RHS[0] (always defined). */
1293 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
1294 #ifndef YYLLOC_DEFAULT
1295 # define YYLLOC_DEFAULT(Current, Rhs, N) \
1299 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
1300 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
1301 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
1302 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
1306 (Current).first_line = (Current).last_line = \
1307 YYRHSLOC (Rhs, 0).last_line; \
1308 (Current).first_column = (Current).last_column = \
1309 YYRHSLOC (Rhs, 0).last_column; \
1315 /* YY_LOCATION_PRINT -- Print the location on the stream.
1316 This macro was not mandated originally: define only if we know
1317 we won't break user code: when these are the locations we know. */
1319 #ifndef YY_LOCATION_PRINT
1320 # if YYLTYPE_IS_TRIVIAL
1321 # define YY_LOCATION_PRINT(File, Loc) \
1322 fprintf (File, "%d.%d-%d.%d", \
1323 (Loc).first_line, (Loc).first_column, \
1324 (Loc).last_line, (Loc).last_column)
1326 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
1331 /* YYLEX -- calling `yylex' with the right arguments. */
1334 # define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM)
1336 # define YYLEX yylex (&yylval, &yylloc, scanner)
1339 /* Enable debugging if requested. */
1343 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
1344 # define YYFPRINTF fprintf
1347 # define YYDPRINTF(Args) \
1353 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
1357 YYFPRINTF (stderr, "%s ", Title); \
1358 yy_symbol_print (stderr, \
1359 Type, Value, Location, state); \
1360 YYFPRINTF (stderr, "\n"); \
1365 /*--------------------------------.
1366 | Print this symbol on YYOUTPUT. |
1367 `--------------------------------*/
1370 #if (defined __STDC__ || defined __C99__FUNC__ \
1371 || defined __cplusplus || defined _MSC_VER)
1373 yy_symbol_value_print (FILE *yyoutput
, int yytype
, YYSTYPE
const * const yyvaluep
, YYLTYPE
const * const yylocationp
, struct asm_parser_state
*state
)
1376 yy_symbol_value_print (yyoutput
, yytype
, yyvaluep
, yylocationp
, state
)
1379 YYSTYPE
const * const yyvaluep
;
1380 YYLTYPE
const * const yylocationp
;
1381 struct asm_parser_state
*state
;
1386 YYUSE (yylocationp
);
1389 if (yytype
< YYNTOKENS
)
1390 YYPRINT (yyoutput
, yytoknum
[yytype
], *yyvaluep
);
1402 /*--------------------------------.
1403 | Print this symbol on YYOUTPUT. |
1404 `--------------------------------*/
1406 #if (defined __STDC__ || defined __C99__FUNC__ \
1407 || defined __cplusplus || defined _MSC_VER)
1409 yy_symbol_print (FILE *yyoutput
, int yytype
, YYSTYPE
const * const yyvaluep
, YYLTYPE
const * const yylocationp
, struct asm_parser_state
*state
)
1412 yy_symbol_print (yyoutput
, yytype
, yyvaluep
, yylocationp
, state
)
1415 YYSTYPE
const * const yyvaluep
;
1416 YYLTYPE
const * const yylocationp
;
1417 struct asm_parser_state
*state
;
1420 if (yytype
< YYNTOKENS
)
1421 YYFPRINTF (yyoutput
, "token %s (", yytname
[yytype
]);
1423 YYFPRINTF (yyoutput
, "nterm %s (", yytname
[yytype
]);
1425 YY_LOCATION_PRINT (yyoutput
, *yylocationp
);
1426 YYFPRINTF (yyoutput
, ": ");
1427 yy_symbol_value_print (yyoutput
, yytype
, yyvaluep
, yylocationp
, state
);
1428 YYFPRINTF (yyoutput
, ")");
1431 /*------------------------------------------------------------------.
1432 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
1434 `------------------------------------------------------------------*/
1436 #if (defined __STDC__ || defined __C99__FUNC__ \
1437 || defined __cplusplus || defined _MSC_VER)
1439 yy_stack_print (yytype_int16
*yybottom
, yytype_int16
*yytop
)
1442 yy_stack_print (yybottom
, yytop
)
1443 yytype_int16
*yybottom
;
1444 yytype_int16
*yytop
;
1447 YYFPRINTF (stderr
, "Stack now");
1448 for (; yybottom
<= yytop
; yybottom
++)
1450 int yybot
= *yybottom
;
1451 YYFPRINTF (stderr
, " %d", yybot
);
1453 YYFPRINTF (stderr
, "\n");
1456 # define YY_STACK_PRINT(Bottom, Top) \
1459 yy_stack_print ((Bottom), (Top)); \
1463 /*------------------------------------------------.
1464 | Report that the YYRULE is going to be reduced. |
1465 `------------------------------------------------*/
1467 #if (defined __STDC__ || defined __C99__FUNC__ \
1468 || defined __cplusplus || defined _MSC_VER)
1470 yy_reduce_print (YYSTYPE
*yyvsp
, YYLTYPE
*yylsp
, int yyrule
, struct asm_parser_state
*state
)
1473 yy_reduce_print (yyvsp
, yylsp
, yyrule
, state
)
1477 struct asm_parser_state
*state
;
1480 int yynrhs
= yyr2
[yyrule
];
1482 unsigned long int yylno
= yyrline
[yyrule
];
1483 YYFPRINTF (stderr
, "Reducing stack by rule %d (line %lu):\n",
1485 /* The symbols being reduced. */
1486 for (yyi
= 0; yyi
< yynrhs
; yyi
++)
1488 YYFPRINTF (stderr
, " $%d = ", yyi
+ 1);
1489 yy_symbol_print (stderr
, yyrhs
[yyprhs
[yyrule
] + yyi
],
1490 &(yyvsp
[(yyi
+ 1) - (yynrhs
)])
1491 , &(yylsp
[(yyi
+ 1) - (yynrhs
)]) , state
);
1492 YYFPRINTF (stderr
, "\n");
1496 # define YY_REDUCE_PRINT(Rule) \
1499 yy_reduce_print (yyvsp, yylsp, Rule, state); \
1502 /* Nonzero means print parse trace. It is left uninitialized so that
1503 multiple parsers can coexist. */
1505 #else /* !YYDEBUG */
1506 # define YYDPRINTF(Args)
1507 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1508 # define YY_STACK_PRINT(Bottom, Top)
1509 # define YY_REDUCE_PRINT(Rule)
1510 #endif /* !YYDEBUG */
1513 /* YYINITDEPTH -- initial size of the parser's stacks. */
1515 # define YYINITDEPTH 200
1518 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1519 if the built-in stack extension method is used).
1521 Do not make this value too large; the results are undefined if
1522 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1523 evaluated with infinite-precision integer arithmetic. */
1526 # define YYMAXDEPTH 10000
1534 # if defined __GLIBC__ && defined _STRING_H
1535 # define yystrlen strlen
1537 /* Return the length of YYSTR. */
1538 #if (defined __STDC__ || defined __C99__FUNC__ \
1539 || defined __cplusplus || defined _MSC_VER)
1541 yystrlen (const char *yystr
)
1549 for (yylen
= 0; yystr
[yylen
]; yylen
++)
1557 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1558 # define yystpcpy stpcpy
1560 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1562 #if (defined __STDC__ || defined __C99__FUNC__ \
1563 || defined __cplusplus || defined _MSC_VER)
1565 yystpcpy (char *yydest
, const char *yysrc
)
1568 yystpcpy (yydest
, yysrc
)
1574 const char *yys
= yysrc
;
1576 while ((*yyd
++ = *yys
++) != '\0')
1585 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1586 quotes and backslashes, so that it's suitable for yyerror. The
1587 heuristic is that double-quoting is unnecessary unless the string
1588 contains an apostrophe, a comma, or backslash (other than
1589 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1590 null, do not copy; instead, return the length of what the result
1593 yytnamerr (char *yyres
, const char *yystr
)
1598 char const *yyp
= yystr
;
1605 goto do_not_strip_quotes
;
1609 goto do_not_strip_quotes
;
1622 do_not_strip_quotes
: ;
1626 return yystrlen (yystr
);
1628 return yystpcpy (yyres
, yystr
) - yyres
;
1632 /* Copy into YYRESULT an error message about the unexpected token
1633 YYCHAR while in state YYSTATE. Return the number of bytes copied,
1634 including the terminating null byte. If YYRESULT is null, do not
1635 copy anything; just return the number of bytes that would be
1636 copied. As a special case, return 0 if an ordinary "syntax error"
1637 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
1638 size calculation. */
1640 yysyntax_error (char *yyresult
, int yystate
, int yychar
)
1642 int yyn
= yypact
[yystate
];
1644 if (! (YYPACT_NINF
< yyn
&& yyn
<= YYLAST
))
1648 int yytype
= YYTRANSLATE (yychar
);
1649 YYSIZE_T yysize0
= yytnamerr (0, yytname
[yytype
]);
1650 YYSIZE_T yysize
= yysize0
;
1652 int yysize_overflow
= 0;
1653 enum { YYERROR_VERBOSE_ARGS_MAXIMUM
= 5 };
1654 char const *yyarg
[YYERROR_VERBOSE_ARGS_MAXIMUM
];
1658 /* This is so xgettext sees the translatable formats that are
1659 constructed on the fly. */
1660 YY_("syntax error, unexpected %s");
1661 YY_("syntax error, unexpected %s, expecting %s");
1662 YY_("syntax error, unexpected %s, expecting %s or %s");
1663 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1664 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1668 static char const yyunexpected
[] = "syntax error, unexpected %s";
1669 static char const yyexpecting
[] = ", expecting %s";
1670 static char const yyor
[] = " or %s";
1671 char yyformat
[sizeof yyunexpected
1672 + sizeof yyexpecting
- 1
1673 + ((YYERROR_VERBOSE_ARGS_MAXIMUM
- 2)
1674 * (sizeof yyor
- 1))];
1675 char const *yyprefix
= yyexpecting
;
1677 /* Start YYX at -YYN if negative to avoid negative indexes in
1679 int yyxbegin
= yyn
< 0 ? -yyn
: 0;
1681 /* Stay within bounds of both yycheck and yytname. */
1682 int yychecklim
= YYLAST
- yyn
+ 1;
1683 int yyxend
= yychecklim
< YYNTOKENS
? yychecklim
: YYNTOKENS
;
1686 yyarg
[0] = yytname
[yytype
];
1687 yyfmt
= yystpcpy (yyformat
, yyunexpected
);
1689 for (yyx
= yyxbegin
; yyx
< yyxend
; ++yyx
)
1690 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
)
1692 if (yycount
== YYERROR_VERBOSE_ARGS_MAXIMUM
)
1696 yyformat
[sizeof yyunexpected
- 1] = '\0';
1699 yyarg
[yycount
++] = yytname
[yyx
];
1700 yysize1
= yysize
+ yytnamerr (0, yytname
[yyx
]);
1701 yysize_overflow
|= (yysize1
< yysize
);
1703 yyfmt
= yystpcpy (yyfmt
, yyprefix
);
1707 yyf
= YY_(yyformat
);
1708 yysize1
= yysize
+ yystrlen (yyf
);
1709 yysize_overflow
|= (yysize1
< yysize
);
1712 if (yysize_overflow
)
1713 return YYSIZE_MAXIMUM
;
1717 /* Avoid sprintf, as that infringes on the user's name space.
1718 Don't have undefined behavior even if the translation
1719 produced a string with the wrong number of "%s"s. */
1720 char *yyp
= yyresult
;
1722 while ((*yyp
= *yyf
) != '\0')
1724 if (*yyp
== '%' && yyf
[1] == 's' && yyi
< yycount
)
1726 yyp
+= yytnamerr (yyp
, yyarg
[yyi
++]);
1739 #endif /* YYERROR_VERBOSE */
1742 /*-----------------------------------------------.
1743 | Release the memory associated to this symbol. |
1744 `-----------------------------------------------*/
1747 #if (defined __STDC__ || defined __C99__FUNC__ \
1748 || defined __cplusplus || defined _MSC_VER)
1750 yydestruct (const char *yymsg
, int yytype
, YYSTYPE
*yyvaluep
, YYLTYPE
*yylocationp
, struct asm_parser_state
*state
)
1753 yydestruct (yymsg
, yytype
, yyvaluep
, yylocationp
, state
)
1757 YYLTYPE
*yylocationp
;
1758 struct asm_parser_state
*state
;
1762 YYUSE (yylocationp
);
1767 YY_SYMBOL_PRINT (yymsg
, yytype
, yyvaluep
, yylocationp
);
1777 /* Prevent warnings from -Wmissing-prototypes. */
1778 #ifdef YYPARSE_PARAM
1779 #if defined __STDC__ || defined __cplusplus
1780 int yyparse (void *YYPARSE_PARAM
);
1784 #else /* ! YYPARSE_PARAM */
1785 #if defined __STDC__ || defined __cplusplus
1786 int yyparse (struct asm_parser_state
*state
);
1790 #endif /* ! YYPARSE_PARAM */
1796 /*-------------------------.
1797 | yyparse or yypush_parse. |
1798 `-------------------------*/
1800 #ifdef YYPARSE_PARAM
1801 #if (defined __STDC__ || defined __C99__FUNC__ \
1802 || defined __cplusplus || defined _MSC_VER)
1804 yyparse (void *YYPARSE_PARAM
)
1807 yyparse (YYPARSE_PARAM
)
1808 void *YYPARSE_PARAM
;
1810 #else /* ! YYPARSE_PARAM */
1811 #if (defined __STDC__ || defined __C99__FUNC__ \
1812 || defined __cplusplus || defined _MSC_VER)
1814 yyparse (struct asm_parser_state
*state
)
1818 struct asm_parser_state
*state
;
1822 /* The lookahead symbol. */
1825 /* The semantic value of the lookahead symbol. */
1828 /* Location data for the lookahead symbol. */
1831 /* Number of syntax errors so far. */
1835 /* Number of tokens to shift before error messages enabled. */
1838 /* The stacks and their tools:
1839 `yyss': related to states.
1840 `yyvs': related to semantic values.
1841 `yyls': related to locations.
1843 Refer to the stacks thru separate pointers, to allow yyoverflow
1844 to reallocate them elsewhere. */
1846 /* The state stack. */
1847 yytype_int16 yyssa
[YYINITDEPTH
];
1849 yytype_int16
*yyssp
;
1851 /* The semantic value stack. */
1852 YYSTYPE yyvsa
[YYINITDEPTH
];
1856 /* The location stack. */
1857 YYLTYPE yylsa
[YYINITDEPTH
];
1861 /* The locations where the error started and ended. */
1862 YYLTYPE yyerror_range
[2];
1864 YYSIZE_T yystacksize
;
1868 /* Lookahead token as an internal (translated) token number. */
1870 /* The variables used to return semantic value and location from the
1876 /* Buffer for error messages, and its allocated size. */
1878 char *yymsg
= yymsgbuf
;
1879 YYSIZE_T yymsg_alloc
= sizeof yymsgbuf
;
1882 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
1884 /* The number of symbols on the RHS of the reduced rule.
1885 Keep to zero when no symbol should be popped. */
1892 yystacksize
= YYINITDEPTH
;
1894 YYDPRINTF ((stderr
, "Starting parse\n"));
1899 yychar
= YYEMPTY
; /* Cause a token to be read. */
1901 /* Initialize stack pointers.
1902 Waste one element of value and location stack
1903 so that they stay on the same level as the state stack.
1904 The wasted elements are never initialized. */
1909 #if YYLTYPE_IS_TRIVIAL
1910 /* Initialize the default location before parsing starts. */
1911 yylloc
.first_line
= yylloc
.last_line
= 1;
1912 yylloc
.first_column
= yylloc
.last_column
= 1;
1917 /*------------------------------------------------------------.
1918 | yynewstate -- Push a new state, which is found in yystate. |
1919 `------------------------------------------------------------*/
1921 /* In all cases, when you get here, the value and location stacks
1922 have just been pushed. So pushing a state here evens the stacks. */
1928 if (yyss
+ yystacksize
- 1 <= yyssp
)
1930 /* Get the current used size of the three stacks, in elements. */
1931 YYSIZE_T yysize
= yyssp
- yyss
+ 1;
1935 /* Give user a chance to reallocate the stack. Use copies of
1936 these so that the &'s don't force the real ones into
1938 YYSTYPE
*yyvs1
= yyvs
;
1939 yytype_int16
*yyss1
= yyss
;
1940 YYLTYPE
*yyls1
= yyls
;
1942 /* Each stack pointer address is followed by the size of the
1943 data in use in that stack, in bytes. This used to be a
1944 conditional around just the two extra args, but that might
1945 be undefined if yyoverflow is a macro. */
1946 yyoverflow (YY_("memory exhausted"),
1947 &yyss1
, yysize
* sizeof (*yyssp
),
1948 &yyvs1
, yysize
* sizeof (*yyvsp
),
1949 &yyls1
, yysize
* sizeof (*yylsp
),
1956 #else /* no yyoverflow */
1957 # ifndef YYSTACK_RELOCATE
1958 goto yyexhaustedlab
;
1960 /* Extend the stack our own way. */
1961 if (YYMAXDEPTH
<= yystacksize
)
1962 goto yyexhaustedlab
;
1964 if (YYMAXDEPTH
< yystacksize
)
1965 yystacksize
= YYMAXDEPTH
;
1968 yytype_int16
*yyss1
= yyss
;
1969 union yyalloc
*yyptr
=
1970 (union yyalloc
*) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize
));
1972 goto yyexhaustedlab
;
1973 YYSTACK_RELOCATE (yyss_alloc
, yyss
);
1974 YYSTACK_RELOCATE (yyvs_alloc
, yyvs
);
1975 YYSTACK_RELOCATE (yyls_alloc
, yyls
);
1976 # undef YYSTACK_RELOCATE
1978 YYSTACK_FREE (yyss1
);
1981 #endif /* no yyoverflow */
1983 yyssp
= yyss
+ yysize
- 1;
1984 yyvsp
= yyvs
+ yysize
- 1;
1985 yylsp
= yyls
+ yysize
- 1;
1987 YYDPRINTF ((stderr
, "Stack size increased to %lu\n",
1988 (unsigned long int) yystacksize
));
1990 if (yyss
+ yystacksize
- 1 <= yyssp
)
1994 YYDPRINTF ((stderr
, "Entering state %d\n", yystate
));
1996 if (yystate
== YYFINAL
)
2006 /* Do appropriate processing given the current state. Read a
2007 lookahead token if we need one and don't already have one. */
2009 /* First try to decide what to do without reference to lookahead token. */
2010 yyn
= yypact
[yystate
];
2011 if (yyn
== YYPACT_NINF
)
2014 /* Not known => get a lookahead token if don't already have one. */
2016 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
2017 if (yychar
== YYEMPTY
)
2019 YYDPRINTF ((stderr
, "Reading a token: "));
2023 if (yychar
<= YYEOF
)
2025 yychar
= yytoken
= YYEOF
;
2026 YYDPRINTF ((stderr
, "Now at end of input.\n"));
2030 yytoken
= YYTRANSLATE (yychar
);
2031 YY_SYMBOL_PRINT ("Next token is", yytoken
, &yylval
, &yylloc
);
2034 /* If the proper action on seeing token YYTOKEN is to reduce or to
2035 detect an error, take that action. */
2037 if (yyn
< 0 || YYLAST
< yyn
|| yycheck
[yyn
] != yytoken
)
2042 if (yyn
== 0 || yyn
== YYTABLE_NINF
)
2048 /* Count tokens shifted since error; after three, turn off error
2053 /* Shift the lookahead token. */
2054 YY_SYMBOL_PRINT ("Shifting", yytoken
, &yylval
, &yylloc
);
2056 /* Discard the shifted token. */
2065 /*-----------------------------------------------------------.
2066 | yydefault -- do the default action for the current state. |
2067 `-----------------------------------------------------------*/
2069 yyn
= yydefact
[yystate
];
2075 /*-----------------------------.
2076 | yyreduce -- Do a reduction. |
2077 `-----------------------------*/
2079 /* yyn is the number of a rule to reduce with. */
2082 /* If YYLEN is nonzero, implement the default value of the action:
2085 Otherwise, the following line sets YYVAL to garbage.
2086 This behavior is undocumented and Bison
2087 users should not rely upon it. Assigning to YYVAL
2088 unconditionally makes the parser a bit smaller, and it avoids a
2089 GCC warning that YYVAL may be used uninitialized. */
2090 yyval
= yyvsp
[1-yylen
];
2092 /* Default location. */
2093 YYLLOC_DEFAULT (yyloc
, (yylsp
- yylen
), yylen
);
2094 YY_REDUCE_PRINT (yyn
);
2099 /* Line 1455 of yacc.c */
2100 #line 269 "program_parse.y"
2102 if (state
->prog
->Target
!= GL_VERTEX_PROGRAM_ARB
) {
2103 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid fragment program header");
2106 state
->mode
= ARB_vertex
;
2112 /* Line 1455 of yacc.c */
2113 #line 277 "program_parse.y"
2115 if (state
->prog
->Target
!= GL_FRAGMENT_PROGRAM_ARB
) {
2116 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid vertex program header");
2118 state
->mode
= ARB_fragment
;
2120 state
->option
.TexRect
=
2121 (state
->ctx
->Extensions
.NV_texture_rectangle
!= GL_FALSE
);
2127 /* Line 1455 of yacc.c */
2128 #line 293 "program_parse.y"
2132 if (state
->mode
== ARB_vertex
) {
2133 valid
= _mesa_ARBvp_parse_option(state
, (yyvsp
[(2) - (3)].string
));
2134 } else if (state
->mode
== ARB_fragment
) {
2135 valid
= _mesa_ARBfp_parse_option(state
, (yyvsp
[(2) - (3)].string
));
2140 const char *const err_str
= (state
->mode
== ARB_vertex
)
2141 ? "invalid ARB vertex program option"
2142 : "invalid ARB fragment program option";
2144 yyerror(& (yylsp
[(2) - (3)]), state
, err_str
);
2152 /* Line 1455 of yacc.c */
2153 #line 319 "program_parse.y"
2155 if ((yyvsp
[(1) - (2)].inst
) != NULL
) {
2156 if (state
->inst_tail
== NULL
) {
2157 state
->inst_head
= (yyvsp
[(1) - (2)].inst
);
2159 state
->inst_tail
->next
= (yyvsp
[(1) - (2)].inst
);
2162 state
->inst_tail
= (yyvsp
[(1) - (2)].inst
);
2163 (yyvsp
[(1) - (2)].inst
)->next
= NULL
;
2165 state
->prog
->NumInstructions
++;
2172 /* Line 1455 of yacc.c */
2173 #line 337 "program_parse.y"
2175 (yyval
.inst
) = (yyvsp
[(1) - (1)].inst
);
2176 state
->prog
->NumAluInstructions
++;
2182 /* Line 1455 of yacc.c */
2183 #line 342 "program_parse.y"
2185 (yyval
.inst
) = (yyvsp
[(1) - (1)].inst
);
2186 state
->prog
->NumTexInstructions
++;
2192 /* Line 1455 of yacc.c */
2193 #line 363 "program_parse.y"
2195 (yyval
.inst
) = asm_instruction_ctor(OPCODE_ARL
, & (yyvsp
[(2) - (4)].dst_reg
), & (yyvsp
[(4) - (4)].src_reg
), NULL
, NULL
);
2201 /* Line 1455 of yacc.c */
2202 #line 369 "program_parse.y"
2204 (yyval
.inst
) = asm_instruction_copy_ctor(& (yyvsp
[(1) - (4)].temp_inst
), & (yyvsp
[(2) - (4)].dst_reg
), & (yyvsp
[(4) - (4)].src_reg
), NULL
, NULL
);
2210 /* Line 1455 of yacc.c */
2211 #line 375 "program_parse.y"
2213 (yyval
.inst
) = asm_instruction_copy_ctor(& (yyvsp
[(1) - (4)].temp_inst
), & (yyvsp
[(2) - (4)].dst_reg
), & (yyvsp
[(4) - (4)].src_reg
), NULL
, NULL
);
2219 /* Line 1455 of yacc.c */
2220 #line 381 "program_parse.y"
2222 (yyval
.inst
) = asm_instruction_copy_ctor(& (yyvsp
[(1) - (6)].temp_inst
), & (yyvsp
[(2) - (6)].dst_reg
), & (yyvsp
[(4) - (6)].src_reg
), & (yyvsp
[(6) - (6)].src_reg
), NULL
);
2228 /* Line 1455 of yacc.c */
2229 #line 388 "program_parse.y"
2231 (yyval
.inst
) = asm_instruction_copy_ctor(& (yyvsp
[(1) - (6)].temp_inst
), & (yyvsp
[(2) - (6)].dst_reg
), & (yyvsp
[(4) - (6)].src_reg
), & (yyvsp
[(6) - (6)].src_reg
), NULL
);
2237 /* Line 1455 of yacc.c */
2238 #line 395 "program_parse.y"
2240 (yyval
.inst
) = asm_instruction_copy_ctor(& (yyvsp
[(1) - (8)].temp_inst
), & (yyvsp
[(2) - (8)].dst_reg
), & (yyvsp
[(4) - (8)].src_reg
), & (yyvsp
[(6) - (8)].src_reg
), & (yyvsp
[(8) - (8)].src_reg
));
2246 /* Line 1455 of yacc.c */
2247 #line 401 "program_parse.y"
2249 (yyval
.inst
) = asm_instruction_copy_ctor(& (yyvsp
[(1) - (8)].temp_inst
), & (yyvsp
[(2) - (8)].dst_reg
), & (yyvsp
[(4) - (8)].src_reg
), NULL
, NULL
);
2250 if ((yyval
.inst
) != NULL
) {
2251 const GLbitfield tex_mask
= (1U << (yyvsp
[(6) - (8)].integer
));
2252 GLbitfield shadow_tex
= 0;
2253 GLbitfield target_mask
= 0;
2256 (yyval
.inst
)->Base
.TexSrcUnit
= (yyvsp
[(6) - (8)].integer
);
2258 if ((yyvsp
[(8) - (8)].integer
) < 0) {
2259 shadow_tex
= tex_mask
;
2261 (yyval
.inst
)->Base
.TexSrcTarget
= -(yyvsp
[(8) - (8)].integer
);
2262 (yyval
.inst
)->Base
.TexShadow
= 1;
2264 (yyval
.inst
)->Base
.TexSrcTarget
= (yyvsp
[(8) - (8)].integer
);
2267 target_mask
= (1U << (yyval
.inst
)->Base
.TexSrcTarget
);
2269 /* If this texture unit was previously accessed and that access
2270 * had a different texture target, generate an error.
2272 * If this texture unit was previously accessed and that access
2273 * had a different shadow mode, generate an error.
2275 if ((state
->prog
->TexturesUsed
[(yyvsp
[(6) - (8)].integer
)] != 0)
2276 && ((state
->prog
->TexturesUsed
[(yyvsp
[(6) - (8)].integer
)] != target_mask
)
2277 || ((state
->prog
->ShadowSamplers
& tex_mask
)
2279 yyerror(& (yylsp
[(8) - (8)]), state
,
2280 "multiple targets used on one texture image unit");
2285 state
->prog
->TexturesUsed
[(yyvsp
[(6) - (8)].integer
)] |= target_mask
;
2286 state
->prog
->ShadowSamplers
|= shadow_tex
;
2293 /* Line 1455 of yacc.c */
2294 #line 445 "program_parse.y"
2296 (yyval
.inst
) = asm_instruction_ctor(OPCODE_KIL
, NULL
, & (yyvsp
[(2) - (2)].src_reg
), NULL
, NULL
);
2297 state
->fragment
.UsesKill
= 1;
2303 /* Line 1455 of yacc.c */
2304 #line 452 "program_parse.y"
2306 (yyval
.inst
) = asm_instruction_copy_ctor(& (yyvsp
[(1) - (12)].temp_inst
), & (yyvsp
[(2) - (12)].dst_reg
), & (yyvsp
[(4) - (12)].src_reg
), & (yyvsp
[(6) - (12)].src_reg
), & (yyvsp
[(8) - (12)].src_reg
));
2307 if ((yyval
.inst
) != NULL
) {
2308 const GLbitfield tex_mask
= (1U << (yyvsp
[(10) - (12)].integer
));
2309 GLbitfield shadow_tex
= 0;
2310 GLbitfield target_mask
= 0;
2313 (yyval
.inst
)->Base
.TexSrcUnit
= (yyvsp
[(10) - (12)].integer
);
2315 if ((yyvsp
[(12) - (12)].integer
) < 0) {
2316 shadow_tex
= tex_mask
;
2318 (yyval
.inst
)->Base
.TexSrcTarget
= -(yyvsp
[(12) - (12)].integer
);
2319 (yyval
.inst
)->Base
.TexShadow
= 1;
2321 (yyval
.inst
)->Base
.TexSrcTarget
= (yyvsp
[(12) - (12)].integer
);
2324 target_mask
= (1U << (yyval
.inst
)->Base
.TexSrcTarget
);
2326 /* If this texture unit was previously accessed and that access
2327 * had a different texture target, generate an error.
2329 * If this texture unit was previously accessed and that access
2330 * had a different shadow mode, generate an error.
2332 if ((state
->prog
->TexturesUsed
[(yyvsp
[(10) - (12)].integer
)] != 0)
2333 && ((state
->prog
->TexturesUsed
[(yyvsp
[(10) - (12)].integer
)] != target_mask
)
2334 || ((state
->prog
->ShadowSamplers
& tex_mask
)
2336 yyerror(& (yylsp
[(12) - (12)]), state
,
2337 "multiple targets used on one texture image unit");
2342 state
->prog
->TexturesUsed
[(yyvsp
[(10) - (12)].integer
)] |= target_mask
;
2343 state
->prog
->ShadowSamplers
|= shadow_tex
;
2350 /* Line 1455 of yacc.c */
2351 #line 496 "program_parse.y"
2353 (yyval
.integer
) = (yyvsp
[(2) - (2)].integer
);
2359 /* Line 1455 of yacc.c */
2360 #line 501 "program_parse.y"
2361 { (yyval
.integer
) = TEXTURE_1D_INDEX
; ;}
2366 /* Line 1455 of yacc.c */
2367 #line 502 "program_parse.y"
2368 { (yyval
.integer
) = TEXTURE_2D_INDEX
; ;}
2373 /* Line 1455 of yacc.c */
2374 #line 503 "program_parse.y"
2375 { (yyval
.integer
) = TEXTURE_3D_INDEX
; ;}
2380 /* Line 1455 of yacc.c */
2381 #line 504 "program_parse.y"
2382 { (yyval
.integer
) = TEXTURE_CUBE_INDEX
; ;}
2387 /* Line 1455 of yacc.c */
2388 #line 505 "program_parse.y"
2389 { (yyval
.integer
) = TEXTURE_RECT_INDEX
; ;}
2394 /* Line 1455 of yacc.c */
2395 #line 506 "program_parse.y"
2396 { (yyval
.integer
) = -TEXTURE_1D_INDEX
; ;}
2401 /* Line 1455 of yacc.c */
2402 #line 507 "program_parse.y"
2403 { (yyval
.integer
) = -TEXTURE_2D_INDEX
; ;}
2408 /* Line 1455 of yacc.c */
2409 #line 508 "program_parse.y"
2410 { (yyval
.integer
) = -TEXTURE_RECT_INDEX
; ;}
2415 /* Line 1455 of yacc.c */
2416 #line 509 "program_parse.y"
2417 { (yyval
.integer
) = TEXTURE_1D_ARRAY_INDEX
; ;}
2422 /* Line 1455 of yacc.c */
2423 #line 510 "program_parse.y"
2424 { (yyval
.integer
) = TEXTURE_2D_ARRAY_INDEX
; ;}
2429 /* Line 1455 of yacc.c */
2430 #line 511 "program_parse.y"
2431 { (yyval
.integer
) = -TEXTURE_1D_ARRAY_INDEX
; ;}
2436 /* Line 1455 of yacc.c */
2437 #line 512 "program_parse.y"
2438 { (yyval
.integer
) = -TEXTURE_2D_ARRAY_INDEX
; ;}
2443 /* Line 1455 of yacc.c */
2444 #line 516 "program_parse.y"
2446 /* FIXME: Is this correct? Should the extenedSwizzle be applied
2447 * FIXME: to the existing swizzle?
2449 (yyvsp
[(4) - (6)].src_reg
).Base
.Swizzle
= (yyvsp
[(6) - (6)].swiz_mask
).swizzle
;
2450 (yyvsp
[(4) - (6)].src_reg
).Base
.Negate
= (yyvsp
[(6) - (6)].swiz_mask
).mask
;
2452 (yyval
.inst
) = asm_instruction_copy_ctor(& (yyvsp
[(1) - (6)].temp_inst
), & (yyvsp
[(2) - (6)].dst_reg
), & (yyvsp
[(4) - (6)].src_reg
), NULL
, NULL
);
2458 /* Line 1455 of yacc.c */
2459 #line 528 "program_parse.y"
2461 (yyval
.src_reg
) = (yyvsp
[(2) - (2)].src_reg
);
2463 if ((yyvsp
[(1) - (2)].negate
)) {
2464 (yyval
.src_reg
).Base
.Negate
= ~(yyval
.src_reg
).Base
.Negate
;
2471 /* Line 1455 of yacc.c */
2472 #line 536 "program_parse.y"
2474 (yyval
.src_reg
) = (yyvsp
[(3) - (4)].src_reg
);
2476 if (!state
->option
.NV_fragment
) {
2477 yyerror(& (yylsp
[(2) - (4)]), state
, "unexpected character '|'");
2481 if ((yyvsp
[(1) - (4)].negate
)) {
2482 (yyval
.src_reg
).Base
.Negate
= ~(yyval
.src_reg
).Base
.Negate
;
2485 (yyval
.src_reg
).Base
.Abs
= 1;
2491 /* Line 1455 of yacc.c */
2492 #line 553 "program_parse.y"
2494 (yyval
.src_reg
) = (yyvsp
[(1) - (2)].src_reg
);
2496 (yyval
.src_reg
).Base
.Swizzle
= _mesa_combine_swizzles((yyval
.src_reg
).Base
.Swizzle
,
2497 (yyvsp
[(2) - (2)].swiz_mask
).swizzle
);
2503 /* Line 1455 of yacc.c */
2504 #line 560 "program_parse.y"
2506 struct asm_symbol temp_sym
;
2508 if (!state
->option
.NV_fragment
) {
2509 yyerror(& (yylsp
[(1) - (1)]), state
, "expected scalar suffix");
2513 memset(& temp_sym
, 0, sizeof(temp_sym
));
2514 temp_sym
.param_binding_begin
= ~0;
2515 initialize_symbol_from_const(state
->prog
, & temp_sym
, & (yyvsp
[(1) - (1)].vector
));
2517 init_src_reg(& (yyval
.src_reg
));
2518 (yyval
.src_reg
).Base
.File
= PROGRAM_CONSTANT
;
2519 (yyval
.src_reg
).Base
.Index
= temp_sym
.param_binding_begin
;
2525 /* Line 1455 of yacc.c */
2526 #line 579 "program_parse.y"
2528 (yyval
.src_reg
) = (yyvsp
[(2) - (3)].src_reg
);
2530 if ((yyvsp
[(1) - (3)].negate
)) {
2531 (yyval
.src_reg
).Base
.Negate
= ~(yyval
.src_reg
).Base
.Negate
;
2534 (yyval
.src_reg
).Base
.Swizzle
= _mesa_combine_swizzles((yyval
.src_reg
).Base
.Swizzle
,
2535 (yyvsp
[(3) - (3)].swiz_mask
).swizzle
);
2541 /* Line 1455 of yacc.c */
2542 #line 590 "program_parse.y"
2544 (yyval
.src_reg
) = (yyvsp
[(3) - (5)].src_reg
);
2546 if (!state
->option
.NV_fragment
) {
2547 yyerror(& (yylsp
[(2) - (5)]), state
, "unexpected character '|'");
2551 if ((yyvsp
[(1) - (5)].negate
)) {
2552 (yyval
.src_reg
).Base
.Negate
= ~(yyval
.src_reg
).Base
.Negate
;
2555 (yyval
.src_reg
).Base
.Abs
= 1;
2556 (yyval
.src_reg
).Base
.Swizzle
= _mesa_combine_swizzles((yyval
.src_reg
).Base
.Swizzle
,
2557 (yyvsp
[(4) - (5)].swiz_mask
).swizzle
);
2563 /* Line 1455 of yacc.c */
2564 #line 610 "program_parse.y"
2566 (yyval
.dst_reg
) = (yyvsp
[(1) - (2)].dst_reg
);
2567 (yyval
.dst_reg
).WriteMask
= (yyvsp
[(2) - (2)].swiz_mask
).mask
;
2569 if ((yyval
.dst_reg
).File
== PROGRAM_OUTPUT
) {
2570 /* Technically speaking, this should check that it is in
2571 * vertex program mode. However, PositionInvariant can never be
2572 * set in fragment program mode, so it is somewhat irrelevant.
2574 if (state
->option
.PositionInvariant
2575 && ((yyval
.dst_reg
).Index
== VERT_RESULT_HPOS
)) {
2576 yyerror(& (yylsp
[(1) - (2)]), state
, "position-invariant programs cannot "
2581 state
->prog
->OutputsWritten
|= (1U << (yyval
.dst_reg
).Index
);
2588 /* Line 1455 of yacc.c */
2589 #line 632 "program_parse.y"
2591 init_dst_reg(& (yyval
.dst_reg
));
2592 (yyval
.dst_reg
).File
= PROGRAM_ADDRESS
;
2593 (yyval
.dst_reg
).Index
= 0;
2594 (yyval
.dst_reg
).WriteMask
= (yyvsp
[(2) - (2)].swiz_mask
).mask
;
2600 /* Line 1455 of yacc.c */
2601 #line 641 "program_parse.y"
2603 const unsigned xyzw_valid
=
2604 ((yyvsp
[(1) - (7)].ext_swizzle
).xyzw_valid
<< 0)
2605 | ((yyvsp
[(3) - (7)].ext_swizzle
).xyzw_valid
<< 1)
2606 | ((yyvsp
[(5) - (7)].ext_swizzle
).xyzw_valid
<< 2)
2607 | ((yyvsp
[(7) - (7)].ext_swizzle
).xyzw_valid
<< 3);
2608 const unsigned rgba_valid
=
2609 ((yyvsp
[(1) - (7)].ext_swizzle
).rgba_valid
<< 0)
2610 | ((yyvsp
[(3) - (7)].ext_swizzle
).rgba_valid
<< 1)
2611 | ((yyvsp
[(5) - (7)].ext_swizzle
).rgba_valid
<< 2)
2612 | ((yyvsp
[(7) - (7)].ext_swizzle
).rgba_valid
<< 3);
2614 /* All of the swizzle components have to be valid in either RGBA
2615 * or XYZW. Note that 0 and 1 are valid in both, so both masks
2616 * can have some bits set.
2618 * We somewhat deviate from the spec here. It would be really hard
2619 * to figure out which component is the error, and there probably
2620 * isn't a lot of benefit.
2622 if ((rgba_valid
!= 0x0f) && (xyzw_valid
!= 0x0f)) {
2623 yyerror(& (yylsp
[(1) - (7)]), state
, "cannot combine RGBA and XYZW swizzle "
2628 (yyval
.swiz_mask
).swizzle
= MAKE_SWIZZLE4((yyvsp
[(1) - (7)].ext_swizzle
).swz
, (yyvsp
[(3) - (7)].ext_swizzle
).swz
, (yyvsp
[(5) - (7)].ext_swizzle
).swz
, (yyvsp
[(7) - (7)].ext_swizzle
).swz
);
2629 (yyval
.swiz_mask
).mask
= ((yyvsp
[(1) - (7)].ext_swizzle
).negate
) | ((yyvsp
[(3) - (7)].ext_swizzle
).negate
<< 1) | ((yyvsp
[(5) - (7)].ext_swizzle
).negate
<< 2)
2630 | ((yyvsp
[(7) - (7)].ext_swizzle
).negate
<< 3);
2636 /* Line 1455 of yacc.c */
2637 #line 674 "program_parse.y"
2639 (yyval
.ext_swizzle
) = (yyvsp
[(2) - (2)].ext_swizzle
);
2640 (yyval
.ext_swizzle
).negate
= ((yyvsp
[(1) - (2)].negate
)) ? 1 : 0;
2646 /* Line 1455 of yacc.c */
2647 #line 681 "program_parse.y"
2649 if (((yyvsp
[(1) - (1)].integer
) != 0) && ((yyvsp
[(1) - (1)].integer
) != 1)) {
2650 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid extended swizzle selector");
2654 (yyval
.ext_swizzle
).swz
= ((yyvsp
[(1) - (1)].integer
) == 0) ? SWIZZLE_ZERO
: SWIZZLE_ONE
;
2656 /* 0 and 1 are valid for both RGBA swizzle names and XYZW
2659 (yyval
.ext_swizzle
).xyzw_valid
= 1;
2660 (yyval
.ext_swizzle
).rgba_valid
= 1;
2666 /* Line 1455 of yacc.c */
2667 #line 696 "program_parse.y"
2669 if (strlen((yyvsp
[(1) - (1)].string
)) > 1) {
2670 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid extended swizzle selector");
2674 switch ((yyvsp
[(1) - (1)].string
)[0]) {
2676 (yyval
.ext_swizzle
).swz
= SWIZZLE_X
;
2677 (yyval
.ext_swizzle
).xyzw_valid
= 1;
2680 (yyval
.ext_swizzle
).swz
= SWIZZLE_Y
;
2681 (yyval
.ext_swizzle
).xyzw_valid
= 1;
2684 (yyval
.ext_swizzle
).swz
= SWIZZLE_Z
;
2685 (yyval
.ext_swizzle
).xyzw_valid
= 1;
2688 (yyval
.ext_swizzle
).swz
= SWIZZLE_W
;
2689 (yyval
.ext_swizzle
).xyzw_valid
= 1;
2693 (yyval
.ext_swizzle
).swz
= SWIZZLE_X
;
2694 (yyval
.ext_swizzle
).rgba_valid
= 1;
2697 (yyval
.ext_swizzle
).swz
= SWIZZLE_Y
;
2698 (yyval
.ext_swizzle
).rgba_valid
= 1;
2701 (yyval
.ext_swizzle
).swz
= SWIZZLE_Z
;
2702 (yyval
.ext_swizzle
).rgba_valid
= 1;
2705 (yyval
.ext_swizzle
).swz
= SWIZZLE_W
;
2706 (yyval
.ext_swizzle
).rgba_valid
= 1;
2710 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid extended swizzle selector");
2719 /* Line 1455 of yacc.c */
2720 #line 746 "program_parse.y"
2722 struct asm_symbol
*const s
= (struct asm_symbol
*)
2723 _mesa_symbol_table_find_symbol(state
->st
, 0, (yyvsp
[(1) - (1)].string
));
2726 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid operand variable");
2728 } else if ((s
->type
!= at_param
) && (s
->type
!= at_temp
)
2729 && (s
->type
!= at_attrib
)) {
2730 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid operand variable");
2732 } else if ((s
->type
== at_param
) && s
->param_is_array
) {
2733 yyerror(& (yylsp
[(1) - (1)]), state
, "non-array access to array PARAM");
2737 init_src_reg(& (yyval
.src_reg
));
2740 (yyval
.src_reg
).Base
.File
= PROGRAM_TEMPORARY
;
2741 (yyval
.src_reg
).Base
.Index
= s
->temp_binding
;
2744 (yyval
.src_reg
).Base
.File
= s
->param_binding_type
;
2745 (yyval
.src_reg
).Base
.Index
= s
->param_binding_begin
;
2748 (yyval
.src_reg
).Base
.File
= PROGRAM_INPUT
;
2749 (yyval
.src_reg
).Base
.Index
= s
->attrib_binding
;
2750 state
->prog
->InputsRead
|= (1U << (yyval
.src_reg
).Base
.Index
);
2752 if (!validate_inputs(& (yylsp
[(1) - (1)]), state
)) {
2766 /* Line 1455 of yacc.c */
2767 #line 788 "program_parse.y"
2769 init_src_reg(& (yyval
.src_reg
));
2770 (yyval
.src_reg
).Base
.File
= PROGRAM_INPUT
;
2771 (yyval
.src_reg
).Base
.Index
= (yyvsp
[(1) - (1)].attrib
);
2772 state
->prog
->InputsRead
|= (1U << (yyval
.src_reg
).Base
.Index
);
2774 if (!validate_inputs(& (yylsp
[(1) - (1)]), state
)) {
2782 /* Line 1455 of yacc.c */
2783 #line 799 "program_parse.y"
2785 if (! (yyvsp
[(3) - (4)].src_reg
).Base
.RelAddr
2786 && ((unsigned) (yyvsp
[(3) - (4)].src_reg
).Base
.Index
>= (yyvsp
[(1) - (4)].sym
)->param_binding_length
)) {
2787 yyerror(& (yylsp
[(3) - (4)]), state
, "out of bounds array access");
2791 init_src_reg(& (yyval
.src_reg
));
2792 (yyval
.src_reg
).Base
.File
= (yyvsp
[(1) - (4)].sym
)->param_binding_type
;
2794 if ((yyvsp
[(3) - (4)].src_reg
).Base
.RelAddr
) {
2795 (yyvsp
[(1) - (4)].sym
)->param_accessed_indirectly
= 1;
2797 (yyval
.src_reg
).Base
.RelAddr
= 1;
2798 (yyval
.src_reg
).Base
.Index
= (yyvsp
[(3) - (4)].src_reg
).Base
.Index
;
2799 (yyval
.src_reg
).Symbol
= (yyvsp
[(1) - (4)].sym
);
2801 (yyval
.src_reg
).Base
.Index
= (yyvsp
[(1) - (4)].sym
)->param_binding_begin
+ (yyvsp
[(3) - (4)].src_reg
).Base
.Index
;
2808 /* Line 1455 of yacc.c */
2809 #line 820 "program_parse.y"
2811 init_src_reg(& (yyval
.src_reg
));
2812 (yyval
.src_reg
).Base
.File
= ((yyvsp
[(1) - (1)].temp_sym
).name
!= NULL
)
2813 ? (yyvsp
[(1) - (1)].temp_sym
).param_binding_type
2815 (yyval
.src_reg
).Base
.Index
= (yyvsp
[(1) - (1)].temp_sym
).param_binding_begin
;
2821 /* Line 1455 of yacc.c */
2822 #line 830 "program_parse.y"
2824 init_dst_reg(& (yyval
.dst_reg
));
2825 (yyval
.dst_reg
).File
= PROGRAM_OUTPUT
;
2826 (yyval
.dst_reg
).Index
= (yyvsp
[(1) - (1)].result
);
2832 /* Line 1455 of yacc.c */
2833 #line 836 "program_parse.y"
2835 struct asm_symbol
*const s
= (struct asm_symbol
*)
2836 _mesa_symbol_table_find_symbol(state
->st
, 0, (yyvsp
[(1) - (1)].string
));
2839 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid operand variable");
2841 } else if ((s
->type
!= at_output
) && (s
->type
!= at_temp
)) {
2842 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid operand variable");
2846 init_dst_reg(& (yyval
.dst_reg
));
2849 (yyval
.dst_reg
).File
= PROGRAM_TEMPORARY
;
2850 (yyval
.dst_reg
).Index
= s
->temp_binding
;
2853 (yyval
.dst_reg
).File
= PROGRAM_OUTPUT
;
2854 (yyval
.dst_reg
).Index
= s
->output_binding
;
2857 (yyval
.dst_reg
).File
= s
->param_binding_type
;
2858 (yyval
.dst_reg
).Index
= s
->param_binding_begin
;
2866 /* Line 1455 of yacc.c */
2867 #line 867 "program_parse.y"
2869 struct asm_symbol
*const s
= (struct asm_symbol
*)
2870 _mesa_symbol_table_find_symbol(state
->st
, 0, (yyvsp
[(1) - (1)].string
));
2873 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid operand variable");
2875 } else if ((s
->type
!= at_param
) || !s
->param_is_array
) {
2876 yyerror(& (yylsp
[(1) - (1)]), state
, "array access to non-PARAM variable");
2886 /* Line 1455 of yacc.c */
2887 #line 886 "program_parse.y"
2889 init_src_reg(& (yyval
.src_reg
));
2890 (yyval
.src_reg
).Base
.Index
= (yyvsp
[(1) - (1)].integer
);
2896 /* Line 1455 of yacc.c */
2897 #line 893 "program_parse.y"
2899 /* FINISHME: Add support for multiple address registers.
2901 /* FINISHME: Add support for 4-component address registers.
2903 init_src_reg(& (yyval
.src_reg
));
2904 (yyval
.src_reg
).Base
.RelAddr
= 1;
2905 (yyval
.src_reg
).Base
.Index
= (yyvsp
[(3) - (3)].integer
);
2911 /* Line 1455 of yacc.c */
2912 #line 904 "program_parse.y"
2913 { (yyval
.integer
) = 0; ;}
2918 /* Line 1455 of yacc.c */
2919 #line 905 "program_parse.y"
2920 { (yyval
.integer
) = (yyvsp
[(2) - (2)].integer
); ;}
2925 /* Line 1455 of yacc.c */
2926 #line 906 "program_parse.y"
2927 { (yyval
.integer
) = -(yyvsp
[(2) - (2)].integer
); ;}
2932 /* Line 1455 of yacc.c */
2933 #line 910 "program_parse.y"
2935 if (((yyvsp
[(1) - (1)].integer
) < 0) || ((yyvsp
[(1) - (1)].integer
) > 63)) {
2936 yyerror(& (yylsp
[(1) - (1)]), state
,
2937 "relative address offset too large (positive)");
2940 (yyval
.integer
) = (yyvsp
[(1) - (1)].integer
);
2947 /* Line 1455 of yacc.c */
2948 #line 922 "program_parse.y"
2950 if (((yyvsp
[(1) - (1)].integer
) < 0) || ((yyvsp
[(1) - (1)].integer
) > 64)) {
2951 yyerror(& (yylsp
[(1) - (1)]), state
,
2952 "relative address offset too large (negative)");
2955 (yyval
.integer
) = (yyvsp
[(1) - (1)].integer
);
2962 /* Line 1455 of yacc.c */
2963 #line 934 "program_parse.y"
2965 struct asm_symbol
*const s
= (struct asm_symbol
*)
2966 _mesa_symbol_table_find_symbol(state
->st
, 0, (yyvsp
[(1) - (1)].string
));
2969 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid array member");
2971 } else if (s
->type
!= at_address
) {
2972 yyerror(& (yylsp
[(1) - (1)]), state
,
2973 "invalid variable for indexed array access");
2983 /* Line 1455 of yacc.c */
2984 #line 952 "program_parse.y"
2986 if ((yyvsp
[(1) - (1)].swiz_mask
).mask
!= WRITEMASK_X
) {
2987 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid address component selector");
2990 (yyval
.swiz_mask
) = (yyvsp
[(1) - (1)].swiz_mask
);
2997 /* Line 1455 of yacc.c */
2998 #line 963 "program_parse.y"
3000 if ((yyvsp
[(1) - (1)].swiz_mask
).mask
!= WRITEMASK_X
) {
3001 yyerror(& (yylsp
[(1) - (1)]), state
,
3002 "address register write mask must be \".x\"");
3005 (yyval
.swiz_mask
) = (yyvsp
[(1) - (1)].swiz_mask
);
3012 /* Line 1455 of yacc.c */
3013 #line 979 "program_parse.y"
3014 { (yyval
.swiz_mask
).swizzle
= SWIZZLE_NOOP
; (yyval
.swiz_mask
).mask
= WRITEMASK_XYZW
; ;}
3019 /* Line 1455 of yacc.c */
3020 #line 983 "program_parse.y"
3021 { (yyval
.swiz_mask
).swizzle
= SWIZZLE_NOOP
; (yyval
.swiz_mask
).mask
= WRITEMASK_XYZW
; ;}
3026 /* Line 1455 of yacc.c */
3027 #line 995 "program_parse.y"
3029 struct asm_symbol
*const s
=
3030 declare_variable(state
, (yyvsp
[(2) - (4)].string
), at_attrib
, & (yylsp
[(2) - (4)]));
3035 s
->attrib_binding
= (yyvsp
[(4) - (4)].attrib
);
3036 state
->InputsBound
|= (1U << s
->attrib_binding
);
3038 if (!validate_inputs(& (yylsp
[(4) - (4)]), state
)) {
3047 /* Line 1455 of yacc.c */
3048 #line 1013 "program_parse.y"
3050 (yyval
.attrib
) = (yyvsp
[(2) - (2)].attrib
);
3056 /* Line 1455 of yacc.c */
3057 #line 1017 "program_parse.y"
3059 (yyval
.attrib
) = (yyvsp
[(2) - (2)].attrib
);
3065 /* Line 1455 of yacc.c */
3066 #line 1023 "program_parse.y"
3068 (yyval
.attrib
) = VERT_ATTRIB_POS
;
3074 /* Line 1455 of yacc.c */
3075 #line 1027 "program_parse.y"
3077 (yyval
.attrib
) = VERT_ATTRIB_WEIGHT
;
3083 /* Line 1455 of yacc.c */
3084 #line 1031 "program_parse.y"
3086 (yyval
.attrib
) = VERT_ATTRIB_NORMAL
;
3092 /* Line 1455 of yacc.c */
3093 #line 1035 "program_parse.y"
3095 if (!state
->ctx
->Extensions
.EXT_secondary_color
) {
3096 yyerror(& (yylsp
[(2) - (2)]), state
, "GL_EXT_secondary_color not supported");
3100 (yyval
.attrib
) = VERT_ATTRIB_COLOR0
+ (yyvsp
[(2) - (2)].integer
);
3106 /* Line 1455 of yacc.c */
3107 #line 1044 "program_parse.y"
3109 if (!state
->ctx
->Extensions
.EXT_fog_coord
) {
3110 yyerror(& (yylsp
[(1) - (1)]), state
, "GL_EXT_fog_coord not supported");
3114 (yyval
.attrib
) = VERT_ATTRIB_FOG
;
3120 /* Line 1455 of yacc.c */
3121 #line 1053 "program_parse.y"
3123 (yyval
.attrib
) = VERT_ATTRIB_TEX0
+ (yyvsp
[(2) - (2)].integer
);
3129 /* Line 1455 of yacc.c */
3130 #line 1057 "program_parse.y"
3132 yyerror(& (yylsp
[(1) - (4)]), state
, "GL_ARB_matrix_palette not supported");
3139 /* Line 1455 of yacc.c */
3140 #line 1062 "program_parse.y"
3142 (yyval
.attrib
) = VERT_ATTRIB_GENERIC0
+ (yyvsp
[(3) - (4)].integer
);
3148 /* Line 1455 of yacc.c */
3149 #line 1068 "program_parse.y"
3151 if ((unsigned) (yyvsp
[(1) - (1)].integer
) >= state
->limits
->MaxAttribs
) {
3152 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid vertex attribute reference");
3156 (yyval
.integer
) = (yyvsp
[(1) - (1)].integer
);
3162 /* Line 1455 of yacc.c */
3163 #line 1082 "program_parse.y"
3165 (yyval
.attrib
) = FRAG_ATTRIB_WPOS
;
3171 /* Line 1455 of yacc.c */
3172 #line 1086 "program_parse.y"
3174 (yyval
.attrib
) = FRAG_ATTRIB_COL0
+ (yyvsp
[(2) - (2)].integer
);
3180 /* Line 1455 of yacc.c */
3181 #line 1090 "program_parse.y"
3183 (yyval
.attrib
) = FRAG_ATTRIB_FOGC
;
3189 /* Line 1455 of yacc.c */
3190 #line 1094 "program_parse.y"
3192 (yyval
.attrib
) = FRAG_ATTRIB_TEX0
+ (yyvsp
[(2) - (2)].integer
);
3198 /* Line 1455 of yacc.c */
3199 #line 1102 "program_parse.y"
3201 struct asm_symbol
*const s
=
3202 declare_variable(state
, (yyvsp
[(2) - (3)].string
), at_param
, & (yylsp
[(2) - (3)]));
3207 s
->param_binding_type
= (yyvsp
[(3) - (3)].temp_sym
).param_binding_type
;
3208 s
->param_binding_begin
= (yyvsp
[(3) - (3)].temp_sym
).param_binding_begin
;
3209 s
->param_binding_length
= (yyvsp
[(3) - (3)].temp_sym
).param_binding_length
;
3210 s
->param_is_array
= 0;
3217 /* Line 1455 of yacc.c */
3218 #line 1118 "program_parse.y"
3220 if (((yyvsp
[(4) - (6)].integer
) != 0) && ((unsigned) (yyvsp
[(4) - (6)].integer
) != (yyvsp
[(6) - (6)].temp_sym
).param_binding_length
)) {
3221 yyerror(& (yylsp
[(4) - (6)]), state
,
3222 "parameter array size and number of bindings must match");
3225 struct asm_symbol
*const s
=
3226 declare_variable(state
, (yyvsp
[(2) - (6)].string
), (yyvsp
[(6) - (6)].temp_sym
).type
, & (yylsp
[(2) - (6)]));
3231 s
->param_binding_type
= (yyvsp
[(6) - (6)].temp_sym
).param_binding_type
;
3232 s
->param_binding_begin
= (yyvsp
[(6) - (6)].temp_sym
).param_binding_begin
;
3233 s
->param_binding_length
= (yyvsp
[(6) - (6)].temp_sym
).param_binding_length
;
3234 s
->param_is_array
= 1;
3242 /* Line 1455 of yacc.c */
3243 #line 1140 "program_parse.y"
3245 (yyval
.integer
) = 0;
3251 /* Line 1455 of yacc.c */
3252 #line 1144 "program_parse.y"
3254 if (((yyvsp
[(1) - (1)].integer
) < 1) || ((unsigned) (yyvsp
[(1) - (1)].integer
) >= state
->limits
->MaxParameters
)) {
3255 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid parameter array size");
3258 (yyval
.integer
) = (yyvsp
[(1) - (1)].integer
);
3265 /* Line 1455 of yacc.c */
3266 #line 1155 "program_parse.y"
3268 (yyval
.temp_sym
) = (yyvsp
[(2) - (2)].temp_sym
);
3274 /* Line 1455 of yacc.c */
3275 #line 1161 "program_parse.y"
3277 (yyval
.temp_sym
) = (yyvsp
[(3) - (4)].temp_sym
);
3283 /* Line 1455 of yacc.c */
3284 #line 1168 "program_parse.y"
3286 (yyvsp
[(1) - (3)].temp_sym
).param_binding_length
+= (yyvsp
[(3) - (3)].temp_sym
).param_binding_length
;
3287 (yyval
.temp_sym
) = (yyvsp
[(1) - (3)].temp_sym
);
3293 /* Line 1455 of yacc.c */
3294 #line 1175 "program_parse.y"
3296 memset(& (yyval
.temp_sym
), 0, sizeof((yyval
.temp_sym
)));
3297 (yyval
.temp_sym
).param_binding_begin
= ~0;
3298 initialize_symbol_from_state(state
->prog
, & (yyval
.temp_sym
), (yyvsp
[(1) - (1)].state
));
3304 /* Line 1455 of yacc.c */
3305 #line 1181 "program_parse.y"
3307 memset(& (yyval
.temp_sym
), 0, sizeof((yyval
.temp_sym
)));
3308 (yyval
.temp_sym
).param_binding_begin
= ~0;
3309 initialize_symbol_from_param(state
->prog
, & (yyval
.temp_sym
), (yyvsp
[(1) - (1)].state
));
3315 /* Line 1455 of yacc.c */
3316 #line 1187 "program_parse.y"
3318 memset(& (yyval
.temp_sym
), 0, sizeof((yyval
.temp_sym
)));
3319 (yyval
.temp_sym
).param_binding_begin
= ~0;
3320 initialize_symbol_from_const(state
->prog
, & (yyval
.temp_sym
), & (yyvsp
[(1) - (1)].vector
));
3326 /* Line 1455 of yacc.c */
3327 #line 1195 "program_parse.y"
3329 memset(& (yyval
.temp_sym
), 0, sizeof((yyval
.temp_sym
)));
3330 (yyval
.temp_sym
).param_binding_begin
= ~0;
3331 initialize_symbol_from_state(state
->prog
, & (yyval
.temp_sym
), (yyvsp
[(1) - (1)].state
));
3337 /* Line 1455 of yacc.c */
3338 #line 1201 "program_parse.y"
3340 memset(& (yyval
.temp_sym
), 0, sizeof((yyval
.temp_sym
)));
3341 (yyval
.temp_sym
).param_binding_begin
= ~0;
3342 initialize_symbol_from_param(state
->prog
, & (yyval
.temp_sym
), (yyvsp
[(1) - (1)].state
));
3348 /* Line 1455 of yacc.c */
3349 #line 1207 "program_parse.y"
3351 memset(& (yyval
.temp_sym
), 0, sizeof((yyval
.temp_sym
)));
3352 (yyval
.temp_sym
).param_binding_begin
= ~0;
3353 initialize_symbol_from_const(state
->prog
, & (yyval
.temp_sym
), & (yyvsp
[(1) - (1)].vector
));
3359 /* Line 1455 of yacc.c */
3360 #line 1215 "program_parse.y"
3362 memset(& (yyval
.temp_sym
), 0, sizeof((yyval
.temp_sym
)));
3363 (yyval
.temp_sym
).param_binding_begin
= ~0;
3364 initialize_symbol_from_state(state
->prog
, & (yyval
.temp_sym
), (yyvsp
[(1) - (1)].state
));
3370 /* Line 1455 of yacc.c */
3371 #line 1221 "program_parse.y"
3373 memset(& (yyval
.temp_sym
), 0, sizeof((yyval
.temp_sym
)));
3374 (yyval
.temp_sym
).param_binding_begin
= ~0;
3375 initialize_symbol_from_param(state
->prog
, & (yyval
.temp_sym
), (yyvsp
[(1) - (1)].state
));
3381 /* Line 1455 of yacc.c */
3382 #line 1227 "program_parse.y"
3384 memset(& (yyval
.temp_sym
), 0, sizeof((yyval
.temp_sym
)));
3385 (yyval
.temp_sym
).param_binding_begin
= ~0;
3386 initialize_symbol_from_const(state
->prog
, & (yyval
.temp_sym
), & (yyvsp
[(1) - (1)].vector
));
3392 /* Line 1455 of yacc.c */
3393 #line 1234 "program_parse.y"
3394 { memcpy((yyval
.state
), (yyvsp
[(1) - (1)].state
), sizeof((yyval
.state
))); ;}
3399 /* Line 1455 of yacc.c */
3400 #line 1235 "program_parse.y"
3401 { memcpy((yyval
.state
), (yyvsp
[(2) - (2)].state
), sizeof((yyval
.state
))); ;}
3406 /* Line 1455 of yacc.c */
3407 #line 1238 "program_parse.y"
3408 { memcpy((yyval
.state
), (yyvsp
[(2) - (2)].state
), sizeof((yyval
.state
))); ;}
3413 /* Line 1455 of yacc.c */
3414 #line 1239 "program_parse.y"
3415 { memcpy((yyval
.state
), (yyvsp
[(2) - (2)].state
), sizeof((yyval
.state
))); ;}
3420 /* Line 1455 of yacc.c */
3421 #line 1240 "program_parse.y"
3422 { memcpy((yyval
.state
), (yyvsp
[(2) - (2)].state
), sizeof((yyval
.state
))); ;}
3427 /* Line 1455 of yacc.c */
3428 #line 1241 "program_parse.y"
3429 { memcpy((yyval
.state
), (yyvsp
[(2) - (2)].state
), sizeof((yyval
.state
))); ;}
3434 /* Line 1455 of yacc.c */
3435 #line 1242 "program_parse.y"
3436 { memcpy((yyval
.state
), (yyvsp
[(2) - (2)].state
), sizeof((yyval
.state
))); ;}
3441 /* Line 1455 of yacc.c */
3442 #line 1243 "program_parse.y"
3443 { memcpy((yyval
.state
), (yyvsp
[(2) - (2)].state
), sizeof((yyval
.state
))); ;}
3448 /* Line 1455 of yacc.c */
3449 #line 1244 "program_parse.y"
3450 { memcpy((yyval
.state
), (yyvsp
[(2) - (2)].state
), sizeof((yyval
.state
))); ;}
3455 /* Line 1455 of yacc.c */
3456 #line 1245 "program_parse.y"
3457 { memcpy((yyval
.state
), (yyvsp
[(2) - (2)].state
), sizeof((yyval
.state
))); ;}
3462 /* Line 1455 of yacc.c */
3463 #line 1246 "program_parse.y"
3464 { memcpy((yyval
.state
), (yyvsp
[(2) - (2)].state
), sizeof((yyval
.state
))); ;}
3469 /* Line 1455 of yacc.c */
3470 #line 1247 "program_parse.y"
3471 { memcpy((yyval
.state
), (yyvsp
[(2) - (2)].state
), sizeof((yyval
.state
))); ;}
3476 /* Line 1455 of yacc.c */
3477 #line 1248 "program_parse.y"
3478 { memcpy((yyval
.state
), (yyvsp
[(2) - (2)].state
), sizeof((yyval
.state
))); ;}
3483 /* Line 1455 of yacc.c */
3484 #line 1252 "program_parse.y"
3486 memset((yyval
.state
), 0, sizeof((yyval
.state
)));
3487 (yyval
.state
)[0] = STATE_MATERIAL
;
3488 (yyval
.state
)[1] = (yyvsp
[(2) - (3)].integer
);
3489 (yyval
.state
)[2] = (yyvsp
[(3) - (3)].integer
);
3495 /* Line 1455 of yacc.c */
3496 #line 1261 "program_parse.y"
3498 (yyval
.integer
) = (yyvsp
[(1) - (1)].integer
);
3504 /* Line 1455 of yacc.c */
3505 #line 1265 "program_parse.y"
3507 (yyval
.integer
) = STATE_EMISSION
;
3513 /* Line 1455 of yacc.c */
3514 #line 1269 "program_parse.y"
3516 (yyval
.integer
) = STATE_SHININESS
;
3522 /* Line 1455 of yacc.c */
3523 #line 1275 "program_parse.y"
3525 memset((yyval
.state
), 0, sizeof((yyval
.state
)));
3526 (yyval
.state
)[0] = STATE_LIGHT
;
3527 (yyval
.state
)[1] = (yyvsp
[(3) - (5)].integer
);
3528 (yyval
.state
)[2] = (yyvsp
[(5) - (5)].integer
);
3534 /* Line 1455 of yacc.c */
3535 #line 1284 "program_parse.y"
3537 (yyval
.integer
) = (yyvsp
[(1) - (1)].integer
);
3543 /* Line 1455 of yacc.c */
3544 #line 1288 "program_parse.y"
3546 (yyval
.integer
) = STATE_POSITION
;
3552 /* Line 1455 of yacc.c */
3553 #line 1292 "program_parse.y"
3555 if (!state
->ctx
->Extensions
.EXT_point_parameters
) {
3556 yyerror(& (yylsp
[(1) - (1)]), state
, "GL_ARB_point_parameters not supported");
3560 (yyval
.integer
) = STATE_ATTENUATION
;
3566 /* Line 1455 of yacc.c */
3567 #line 1301 "program_parse.y"
3569 (yyval
.integer
) = (yyvsp
[(2) - (2)].integer
);
3575 /* Line 1455 of yacc.c */
3576 #line 1305 "program_parse.y"
3578 (yyval
.integer
) = STATE_HALF_VECTOR
;
3584 /* Line 1455 of yacc.c */
3585 #line 1311 "program_parse.y"
3587 (yyval
.integer
) = STATE_SPOT_DIRECTION
;
3593 /* Line 1455 of yacc.c */
3594 #line 1317 "program_parse.y"
3596 (yyval
.state
)[0] = (yyvsp
[(2) - (2)].state
)[0];
3597 (yyval
.state
)[1] = (yyvsp
[(2) - (2)].state
)[1];
3603 /* Line 1455 of yacc.c */
3604 #line 1324 "program_parse.y"
3606 memset((yyval
.state
), 0, sizeof((yyval
.state
)));
3607 (yyval
.state
)[0] = STATE_LIGHTMODEL_AMBIENT
;
3613 /* Line 1455 of yacc.c */
3614 #line 1329 "program_parse.y"
3616 memset((yyval
.state
), 0, sizeof((yyval
.state
)));
3617 (yyval
.state
)[0] = STATE_LIGHTMODEL_SCENECOLOR
;
3618 (yyval
.state
)[1] = (yyvsp
[(1) - (2)].integer
);
3624 /* Line 1455 of yacc.c */
3625 #line 1337 "program_parse.y"
3627 memset((yyval
.state
), 0, sizeof((yyval
.state
)));
3628 (yyval
.state
)[0] = STATE_LIGHTPROD
;
3629 (yyval
.state
)[1] = (yyvsp
[(3) - (6)].integer
);
3630 (yyval
.state
)[2] = (yyvsp
[(5) - (6)].integer
);
3631 (yyval
.state
)[3] = (yyvsp
[(6) - (6)].integer
);
3637 /* Line 1455 of yacc.c */
3638 #line 1349 "program_parse.y"
3640 memset((yyval
.state
), 0, sizeof((yyval
.state
)));
3641 (yyval
.state
)[0] = (yyvsp
[(3) - (3)].integer
);
3642 (yyval
.state
)[1] = (yyvsp
[(2) - (3)].integer
);
3648 /* Line 1455 of yacc.c */
3649 #line 1357 "program_parse.y"
3651 (yyval
.integer
) = STATE_TEXENV_COLOR
;
3657 /* Line 1455 of yacc.c */
3658 #line 1363 "program_parse.y"
3660 (yyval
.integer
) = STATE_AMBIENT
;
3666 /* Line 1455 of yacc.c */
3667 #line 1367 "program_parse.y"
3669 (yyval
.integer
) = STATE_DIFFUSE
;
3675 /* Line 1455 of yacc.c */
3676 #line 1371 "program_parse.y"
3678 (yyval
.integer
) = STATE_SPECULAR
;
3684 /* Line 1455 of yacc.c */
3685 #line 1377 "program_parse.y"
3687 if ((unsigned) (yyvsp
[(1) - (1)].integer
) >= state
->MaxLights
) {
3688 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid light selector");
3692 (yyval
.integer
) = (yyvsp
[(1) - (1)].integer
);
3698 /* Line 1455 of yacc.c */
3699 #line 1388 "program_parse.y"
3701 memset((yyval
.state
), 0, sizeof((yyval
.state
)));
3702 (yyval
.state
)[0] = STATE_TEXGEN
;
3703 (yyval
.state
)[1] = (yyvsp
[(2) - (4)].integer
);
3704 (yyval
.state
)[2] = (yyvsp
[(3) - (4)].integer
) + (yyvsp
[(4) - (4)].integer
);
3710 /* Line 1455 of yacc.c */
3711 #line 1397 "program_parse.y"
3713 (yyval
.integer
) = STATE_TEXGEN_EYE_S
;
3719 /* Line 1455 of yacc.c */
3720 #line 1401 "program_parse.y"
3722 (yyval
.integer
) = STATE_TEXGEN_OBJECT_S
;
3728 /* Line 1455 of yacc.c */
3729 #line 1406 "program_parse.y"
3731 (yyval
.integer
) = STATE_TEXGEN_EYE_S
- STATE_TEXGEN_EYE_S
;
3737 /* Line 1455 of yacc.c */
3738 #line 1410 "program_parse.y"
3740 (yyval
.integer
) = STATE_TEXGEN_EYE_T
- STATE_TEXGEN_EYE_S
;
3746 /* Line 1455 of yacc.c */
3747 #line 1414 "program_parse.y"
3749 (yyval
.integer
) = STATE_TEXGEN_EYE_R
- STATE_TEXGEN_EYE_S
;
3755 /* Line 1455 of yacc.c */
3756 #line 1418 "program_parse.y"
3758 (yyval
.integer
) = STATE_TEXGEN_EYE_Q
- STATE_TEXGEN_EYE_S
;
3764 /* Line 1455 of yacc.c */
3765 #line 1424 "program_parse.y"
3767 memset((yyval
.state
), 0, sizeof((yyval
.state
)));
3768 (yyval
.state
)[0] = (yyvsp
[(2) - (2)].integer
);
3774 /* Line 1455 of yacc.c */
3775 #line 1431 "program_parse.y"
3777 (yyval
.integer
) = STATE_FOG_COLOR
;
3783 /* Line 1455 of yacc.c */
3784 #line 1435 "program_parse.y"
3786 (yyval
.integer
) = STATE_FOG_PARAMS
;
3792 /* Line 1455 of yacc.c */
3793 #line 1441 "program_parse.y"
3795 memset((yyval
.state
), 0, sizeof((yyval
.state
)));
3796 (yyval
.state
)[0] = STATE_CLIPPLANE
;
3797 (yyval
.state
)[1] = (yyvsp
[(3) - (5)].integer
);
3803 /* Line 1455 of yacc.c */
3804 #line 1449 "program_parse.y"
3806 if ((unsigned) (yyvsp
[(1) - (1)].integer
) >= state
->MaxClipPlanes
) {
3807 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid clip plane selector");
3811 (yyval
.integer
) = (yyvsp
[(1) - (1)].integer
);
3817 /* Line 1455 of yacc.c */
3818 #line 1460 "program_parse.y"
3820 memset((yyval
.state
), 0, sizeof((yyval
.state
)));
3821 (yyval
.state
)[0] = (yyvsp
[(2) - (2)].integer
);
3827 /* Line 1455 of yacc.c */
3828 #line 1467 "program_parse.y"
3830 (yyval
.integer
) = STATE_POINT_SIZE
;
3836 /* Line 1455 of yacc.c */
3837 #line 1471 "program_parse.y"
3839 (yyval
.integer
) = STATE_POINT_ATTENUATION
;
3845 /* Line 1455 of yacc.c */
3846 #line 1477 "program_parse.y"
3848 (yyval
.state
)[0] = (yyvsp
[(1) - (5)].state
)[0];
3849 (yyval
.state
)[1] = (yyvsp
[(1) - (5)].state
)[1];
3850 (yyval
.state
)[2] = (yyvsp
[(4) - (5)].integer
);
3851 (yyval
.state
)[3] = (yyvsp
[(4) - (5)].integer
);
3852 (yyval
.state
)[4] = (yyvsp
[(1) - (5)].state
)[2];
3858 /* Line 1455 of yacc.c */
3859 #line 1487 "program_parse.y"
3861 (yyval
.state
)[0] = (yyvsp
[(1) - (2)].state
)[0];
3862 (yyval
.state
)[1] = (yyvsp
[(1) - (2)].state
)[1];
3863 (yyval
.state
)[2] = (yyvsp
[(2) - (2)].state
)[2];
3864 (yyval
.state
)[3] = (yyvsp
[(2) - (2)].state
)[3];
3865 (yyval
.state
)[4] = (yyvsp
[(1) - (2)].state
)[2];
3871 /* Line 1455 of yacc.c */
3872 #line 1497 "program_parse.y"
3874 (yyval
.state
)[2] = 0;
3875 (yyval
.state
)[3] = 3;
3881 /* Line 1455 of yacc.c */
3882 #line 1502 "program_parse.y"
3884 /* It seems logical that the matrix row range specifier would have
3885 * to specify a range or more than one row (i.e., $5 > $3).
3886 * However, the ARB_vertex_program spec says "a program will fail
3887 * to load if <a> is greater than <b>." This means that $3 == $5
3890 if ((yyvsp
[(3) - (6)].integer
) > (yyvsp
[(5) - (6)].integer
)) {
3891 yyerror(& (yylsp
[(3) - (6)]), state
, "invalid matrix row range");
3895 (yyval
.state
)[2] = (yyvsp
[(3) - (6)].integer
);
3896 (yyval
.state
)[3] = (yyvsp
[(5) - (6)].integer
);
3902 /* Line 1455 of yacc.c */
3903 #line 1520 "program_parse.y"
3905 (yyval
.state
)[0] = (yyvsp
[(2) - (3)].state
)[0];
3906 (yyval
.state
)[1] = (yyvsp
[(2) - (3)].state
)[1];
3907 (yyval
.state
)[2] = (yyvsp
[(3) - (3)].integer
);
3913 /* Line 1455 of yacc.c */
3914 #line 1528 "program_parse.y"
3916 (yyval
.integer
) = 0;
3922 /* Line 1455 of yacc.c */
3923 #line 1532 "program_parse.y"
3925 (yyval
.integer
) = (yyvsp
[(1) - (1)].integer
);
3931 /* Line 1455 of yacc.c */
3932 #line 1538 "program_parse.y"
3934 (yyval
.integer
) = STATE_MATRIX_INVERSE
;
3940 /* Line 1455 of yacc.c */
3941 #line 1542 "program_parse.y"
3943 (yyval
.integer
) = STATE_MATRIX_TRANSPOSE
;
3949 /* Line 1455 of yacc.c */
3950 #line 1546 "program_parse.y"
3952 (yyval
.integer
) = STATE_MATRIX_INVTRANS
;
3958 /* Line 1455 of yacc.c */
3959 #line 1552 "program_parse.y"
3961 if ((yyvsp
[(1) - (1)].integer
) > 3) {
3962 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid matrix row reference");
3966 (yyval
.integer
) = (yyvsp
[(1) - (1)].integer
);
3972 /* Line 1455 of yacc.c */
3973 #line 1563 "program_parse.y"
3975 (yyval
.state
)[0] = STATE_MODELVIEW_MATRIX
;
3976 (yyval
.state
)[1] = (yyvsp
[(2) - (2)].integer
);
3982 /* Line 1455 of yacc.c */
3983 #line 1568 "program_parse.y"
3985 (yyval
.state
)[0] = STATE_PROJECTION_MATRIX
;
3986 (yyval
.state
)[1] = 0;
3992 /* Line 1455 of yacc.c */
3993 #line 1573 "program_parse.y"
3995 (yyval
.state
)[0] = STATE_MVP_MATRIX
;
3996 (yyval
.state
)[1] = 0;
4002 /* Line 1455 of yacc.c */
4003 #line 1578 "program_parse.y"
4005 (yyval
.state
)[0] = STATE_TEXTURE_MATRIX
;
4006 (yyval
.state
)[1] = (yyvsp
[(2) - (2)].integer
);
4012 /* Line 1455 of yacc.c */
4013 #line 1583 "program_parse.y"
4015 yyerror(& (yylsp
[(1) - (4)]), state
, "GL_ARB_matrix_palette not supported");
4022 /* Line 1455 of yacc.c */
4023 #line 1588 "program_parse.y"
4025 (yyval
.state
)[0] = STATE_PROGRAM_MATRIX
;
4026 (yyval
.state
)[1] = (yyvsp
[(3) - (4)].integer
);
4032 /* Line 1455 of yacc.c */
4033 #line 1595 "program_parse.y"
4035 (yyval
.integer
) = 0;
4041 /* Line 1455 of yacc.c */
4042 #line 1599 "program_parse.y"
4044 (yyval
.integer
) = (yyvsp
[(1) - (1)].integer
);
4050 /* Line 1455 of yacc.c */
4051 #line 1604 "program_parse.y"
4053 /* Since GL_ARB_vertex_blend isn't supported, only modelview matrix
4056 if ((yyvsp
[(1) - (1)].integer
) != 0) {
4057 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid modelview matrix index");
4061 (yyval
.integer
) = (yyvsp
[(1) - (1)].integer
);
4067 /* Line 1455 of yacc.c */
4068 #line 1617 "program_parse.y"
4070 /* Since GL_ARB_matrix_palette isn't supported, just let any value
4071 * through here. The error will be generated later.
4073 (yyval
.integer
) = (yyvsp
[(1) - (1)].integer
);
4079 /* Line 1455 of yacc.c */
4080 #line 1625 "program_parse.y"
4082 if ((unsigned) (yyvsp
[(1) - (1)].integer
) >= state
->MaxProgramMatrices
) {
4083 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid program matrix selector");
4087 (yyval
.integer
) = (yyvsp
[(1) - (1)].integer
);
4093 /* Line 1455 of yacc.c */
4094 #line 1636 "program_parse.y"
4096 memset((yyval
.state
), 0, sizeof((yyval
.state
)));
4097 (yyval
.state
)[0] = STATE_DEPTH_RANGE
;
4103 /* Line 1455 of yacc.c */
4104 #line 1648 "program_parse.y"
4106 memset((yyval
.state
), 0, sizeof((yyval
.state
)));
4107 (yyval
.state
)[0] = state
->state_param_enum
;
4108 (yyval
.state
)[1] = STATE_ENV
;
4109 (yyval
.state
)[2] = (yyvsp
[(4) - (5)].state
)[0];
4110 (yyval
.state
)[3] = (yyvsp
[(4) - (5)].state
)[1];
4116 /* Line 1455 of yacc.c */
4117 #line 1658 "program_parse.y"
4119 (yyval
.state
)[0] = (yyvsp
[(1) - (1)].integer
);
4120 (yyval
.state
)[1] = (yyvsp
[(1) - (1)].integer
);
4126 /* Line 1455 of yacc.c */
4127 #line 1663 "program_parse.y"
4129 (yyval
.state
)[0] = (yyvsp
[(1) - (3)].integer
);
4130 (yyval
.state
)[1] = (yyvsp
[(3) - (3)].integer
);
4136 /* Line 1455 of yacc.c */
4137 #line 1670 "program_parse.y"
4139 memset((yyval
.state
), 0, sizeof((yyval
.state
)));
4140 (yyval
.state
)[0] = state
->state_param_enum
;
4141 (yyval
.state
)[1] = STATE_ENV
;
4142 (yyval
.state
)[2] = (yyvsp
[(4) - (5)].integer
);
4143 (yyval
.state
)[3] = (yyvsp
[(4) - (5)].integer
);
4149 /* Line 1455 of yacc.c */
4150 #line 1680 "program_parse.y"
4152 memset((yyval
.state
), 0, sizeof((yyval
.state
)));
4153 (yyval
.state
)[0] = state
->state_param_enum
;
4154 (yyval
.state
)[1] = STATE_LOCAL
;
4155 (yyval
.state
)[2] = (yyvsp
[(4) - (5)].state
)[0];
4156 (yyval
.state
)[3] = (yyvsp
[(4) - (5)].state
)[1];
4162 /* Line 1455 of yacc.c */
4163 #line 1689 "program_parse.y"
4165 (yyval
.state
)[0] = (yyvsp
[(1) - (1)].integer
);
4166 (yyval
.state
)[1] = (yyvsp
[(1) - (1)].integer
);
4172 /* Line 1455 of yacc.c */
4173 #line 1694 "program_parse.y"
4175 (yyval
.state
)[0] = (yyvsp
[(1) - (3)].integer
);
4176 (yyval
.state
)[1] = (yyvsp
[(3) - (3)].integer
);
4182 /* Line 1455 of yacc.c */
4183 #line 1701 "program_parse.y"
4185 memset((yyval
.state
), 0, sizeof((yyval
.state
)));
4186 (yyval
.state
)[0] = state
->state_param_enum
;
4187 (yyval
.state
)[1] = STATE_LOCAL
;
4188 (yyval
.state
)[2] = (yyvsp
[(4) - (5)].integer
);
4189 (yyval
.state
)[3] = (yyvsp
[(4) - (5)].integer
);
4195 /* Line 1455 of yacc.c */
4196 #line 1711 "program_parse.y"
4198 if ((unsigned) (yyvsp
[(1) - (1)].integer
) >= state
->limits
->MaxEnvParams
) {
4199 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid environment parameter reference");
4202 (yyval
.integer
) = (yyvsp
[(1) - (1)].integer
);
4208 /* Line 1455 of yacc.c */
4209 #line 1721 "program_parse.y"
4211 if ((unsigned) (yyvsp
[(1) - (1)].integer
) >= state
->limits
->MaxLocalParams
) {
4212 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid local parameter reference");
4215 (yyval
.integer
) = (yyvsp
[(1) - (1)].integer
);
4221 /* Line 1455 of yacc.c */
4222 #line 1736 "program_parse.y"
4224 (yyval
.vector
).count
= 4;
4225 (yyval
.vector
).data
[0] = (yyvsp
[(1) - (1)].real
);
4226 (yyval
.vector
).data
[1] = (yyvsp
[(1) - (1)].real
);
4227 (yyval
.vector
).data
[2] = (yyvsp
[(1) - (1)].real
);
4228 (yyval
.vector
).data
[3] = (yyvsp
[(1) - (1)].real
);
4234 /* Line 1455 of yacc.c */
4235 #line 1746 "program_parse.y"
4237 (yyval
.vector
).count
= 1;
4238 (yyval
.vector
).data
[0] = (yyvsp
[(1) - (1)].real
);
4239 (yyval
.vector
).data
[1] = (yyvsp
[(1) - (1)].real
);
4240 (yyval
.vector
).data
[2] = (yyvsp
[(1) - (1)].real
);
4241 (yyval
.vector
).data
[3] = (yyvsp
[(1) - (1)].real
);
4247 /* Line 1455 of yacc.c */
4248 #line 1754 "program_parse.y"
4250 (yyval
.vector
).count
= 1;
4251 (yyval
.vector
).data
[0] = (float) (yyvsp
[(1) - (1)].integer
);
4252 (yyval
.vector
).data
[1] = (float) (yyvsp
[(1) - (1)].integer
);
4253 (yyval
.vector
).data
[2] = (float) (yyvsp
[(1) - (1)].integer
);
4254 (yyval
.vector
).data
[3] = (float) (yyvsp
[(1) - (1)].integer
);
4260 /* Line 1455 of yacc.c */
4261 #line 1764 "program_parse.y"
4263 (yyval
.vector
).count
= 4;
4264 (yyval
.vector
).data
[0] = (yyvsp
[(2) - (3)].real
);
4265 (yyval
.vector
).data
[1] = 0.0f
;
4266 (yyval
.vector
).data
[2] = 0.0f
;
4267 (yyval
.vector
).data
[3] = 1.0f
;
4273 /* Line 1455 of yacc.c */
4274 #line 1772 "program_parse.y"
4276 (yyval
.vector
).count
= 4;
4277 (yyval
.vector
).data
[0] = (yyvsp
[(2) - (5)].real
);
4278 (yyval
.vector
).data
[1] = (yyvsp
[(4) - (5)].real
);
4279 (yyval
.vector
).data
[2] = 0.0f
;
4280 (yyval
.vector
).data
[3] = 1.0f
;
4286 /* Line 1455 of yacc.c */
4287 #line 1781 "program_parse.y"
4289 (yyval
.vector
).count
= 4;
4290 (yyval
.vector
).data
[0] = (yyvsp
[(2) - (7)].real
);
4291 (yyval
.vector
).data
[1] = (yyvsp
[(4) - (7)].real
);
4292 (yyval
.vector
).data
[2] = (yyvsp
[(6) - (7)].real
);
4293 (yyval
.vector
).data
[3] = 1.0f
;
4299 /* Line 1455 of yacc.c */
4300 #line 1790 "program_parse.y"
4302 (yyval
.vector
).count
= 4;
4303 (yyval
.vector
).data
[0] = (yyvsp
[(2) - (9)].real
);
4304 (yyval
.vector
).data
[1] = (yyvsp
[(4) - (9)].real
);
4305 (yyval
.vector
).data
[2] = (yyvsp
[(6) - (9)].real
);
4306 (yyval
.vector
).data
[3] = (yyvsp
[(8) - (9)].real
);
4312 /* Line 1455 of yacc.c */
4313 #line 1800 "program_parse.y"
4315 (yyval
.real
) = ((yyvsp
[(1) - (2)].negate
)) ? -(yyvsp
[(2) - (2)].real
) : (yyvsp
[(2) - (2)].real
);
4321 /* Line 1455 of yacc.c */
4322 #line 1804 "program_parse.y"
4324 (yyval
.real
) = (float)(((yyvsp
[(1) - (2)].negate
)) ? -(yyvsp
[(2) - (2)].integer
) : (yyvsp
[(2) - (2)].integer
));
4330 /* Line 1455 of yacc.c */
4331 #line 1809 "program_parse.y"
4332 { (yyval
.negate
) = FALSE
; ;}
4337 /* Line 1455 of yacc.c */
4338 #line 1810 "program_parse.y"
4339 { (yyval
.negate
) = TRUE
; ;}
4344 /* Line 1455 of yacc.c */
4345 #line 1811 "program_parse.y"
4346 { (yyval
.negate
) = FALSE
; ;}
4351 /* Line 1455 of yacc.c */
4352 #line 1814 "program_parse.y"
4353 { (yyval
.integer
) = (yyvsp
[(1) - (1)].integer
); ;}
4358 /* Line 1455 of yacc.c */
4359 #line 1817 "program_parse.y"
4360 { (yyval
.integer
) = (yyvsp
[(1) - (1)].integer
); ;}
4365 /* Line 1455 of yacc.c */
4366 #line 1821 "program_parse.y"
4368 if (!declare_variable(state
, (yyvsp
[(3) - (3)].string
), (yyvsp
[(0) - (3)].integer
), & (yylsp
[(3) - (3)]))) {
4376 /* Line 1455 of yacc.c */
4377 #line 1827 "program_parse.y"
4379 if (!declare_variable(state
, (yyvsp
[(1) - (1)].string
), (yyvsp
[(0) - (1)].integer
), & (yylsp
[(1) - (1)]))) {
4387 /* Line 1455 of yacc.c */
4388 #line 1835 "program_parse.y"
4390 struct asm_symbol
*const s
=
4391 declare_variable(state
, (yyvsp
[(2) - (4)].string
), at_output
, & (yylsp
[(2) - (4)]));
4396 s
->output_binding
= (yyvsp
[(4) - (4)].result
);
4403 /* Line 1455 of yacc.c */
4404 #line 1848 "program_parse.y"
4406 if (state
->mode
== ARB_vertex
) {
4407 (yyval
.result
) = VERT_RESULT_HPOS
;
4409 yyerror(& (yylsp
[(2) - (2)]), state
, "invalid program result name");
4417 /* Line 1455 of yacc.c */
4418 #line 1857 "program_parse.y"
4420 if (state
->mode
== ARB_vertex
) {
4421 (yyval
.result
) = VERT_RESULT_FOGC
;
4423 yyerror(& (yylsp
[(2) - (2)]), state
, "invalid program result name");
4431 /* Line 1455 of yacc.c */
4432 #line 1866 "program_parse.y"
4434 (yyval
.result
) = (yyvsp
[(2) - (2)].result
);
4440 /* Line 1455 of yacc.c */
4441 #line 1870 "program_parse.y"
4443 if (state
->mode
== ARB_vertex
) {
4444 (yyval
.result
) = VERT_RESULT_PSIZ
;
4446 yyerror(& (yylsp
[(2) - (2)]), state
, "invalid program result name");
4454 /* Line 1455 of yacc.c */
4455 #line 1879 "program_parse.y"
4457 if (state
->mode
== ARB_vertex
) {
4458 (yyval
.result
) = VERT_RESULT_TEX0
+ (yyvsp
[(3) - (3)].integer
);
4460 yyerror(& (yylsp
[(2) - (3)]), state
, "invalid program result name");
4468 /* Line 1455 of yacc.c */
4469 #line 1888 "program_parse.y"
4471 if (state
->mode
== ARB_fragment
) {
4472 (yyval
.result
) = FRAG_RESULT_DEPTH
;
4474 yyerror(& (yylsp
[(2) - (2)]), state
, "invalid program result name");
4482 /* Line 1455 of yacc.c */
4483 #line 1899 "program_parse.y"
4485 (yyval
.result
) = (yyvsp
[(2) - (3)].integer
) + (yyvsp
[(3) - (3)].integer
);
4491 /* Line 1455 of yacc.c */
4492 #line 1905 "program_parse.y"
4494 (yyval
.integer
) = (state
->mode
== ARB_vertex
)
4496 : FRAG_RESULT_COLOR
;
4502 /* Line 1455 of yacc.c */
4503 #line 1911 "program_parse.y"
4505 if (state
->mode
== ARB_vertex
) {
4506 (yyval
.integer
) = VERT_RESULT_COL0
;
4508 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid program result name");
4516 /* Line 1455 of yacc.c */
4517 #line 1920 "program_parse.y"
4519 if (state
->mode
== ARB_vertex
) {
4520 (yyval
.integer
) = VERT_RESULT_BFC0
;
4522 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid program result name");
4530 /* Line 1455 of yacc.c */
4531 #line 1931 "program_parse.y"
4533 (yyval
.integer
) = 0;
4539 /* Line 1455 of yacc.c */
4540 #line 1935 "program_parse.y"
4542 if (state
->mode
== ARB_vertex
) {
4543 (yyval
.integer
) = 0;
4545 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid program result name");
4553 /* Line 1455 of yacc.c */
4554 #line 1944 "program_parse.y"
4556 if (state
->mode
== ARB_vertex
) {
4557 (yyval
.integer
) = 1;
4559 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid program result name");
4567 /* Line 1455 of yacc.c */
4568 #line 1954 "program_parse.y"
4569 { (yyval
.integer
) = 0; ;}
4574 /* Line 1455 of yacc.c */
4575 #line 1955 "program_parse.y"
4576 { (yyval
.integer
) = 0; ;}
4581 /* Line 1455 of yacc.c */
4582 #line 1956 "program_parse.y"
4583 { (yyval
.integer
) = 1; ;}
4588 /* Line 1455 of yacc.c */
4589 #line 1959 "program_parse.y"
4590 { (yyval
.integer
) = 0; ;}
4595 /* Line 1455 of yacc.c */
4596 #line 1960 "program_parse.y"
4597 { (yyval
.integer
) = 0; ;}
4602 /* Line 1455 of yacc.c */
4603 #line 1961 "program_parse.y"
4604 { (yyval
.integer
) = 1; ;}
4609 /* Line 1455 of yacc.c */
4610 #line 1964 "program_parse.y"
4611 { (yyval
.integer
) = 0; ;}
4616 /* Line 1455 of yacc.c */
4617 #line 1965 "program_parse.y"
4618 { (yyval
.integer
) = (yyvsp
[(2) - (3)].integer
); ;}
4623 /* Line 1455 of yacc.c */
4624 #line 1968 "program_parse.y"
4625 { (yyval
.integer
) = 0; ;}
4630 /* Line 1455 of yacc.c */
4631 #line 1969 "program_parse.y"
4632 { (yyval
.integer
) = (yyvsp
[(2) - (3)].integer
); ;}
4637 /* Line 1455 of yacc.c */
4638 #line 1972 "program_parse.y"
4639 { (yyval
.integer
) = 0; ;}
4644 /* Line 1455 of yacc.c */
4645 #line 1973 "program_parse.y"
4646 { (yyval
.integer
) = (yyvsp
[(2) - (3)].integer
); ;}
4651 /* Line 1455 of yacc.c */
4652 #line 1977 "program_parse.y"
4654 if ((unsigned) (yyvsp
[(1) - (1)].integer
) >= state
->MaxTextureCoordUnits
) {
4655 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid texture coordinate unit selector");
4659 (yyval
.integer
) = (yyvsp
[(1) - (1)].integer
);
4665 /* Line 1455 of yacc.c */
4666 #line 1988 "program_parse.y"
4668 if ((unsigned) (yyvsp
[(1) - (1)].integer
) >= state
->MaxTextureImageUnits
) {
4669 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid texture image unit selector");
4673 (yyval
.integer
) = (yyvsp
[(1) - (1)].integer
);
4679 /* Line 1455 of yacc.c */
4680 #line 1999 "program_parse.y"
4682 if ((unsigned) (yyvsp
[(1) - (1)].integer
) >= state
->MaxTextureUnits
) {
4683 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid texture unit selector");
4687 (yyval
.integer
) = (yyvsp
[(1) - (1)].integer
);
4693 /* Line 1455 of yacc.c */
4694 #line 2010 "program_parse.y"
4696 struct asm_symbol
*exist
= (struct asm_symbol
*)
4697 _mesa_symbol_table_find_symbol(state
->st
, 0, (yyvsp
[(2) - (4)].string
));
4698 struct asm_symbol
*target
= (struct asm_symbol
*)
4699 _mesa_symbol_table_find_symbol(state
->st
, 0, (yyvsp
[(4) - (4)].string
));
4702 if (exist
!= NULL
) {
4703 yyerror(& (yylsp
[(2) - (4)]), state
, "redeclared identifier");
4705 } else if (target
== NULL
) {
4706 yyerror(& (yylsp
[(4) - (4)]), state
,
4707 "undefined variable binding in ALIAS statement");
4710 _mesa_symbol_table_add_symbol(state
->st
, 0, (yyvsp
[(2) - (4)].string
), target
);
4717 /* Line 1455 of yacc.c */
4718 #line 4719 "program_parse.tab.c"
4721 YY_SYMBOL_PRINT ("-> $$ =", yyr1
[yyn
], &yyval
, &yyloc
);
4725 YY_STACK_PRINT (yyss
, yyssp
);
4730 /* Now `shift' the result of the reduction. Determine what state
4731 that goes to, based on the state we popped back to and the rule
4732 number reduced by. */
4736 yystate
= yypgoto
[yyn
- YYNTOKENS
] + *yyssp
;
4737 if (0 <= yystate
&& yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
4738 yystate
= yytable
[yystate
];
4740 yystate
= yydefgoto
[yyn
- YYNTOKENS
];
4745 /*------------------------------------.
4746 | yyerrlab -- here on detecting error |
4747 `------------------------------------*/
4749 /* If not already recovering from an error, report this error. */
4753 #if ! YYERROR_VERBOSE
4754 yyerror (&yylloc
, state
, YY_("syntax error"));
4757 YYSIZE_T yysize
= yysyntax_error (0, yystate
, yychar
);
4758 if (yymsg_alloc
< yysize
&& yymsg_alloc
< YYSTACK_ALLOC_MAXIMUM
)
4760 YYSIZE_T yyalloc
= 2 * yysize
;
4761 if (! (yysize
<= yyalloc
&& yyalloc
<= YYSTACK_ALLOC_MAXIMUM
))
4762 yyalloc
= YYSTACK_ALLOC_MAXIMUM
;
4763 if (yymsg
!= yymsgbuf
)
4764 YYSTACK_FREE (yymsg
);
4765 yymsg
= (char *) YYSTACK_ALLOC (yyalloc
);
4767 yymsg_alloc
= yyalloc
;
4771 yymsg_alloc
= sizeof yymsgbuf
;
4775 if (0 < yysize
&& yysize
<= yymsg_alloc
)
4777 (void) yysyntax_error (yymsg
, yystate
, yychar
);
4778 yyerror (&yylloc
, state
, yymsg
);
4782 yyerror (&yylloc
, state
, YY_("syntax error"));
4784 goto yyexhaustedlab
;
4790 yyerror_range
[0] = yylloc
;
4792 if (yyerrstatus
== 3)
4794 /* If just tried and failed to reuse lookahead token after an
4795 error, discard it. */
4797 if (yychar
<= YYEOF
)
4799 /* Return failure if at end of input. */
4800 if (yychar
== YYEOF
)
4805 yydestruct ("Error: discarding",
4806 yytoken
, &yylval
, &yylloc
, state
);
4811 /* Else will try to reuse lookahead token after shifting the error
4816 /*---------------------------------------------------.
4817 | yyerrorlab -- error raised explicitly by YYERROR. |
4818 `---------------------------------------------------*/
4821 /* Pacify compilers like GCC when the user code never invokes
4822 YYERROR and the label yyerrorlab therefore never appears in user
4824 if (/*CONSTCOND*/ 0)
4827 yyerror_range
[0] = yylsp
[1-yylen
];
4828 /* Do not reclaim the symbols of the rule which action triggered
4832 YY_STACK_PRINT (yyss
, yyssp
);
4837 /*-------------------------------------------------------------.
4838 | yyerrlab1 -- common code for both syntax error and YYERROR. |
4839 `-------------------------------------------------------------*/
4841 yyerrstatus
= 3; /* Each real token shifted decrements this. */
4845 yyn
= yypact
[yystate
];
4846 if (yyn
!= YYPACT_NINF
)
4849 if (0 <= yyn
&& yyn
<= YYLAST
&& yycheck
[yyn
] == YYTERROR
)
4857 /* Pop the current state because it cannot handle the error token. */
4861 yyerror_range
[0] = *yylsp
;
4862 yydestruct ("Error: popping",
4863 yystos
[yystate
], yyvsp
, yylsp
, state
);
4866 YY_STACK_PRINT (yyss
, yyssp
);
4871 yyerror_range
[1] = yylloc
;
4872 /* Using YYLLOC is tempting, but would change the location of
4873 the lookahead. YYLOC is available though. */
4874 YYLLOC_DEFAULT (yyloc
, (yyerror_range
- 1), 2);
4877 /* Shift the error token. */
4878 YY_SYMBOL_PRINT ("Shifting", yystos
[yyn
], yyvsp
, yylsp
);
4884 /*-------------------------------------.
4885 | yyacceptlab -- YYACCEPT comes here. |
4886 `-------------------------------------*/
4891 /*-----------------------------------.
4892 | yyabortlab -- YYABORT comes here. |
4893 `-----------------------------------*/
4898 #if !defined(yyoverflow) || YYERROR_VERBOSE
4899 /*-------------------------------------------------.
4900 | yyexhaustedlab -- memory exhaustion comes here. |
4901 `-------------------------------------------------*/
4903 yyerror (&yylloc
, state
, YY_("memory exhausted"));
4909 if (yychar
!= YYEMPTY
)
4910 yydestruct ("Cleanup: discarding lookahead",
4911 yytoken
, &yylval
, &yylloc
, state
);
4912 /* Do not reclaim the symbols of the rule which action triggered
4913 this YYABORT or YYACCEPT. */
4915 YY_STACK_PRINT (yyss
, yyssp
);
4916 while (yyssp
!= yyss
)
4918 yydestruct ("Cleanup: popping",
4919 yystos
[*yyssp
], yyvsp
, yylsp
, state
);
4924 YYSTACK_FREE (yyss
);
4927 if (yymsg
!= yymsgbuf
)
4928 YYSTACK_FREE (yymsg
);
4930 /* Make sure YYID is used. */
4931 return YYID (yyresult
);
4936 /* Line 1675 of yacc.c */
4937 #line 2030 "program_parse.y"
4941 asm_instruction_set_operands(struct asm_instruction
*inst
,
4942 const struct prog_dst_register
*dst
,
4943 const struct asm_src_register
*src0
,
4944 const struct asm_src_register
*src1
,
4945 const struct asm_src_register
*src2
)
4947 /* In the core ARB extensions only the KIL instruction doesn't have a
4948 * destination register.
4951 init_dst_reg(& inst
->Base
.DstReg
);
4953 inst
->Base
.DstReg
= *dst
;
4956 inst
->Base
.SrcReg
[0] = src0
->Base
;
4957 inst
->SrcReg
[0] = *src0
;
4960 inst
->Base
.SrcReg
[1] = src1
->Base
;
4961 inst
->SrcReg
[1] = *src1
;
4963 init_src_reg(& inst
->SrcReg
[1]);
4967 inst
->Base
.SrcReg
[2] = src2
->Base
;
4968 inst
->SrcReg
[2] = *src2
;
4970 init_src_reg(& inst
->SrcReg
[2]);
4975 struct asm_instruction
*
4976 asm_instruction_ctor(gl_inst_opcode op
,
4977 const struct prog_dst_register
*dst
,
4978 const struct asm_src_register
*src0
,
4979 const struct asm_src_register
*src1
,
4980 const struct asm_src_register
*src2
)
4982 struct asm_instruction
*inst
= CALLOC_STRUCT(asm_instruction
);
4985 _mesa_init_instructions(& inst
->Base
, 1);
4986 inst
->Base
.Opcode
= op
;
4988 asm_instruction_set_operands(inst
, dst
, src0
, src1
, src2
);
4995 struct asm_instruction
*
4996 asm_instruction_copy_ctor(const struct prog_instruction
*base
,
4997 const struct prog_dst_register
*dst
,
4998 const struct asm_src_register
*src0
,
4999 const struct asm_src_register
*src1
,
5000 const struct asm_src_register
*src2
)
5002 struct asm_instruction
*inst
= CALLOC_STRUCT(asm_instruction
);
5005 _mesa_init_instructions(& inst
->Base
, 1);
5006 inst
->Base
.Opcode
= base
->Opcode
;
5007 inst
->Base
.SaturateMode
= base
->SaturateMode
;
5009 asm_instruction_set_operands(inst
, dst
, src0
, src1
, src2
);
5017 init_dst_reg(struct prog_dst_register
*r
)
5019 memset(r
, 0, sizeof(*r
));
5020 r
->File
= PROGRAM_UNDEFINED
;
5021 r
->WriteMask
= WRITEMASK_XYZW
;
5022 r
->CondMask
= COND_TR
;
5023 r
->CondSwizzle
= SWIZZLE_NOOP
;
5028 init_src_reg(struct asm_src_register
*r
)
5030 memset(r
, 0, sizeof(*r
));
5031 r
->Base
.File
= PROGRAM_UNDEFINED
;
5032 r
->Base
.Swizzle
= SWIZZLE_NOOP
;
5038 * Validate the set of inputs used by a program
5040 * Validates that legal sets of inputs are used by the program. In this case
5041 * "used" included both reading the input or binding the input to a name using
5042 * the \c ATTRIB command.
5045 * \c TRUE if the combination of inputs used is valid, \c FALSE otherwise.
5048 validate_inputs(struct YYLTYPE
*locp
, struct asm_parser_state
*state
)
5050 const int inputs
= state
->prog
->InputsRead
| state
->InputsBound
;
5052 if (((inputs
& 0x0ffff) & (inputs
>> 16)) != 0) {
5053 yyerror(locp
, state
, "illegal use of generic attribute and name attribute");
5062 declare_variable(struct asm_parser_state
*state
, char *name
, enum asm_type t
,
5063 struct YYLTYPE
*locp
)
5065 struct asm_symbol
*s
= NULL
;
5066 struct asm_symbol
*exist
= (struct asm_symbol
*)
5067 _mesa_symbol_table_find_symbol(state
->st
, 0, name
);
5070 if (exist
!= NULL
) {
5071 yyerror(locp
, state
, "redeclared identifier");
5073 s
= calloc(1, sizeof(struct asm_symbol
));
5079 if (state
->prog
->NumTemporaries
>= state
->limits
->MaxTemps
) {
5080 yyerror(locp
, state
, "too many temporaries declared");
5085 s
->temp_binding
= state
->prog
->NumTemporaries
;
5086 state
->prog
->NumTemporaries
++;
5090 if (state
->prog
->NumAddressRegs
>= state
->limits
->MaxAddressRegs
) {
5091 yyerror(locp
, state
, "too many address registers declared");
5096 /* FINISHME: Add support for multiple address registers.
5098 state
->prog
->NumAddressRegs
++;
5105 _mesa_symbol_table_add_symbol(state
->st
, 0, s
->name
, s
);
5106 s
->next
= state
->sym
;
5114 int add_state_reference(struct gl_program_parameter_list
*param_list
,
5115 const gl_state_index tokens
[STATE_LENGTH
])
5117 const GLuint size
= 4; /* XXX fix */
5121 name
= _mesa_program_state_string(tokens
);
5122 index
= _mesa_add_parameter(param_list
, PROGRAM_STATE_VAR
, name
,
5124 NULL
, (gl_state_index
*) tokens
, 0x0);
5125 param_list
->StateFlags
|= _mesa_program_state_flags(tokens
);
5127 /* free name string here since we duplicated it in add_parameter() */
5135 initialize_symbol_from_state(struct gl_program
*prog
,
5136 struct asm_symbol
*param_var
,
5137 const gl_state_index tokens
[STATE_LENGTH
])
5140 gl_state_index state_tokens
[STATE_LENGTH
];
5143 memcpy(state_tokens
, tokens
, sizeof(state_tokens
));
5145 param_var
->type
= at_param
;
5146 param_var
->param_binding_type
= PROGRAM_STATE_VAR
;
5148 /* If we are adding a STATE_MATRIX that has multiple rows, we need to
5149 * unroll it and call add_state_reference() for each row
5151 if ((state_tokens
[0] == STATE_MODELVIEW_MATRIX
||
5152 state_tokens
[0] == STATE_PROJECTION_MATRIX
||
5153 state_tokens
[0] == STATE_MVP_MATRIX
||
5154 state_tokens
[0] == STATE_TEXTURE_MATRIX
||
5155 state_tokens
[0] == STATE_PROGRAM_MATRIX
)
5156 && (state_tokens
[2] != state_tokens
[3])) {
5158 const int first_row
= state_tokens
[2];
5159 const int last_row
= state_tokens
[3];
5161 for (row
= first_row
; row
<= last_row
; row
++) {
5162 state_tokens
[2] = state_tokens
[3] = row
;
5164 idx
= add_state_reference(prog
->Parameters
, state_tokens
);
5165 if (param_var
->param_binding_begin
== ~0U)
5166 param_var
->param_binding_begin
= idx
;
5167 param_var
->param_binding_length
++;
5171 idx
= add_state_reference(prog
->Parameters
, state_tokens
);
5172 if (param_var
->param_binding_begin
== ~0U)
5173 param_var
->param_binding_begin
= idx
;
5174 param_var
->param_binding_length
++;
5182 initialize_symbol_from_param(struct gl_program
*prog
,
5183 struct asm_symbol
*param_var
,
5184 const gl_state_index tokens
[STATE_LENGTH
])
5187 gl_state_index state_tokens
[STATE_LENGTH
];
5190 memcpy(state_tokens
, tokens
, sizeof(state_tokens
));
5192 assert((state_tokens
[0] == STATE_VERTEX_PROGRAM
)
5193 || (state_tokens
[0] == STATE_FRAGMENT_PROGRAM
));
5194 assert((state_tokens
[1] == STATE_ENV
)
5195 || (state_tokens
[1] == STATE_LOCAL
));
5197 param_var
->type
= at_param
;
5198 param_var
->param_binding_type
= (state_tokens
[1] == STATE_ENV
)
5199 ? PROGRAM_ENV_PARAM
: PROGRAM_LOCAL_PARAM
;
5201 /* If we are adding a STATE_ENV or STATE_LOCAL that has multiple elements,
5202 * we need to unroll it and call add_state_reference() for each row
5204 if (state_tokens
[2] != state_tokens
[3]) {
5206 const int first_row
= state_tokens
[2];
5207 const int last_row
= state_tokens
[3];
5209 for (row
= first_row
; row
<= last_row
; row
++) {
5210 state_tokens
[2] = state_tokens
[3] = row
;
5212 idx
= add_state_reference(prog
->Parameters
, state_tokens
);
5213 if (param_var
->param_binding_begin
== ~0U)
5214 param_var
->param_binding_begin
= idx
;
5215 param_var
->param_binding_length
++;
5219 idx
= add_state_reference(prog
->Parameters
, state_tokens
);
5220 if (param_var
->param_binding_begin
== ~0U)
5221 param_var
->param_binding_begin
= idx
;
5222 param_var
->param_binding_length
++;
5230 initialize_symbol_from_const(struct gl_program
*prog
,
5231 struct asm_symbol
*param_var
,
5232 const struct asm_vector
*vec
)
5234 const int idx
= _mesa_add_parameter(prog
->Parameters
, PROGRAM_CONSTANT
,
5235 NULL
, vec
->count
, GL_NONE
, vec
->data
,
5238 param_var
->type
= at_param
;
5239 param_var
->param_binding_type
= PROGRAM_CONSTANT
;
5241 if (param_var
->param_binding_begin
== ~0U)
5242 param_var
->param_binding_begin
= idx
;
5243 param_var
->param_binding_length
++;
5250 make_error_string(const char *fmt
, ...)
5256 va_start(args
, fmt
);
5258 /* Call vsnprintf once to determine how large the final string is. Call it
5259 * again to do the actual formatting. from the vsnprintf manual page:
5261 * Upon successful return, these functions return the number of
5262 * characters printed (not including the trailing '\0' used to end
5263 * output to strings).
5265 length
= 1 + vsnprintf(NULL
, 0, fmt
, args
);
5267 str
= _mesa_malloc(length
);
5269 vsnprintf(str
, length
, fmt
, args
);
5279 yyerror(YYLTYPE
*locp
, struct asm_parser_state
*state
, const char *s
)
5284 err_str
= make_error_string("glProgramStringARB(%s)\n", s
);
5286 _mesa_error(state
->ctx
, GL_INVALID_OPERATION
, err_str
);
5287 _mesa_free(err_str
);
5290 err_str
= make_error_string("line %u, char %u: error: %s\n",
5291 locp
->first_line
, locp
->first_column
, s
);
5292 _mesa_set_program_error(state
->ctx
, locp
->position
, err_str
);
5295 _mesa_free(err_str
);
5301 _mesa_parse_arb_program(GLcontext
*ctx
, GLenum target
, const GLubyte
*str
,
5302 GLsizei len
, struct asm_parser_state
*state
)
5304 struct asm_instruction
*inst
;
5307 GLboolean result
= GL_FALSE
;
5309 struct asm_symbol
*sym
;
5312 state
->prog
->Target
= target
;
5313 state
->prog
->Parameters
= _mesa_new_parameter_list();
5315 /* Make a copy of the program string and force it to be NUL-terminated.
5317 strz
= (GLubyte
*) _mesa_malloc(len
+ 1);
5319 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glProgramStringARB");
5322 _mesa_memcpy (strz
, str
, len
);
5325 state
->prog
->String
= strz
;
5327 state
->st
= _mesa_symbol_table_ctor();
5329 state
->limits
= (target
== GL_VERTEX_PROGRAM_ARB
)
5330 ? & ctx
->Const
.VertexProgram
5331 : & ctx
->Const
.FragmentProgram
;
5333 state
->MaxTextureImageUnits
= ctx
->Const
.MaxTextureImageUnits
;
5334 state
->MaxTextureCoordUnits
= ctx
->Const
.MaxTextureCoordUnits
;
5335 state
->MaxTextureUnits
= ctx
->Const
.MaxTextureUnits
;
5336 state
->MaxClipPlanes
= ctx
->Const
.MaxClipPlanes
;
5337 state
->MaxLights
= ctx
->Const
.MaxLights
;
5338 state
->MaxProgramMatrices
= ctx
->Const
.MaxProgramMatrices
;
5340 state
->state_param_enum
= (target
== GL_VERTEX_PROGRAM_ARB
)
5341 ? STATE_VERTEX_PROGRAM
: STATE_FRAGMENT_PROGRAM
;
5343 _mesa_set_program_error(ctx
, -1, NULL
);
5345 _mesa_program_lexer_ctor(& state
->scanner
, state
, (const char *) str
, len
);
5347 _mesa_program_lexer_dtor(state
->scanner
);
5350 if (ctx
->Program
.ErrorPos
!= -1) {
5354 if (! _mesa_layout_parameters(state
)) {
5358 loc
.first_column
= 0;
5361 yyerror(& loc
, state
, "invalid PARAM usage");
5367 /* Add one instruction to store the "END" instruction.
5369 state
->prog
->Instructions
=
5370 _mesa_alloc_instructions(state
->prog
->NumInstructions
+ 1);
5371 inst
= state
->inst_head
;
5372 for (i
= 0; i
< state
->prog
->NumInstructions
; i
++) {
5373 struct asm_instruction
*const temp
= inst
->next
;
5375 state
->prog
->Instructions
[i
] = inst
->Base
;
5379 /* Finally, tag on an OPCODE_END instruction */
5381 const GLuint numInst
= state
->prog
->NumInstructions
;
5382 _mesa_init_instructions(state
->prog
->Instructions
+ numInst
, 1);
5383 state
->prog
->Instructions
[numInst
].Opcode
= OPCODE_END
;
5385 state
->prog
->NumInstructions
++;
5387 state
->prog
->NumParameters
= state
->prog
->Parameters
->NumParameters
;
5388 state
->prog
->NumAttributes
= _mesa_bitcount(state
->prog
->InputsRead
);
5391 * Initialize native counts to logical counts. The device driver may
5392 * change them if program is translated into a hardware program.
5394 state
->prog
->NumNativeInstructions
= state
->prog
->NumInstructions
;
5395 state
->prog
->NumNativeTemporaries
= state
->prog
->NumTemporaries
;
5396 state
->prog
->NumNativeParameters
= state
->prog
->NumParameters
;
5397 state
->prog
->NumNativeAttributes
= state
->prog
->NumAttributes
;
5398 state
->prog
->NumNativeAddressRegs
= state
->prog
->NumAddressRegs
;
5403 for (inst
= state
->inst_head
; inst
!= NULL
; inst
= temp
) {
5408 state
->inst_head
= NULL
;
5409 state
->inst_tail
= NULL
;
5411 for (sym
= state
->sym
; sym
!= NULL
; sym
= temp
) {
5414 _mesa_free((void *) sym
->name
);
5419 _mesa_symbol_table_dtor(state
->st
);