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 struct asm_instruction
*asm_instruction_ctor(gl_inst_opcode op
,
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
);
148 #define TRUE (!FALSE)
151 #define YYLLOC_DEFAULT(Current, Rhs, N) \
154 (Current).first_line = YYRHSLOC(Rhs, 1).first_line; \
155 (Current).first_column = YYRHSLOC(Rhs, 1).first_column; \
156 (Current).position = YYRHSLOC(Rhs, 1).position; \
157 (Current).last_line = YYRHSLOC(Rhs, N).last_line; \
158 (Current).last_column = YYRHSLOC(Rhs, N).last_column; \
160 (Current).first_line = YYRHSLOC(Rhs, 0).last_line; \
161 (Current).last_line = (Current).first_line; \
162 (Current).first_column = YYRHSLOC(Rhs, 0).last_column; \
163 (Current).last_column = (Current).first_column; \
164 (Current).position = YYRHSLOC(Rhs, 0).position \
165 + (Current).first_column; \
169 #define YYLEX_PARAM state->scanner
172 /* Line 189 of yacc.c */
173 #line 174 "program_parse.tab.c"
175 /* Enabling traces. */
180 /* Enabling verbose error messages. */
181 #ifdef YYERROR_VERBOSE
182 # undef YYERROR_VERBOSE
183 # define YYERROR_VERBOSE 1
185 # define YYERROR_VERBOSE 1
188 /* Enabling the token table. */
189 #ifndef YYTOKEN_TABLE
190 # define YYTOKEN_TABLE 0
197 /* Put the tokens into the symbol table, so that GDB and other debuggers
287 TEX_SHADOWRECT
= 345,
290 TEX_ARRAYSHADOW1D
= 348,
291 TEX_ARRAYSHADOW2D
= 349,
308 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
309 typedef union YYSTYPE
312 /* Line 214 of yacc.c */
313 #line 107 "program_parse.y"
315 struct asm_instruction
*inst
;
316 struct asm_symbol
*sym
;
317 struct asm_symbol temp_sym
;
318 struct asm_swizzle_mask swiz_mask
;
319 struct asm_src_register src_reg
;
320 struct prog_dst_register dst_reg
;
321 struct prog_instruction temp_inst
;
327 gl_state_index state
[STATE_LENGTH
];
329 struct asm_vector vector
;
330 gl_inst_opcode opcode
;
334 unsigned rgba_valid
:1;
335 unsigned xyzw_valid
:1;
341 /* Line 214 of yacc.c */
342 #line 343 "program_parse.tab.c"
344 # define YYSTYPE_IS_TRIVIAL 1
345 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
346 # define YYSTYPE_IS_DECLARED 1
349 #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
350 typedef struct YYLTYPE
357 # define yyltype YYLTYPE /* obsolescent; will be withdrawn */
358 # define YYLTYPE_IS_DECLARED 1
359 # define YYLTYPE_IS_TRIVIAL 1
363 /* Copy the second part of user declarations. */
365 /* Line 264 of yacc.c */
366 #line 249 "program_parse.y"
368 extern int yylex(YYSTYPE
*yylval_param
, YYLTYPE
*yylloc_param
,
372 /* Line 264 of yacc.c */
373 #line 374 "program_parse.tab.c"
380 typedef YYTYPE_UINT8 yytype_uint8
;
382 typedef unsigned char yytype_uint8
;
386 typedef YYTYPE_INT8 yytype_int8
;
387 #elif (defined __STDC__ || defined __C99__FUNC__ \
388 || defined __cplusplus || defined _MSC_VER)
389 typedef signed char yytype_int8
;
391 typedef short int yytype_int8
;
395 typedef YYTYPE_UINT16 yytype_uint16
;
397 typedef unsigned short int yytype_uint16
;
401 typedef YYTYPE_INT16 yytype_int16
;
403 typedef short int yytype_int16
;
407 # ifdef __SIZE_TYPE__
408 # define YYSIZE_T __SIZE_TYPE__
409 # elif defined size_t
410 # define YYSIZE_T size_t
411 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
412 || defined __cplusplus || defined _MSC_VER)
413 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
414 # define YYSIZE_T size_t
416 # define YYSIZE_T unsigned int
420 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
425 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
426 # define YY_(msgid) dgettext ("bison-runtime", msgid)
430 # define YY_(msgid) msgid
434 /* Suppress unused-variable warnings by "using" E. */
435 #if ! defined lint || defined __GNUC__
436 # define YYUSE(e) ((void) (e))
438 # define YYUSE(e) /* empty */
441 /* Identity function, used to suppress warnings about constant conditions. */
445 #if (defined __STDC__ || defined __C99__FUNC__ \
446 || defined __cplusplus || defined _MSC_VER)
459 #if ! defined yyoverflow || YYERROR_VERBOSE
461 /* The parser invokes alloca or malloc; define the necessary symbols. */
463 # ifdef YYSTACK_USE_ALLOCA
464 # if YYSTACK_USE_ALLOCA
466 # define YYSTACK_ALLOC __builtin_alloca
467 # elif defined __BUILTIN_VA_ARG_INCR
468 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
470 # define YYSTACK_ALLOC __alloca
471 # elif defined _MSC_VER
472 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
473 # define alloca _alloca
475 # define YYSTACK_ALLOC alloca
476 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
477 || defined __cplusplus || defined _MSC_VER)
478 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
487 # ifdef YYSTACK_ALLOC
488 /* Pacify GCC's `empty if-body' warning. */
489 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
490 # ifndef YYSTACK_ALLOC_MAXIMUM
491 /* The OS might guarantee only one guard page at the bottom of the stack,
492 and a page size can be as small as 4096 bytes. So we cannot safely
493 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
494 to allow for a few compiler-allocated temporary stack slots. */
495 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
498 # define YYSTACK_ALLOC YYMALLOC
499 # define YYSTACK_FREE YYFREE
500 # ifndef YYSTACK_ALLOC_MAXIMUM
501 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
503 # if (defined __cplusplus && ! defined _STDLIB_H \
504 && ! ((defined YYMALLOC || defined malloc) \
505 && (defined YYFREE || defined free)))
506 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
512 # define YYMALLOC malloc
513 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
514 || defined __cplusplus || defined _MSC_VER)
515 void *malloc (YYSIZE_T
); /* INFRINGES ON USER NAME SPACE */
520 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
521 || defined __cplusplus || defined _MSC_VER)
522 void free (void *); /* INFRINGES ON USER NAME SPACE */
526 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
529 #if (! defined yyoverflow \
530 && (! defined __cplusplus \
531 || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \
532 && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
534 /* A type that is properly aligned for any stack member. */
537 yytype_int16 yyss_alloc
;
542 /* The size of the maximum gap between one aligned stack and the next. */
543 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
545 /* The size of an array large to enough to hold all stacks, each with
547 # define YYSTACK_BYTES(N) \
548 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
549 + 2 * YYSTACK_GAP_MAXIMUM)
551 /* Copy COUNT objects from FROM to TO. The source and destination do
554 # if defined __GNUC__ && 1 < __GNUC__
555 # define YYCOPY(To, From, Count) \
556 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
558 # define YYCOPY(To, From, Count) \
562 for (yyi = 0; yyi < (Count); yyi++) \
563 (To)[yyi] = (From)[yyi]; \
569 /* Relocate STACK from its old location to the new one. The
570 local variables YYSIZE and YYSTACKSIZE give the old and new number of
571 elements in the stack, and YYPTR gives the new location of the
572 stack. Advance YYPTR to a properly aligned location for the next
574 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
577 YYSIZE_T yynewbytes; \
578 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
579 Stack = &yyptr->Stack_alloc; \
580 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
581 yyptr += yynewbytes / sizeof (*yyptr); \
587 /* YYFINAL -- State number of the termination state. */
589 /* YYLAST -- Last index in YYTABLE. */
592 /* YYNTOKENS -- Number of terminals. */
593 #define YYNTOKENS 115
594 /* YYNNTS -- Number of nonterminals. */
596 /* YYNRULES -- Number of rules. */
598 /* YYNRULES -- Number of states. */
599 #define YYNSTATES 436
601 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
603 #define YYMAXUTOK 360
605 #define YYTRANSLATE(YYX) \
606 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
608 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
609 static const yytype_uint8 yytranslate
[] =
611 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
612 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
613 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
614 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
615 2, 2, 2, 110, 107, 111, 2, 2, 2, 2,
616 2, 2, 2, 2, 2, 2, 2, 2, 2, 106,
617 2, 112, 2, 2, 2, 2, 2, 2, 2, 2,
618 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
619 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
620 2, 108, 2, 109, 2, 2, 2, 2, 2, 2,
621 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
622 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
623 2, 2, 2, 113, 2, 114, 2, 2, 2, 2,
624 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
625 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
626 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
627 2, 2, 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, 2, 2, 2, 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, 2, 2, 2, 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, 1, 2, 3, 4,
637 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
638 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
639 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
640 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
641 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
642 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
643 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
644 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
645 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
646 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
651 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
653 static const yytype_uint16 yyprhs
[] =
655 0, 0, 3, 8, 10, 12, 15, 16, 20, 23,
656 24, 27, 30, 32, 34, 36, 38, 40, 42, 44,
657 46, 48, 50, 52, 57, 62, 67, 74, 81, 90,
658 99, 102, 105, 107, 109, 111, 113, 115, 117, 119,
659 121, 123, 125, 127, 129, 136, 140, 144, 147, 150,
660 158, 161, 163, 165, 167, 169, 174, 176, 178, 180,
661 182, 184, 186, 188, 192, 193, 196, 199, 201, 203,
662 205, 207, 209, 211, 213, 215, 217, 218, 220, 222,
663 224, 226, 227, 229, 231, 233, 235, 237, 239, 244,
664 247, 250, 252, 255, 257, 260, 262, 265, 270, 275,
665 277, 278, 282, 284, 286, 289, 291, 294, 296, 298,
666 302, 309, 310, 312, 315, 320, 322, 326, 328, 330,
667 332, 334, 336, 338, 340, 342, 344, 346, 349, 352,
668 355, 358, 361, 364, 367, 370, 373, 376, 379, 382,
669 386, 388, 390, 392, 398, 400, 402, 404, 407, 409,
670 411, 414, 416, 419, 426, 428, 432, 434, 436, 438,
671 440, 442, 447, 449, 451, 453, 455, 457, 459, 462,
672 464, 466, 472, 474, 477, 479, 481, 487, 490, 491,
673 498, 502, 503, 505, 507, 509, 511, 513, 516, 518,
674 520, 523, 528, 533, 534, 538, 540, 542, 544, 547,
675 549, 551, 553, 555, 561, 563, 567, 573, 579, 581,
676 585, 591, 593, 595, 597, 599, 601, 603, 605, 607,
677 609, 613, 619, 627, 637, 640, 643, 645, 647, 648,
678 649, 653, 654, 658, 662, 664, 669, 672, 675, 678,
679 681, 685, 688, 692, 693, 695, 697, 698, 700, 702,
680 703, 705, 707, 708, 710, 712, 713, 717, 718, 722,
681 723, 727, 729, 731, 733
684 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
685 static const yytype_int16 yyrhs
[] =
687 116, 0, -1, 117, 118, 120, 12, -1, 3, -1,
688 4, -1, 118, 119, -1, -1, 8, 98, 106, -1,
689 120, 121, -1, -1, 122, 106, -1, 158, 106, -1,
690 123, -1, 124, -1, 125, -1, 126, -1, 127, -1,
691 128, -1, 129, -1, 130, -1, 135, -1, 131, -1,
692 132, -1, 19, 139, 107, 136, -1, 18, 138, 107,
693 137, -1, 16, 138, 107, 136, -1, 14, 138, 107,
694 136, 107, 136, -1, 13, 138, 107, 137, 107, 137,
695 -1, 17, 138, 107, 137, 107, 137, 107, 137, -1,
696 15, 138, 107, 137, 107, 133, 107, 134, -1, 20,
697 137, -1, 82, 243, -1, 83, -1, 84, -1, 85,
698 -1, 86, -1, 87, -1, 88, -1, 89, -1, 90,
699 -1, 91, -1, 92, -1, 93, -1, 94, -1, 21,
700 138, 107, 143, 107, 140, -1, 229, 143, 155, -1,
701 229, 143, 156, -1, 144, 157, -1, 152, 154, -1,
702 141, 107, 141, 107, 141, 107, 141, -1, 229, 142,
703 -1, 22, -1, 98, -1, 98, -1, 160, -1, 145,
704 108, 146, 109, -1, 174, -1, 236, -1, 98, -1,
705 98, -1, 147, -1, 148, -1, 22, -1, 152, 153,
706 149, -1, -1, 110, 150, -1, 111, 151, -1, 22,
707 -1, 22, -1, 98, -1, 102, -1, 102, -1, 102,
708 -1, 102, -1, 99, -1, 103, -1, -1, 99, -1,
709 100, -1, 101, -1, 102, -1, -1, 159, -1, 166,
710 -1, 230, -1, 232, -1, 235, -1, 248, -1, 7,
711 98, 112, 160, -1, 95, 161, -1, 37, 165, -1,
712 59, -1, 97, 163, -1, 52, -1, 28, 241, -1,
713 36, -1, 73, 242, -1, 49, 108, 164, 109, -1,
714 96, 108, 162, 109, -1, 22, -1, -1, 108, 164,
715 109, -1, 22, -1, 59, -1, 28, 241, -1, 36,
716 -1, 73, 242, -1, 167, -1, 168, -1, 10, 98,
717 170, -1, 10, 98, 108, 169, 109, 171, -1, -1,
718 22, -1, 112, 173, -1, 112, 113, 172, 114, -1,
719 175, -1, 172, 107, 175, -1, 177, -1, 213, -1,
720 223, -1, 177, -1, 213, -1, 224, -1, 176, -1,
721 214, -1, 223, -1, 177, -1, 72, 201, -1, 72,
722 178, -1, 72, 180, -1, 72, 183, -1, 72, 185,
723 -1, 72, 191, -1, 72, 187, -1, 72, 194, -1,
724 72, 196, -1, 72, 198, -1, 72, 200, -1, 72,
725 212, -1, 46, 240, 179, -1, 189, -1, 32, -1,
726 68, -1, 42, 108, 190, 109, 181, -1, 189, -1,
727 59, -1, 25, -1, 71, 182, -1, 39, -1, 31,
728 -1, 43, 184, -1, 24, -1, 240, 66, -1, 44,
729 108, 190, 109, 240, 186, -1, 189, -1, 74, 244,
730 188, -1, 28, -1, 24, -1, 30, -1, 70, -1,
731 22, -1, 75, 242, 192, 193, -1, 34, -1, 53,
732 -1, 78, -1, 79, -1, 77, -1, 76, -1, 35,
733 195, -1, 28, -1, 55, -1, 27, 108, 197, 109,
734 56, -1, 22, -1, 57, 199, -1, 69, -1, 25,
735 -1, 203, 65, 108, 206, 109, -1, 203, 202, -1,
736 -1, 65, 108, 206, 104, 206, 109, -1, 48, 207,
737 204, -1, -1, 205, -1, 40, -1, 81, -1, 41,
738 -1, 22, -1, 50, 208, -1, 62, -1, 51, -1,
739 80, 242, -1, 54, 108, 210, 109, -1, 47, 108,
740 211, 109, -1, -1, 108, 209, 109, -1, 22, -1,
741 22, -1, 22, -1, 29, 63, -1, 217, -1, 220,
742 -1, 215, -1, 218, -1, 61, 33, 108, 216, 109,
743 -1, 221, -1, 221, 104, 221, -1, 61, 33, 108,
744 221, 109, -1, 61, 45, 108, 219, 109, -1, 222,
745 -1, 222, 104, 222, -1, 61, 45, 108, 222, 109,
746 -1, 22, -1, 22, -1, 225, -1, 227, -1, 226,
747 -1, 227, -1, 228, -1, 23, -1, 22, -1, 113,
748 228, 114, -1, 113, 228, 107, 228, 114, -1, 113,
749 228, 107, 228, 107, 228, 114, -1, 113, 228, 107,
750 228, 107, 228, 107, 228, 114, -1, 229, 23, -1,
751 229, 22, -1, 110, -1, 111, -1, -1, -1, 11,
752 231, 234, -1, -1, 5, 233, 234, -1, 234, 107,
753 98, -1, 98, -1, 9, 98, 112, 236, -1, 64,
754 59, -1, 64, 36, -1, 64, 237, -1, 64, 58,
755 -1, 64, 73, 242, -1, 64, 29, -1, 28, 238,
756 239, -1, -1, 38, -1, 26, -1, -1, 60, -1,
757 67, -1, -1, 38, -1, 26, -1, -1, 60, -1,
758 67, -1, -1, 108, 245, 109, -1, -1, 108, 246,
759 109, -1, -1, 108, 247, 109, -1, 22, -1, 22,
760 -1, 22, -1, 6, 98, 112, 98, -1
763 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
764 static const yytype_uint16 yyrline
[] =
766 0, 256, 256, 259, 267, 279, 280, 283, 305, 306,
767 309, 324, 327, 332, 339, 340, 341, 342, 343, 344,
768 345, 348, 349, 352, 358, 365, 372, 380, 387, 395,
769 440, 447, 453, 454, 455, 456, 457, 458, 459, 460,
770 461, 462, 463, 464, 467, 480, 493, 506, 528, 537,
771 570, 577, 592, 642, 684, 695, 716, 726, 732, 763,
772 780, 780, 782, 789, 801, 802, 803, 806, 820, 834,
773 852, 863, 875, 877, 878, 879, 880, 883, 883, 883,
774 883, 884, 887, 888, 889, 890, 891, 892, 895, 913,
775 917, 923, 927, 931, 935, 944, 953, 957, 962, 968,
776 979, 979, 980, 982, 986, 990, 994, 1000, 1000, 1002,
777 1018, 1041, 1044, 1055, 1061, 1067, 1068, 1075, 1081, 1087,
778 1095, 1101, 1107, 1115, 1121, 1127, 1135, 1136, 1139, 1140,
779 1141, 1142, 1143, 1144, 1145, 1146, 1147, 1148, 1149, 1152,
780 1161, 1165, 1169, 1175, 1184, 1188, 1192, 1201, 1205, 1211,
781 1217, 1224, 1229, 1237, 1247, 1249, 1257, 1263, 1267, 1271,
782 1277, 1288, 1297, 1301, 1306, 1310, 1314, 1318, 1324, 1331,
783 1335, 1341, 1349, 1360, 1367, 1371, 1377, 1387, 1398, 1402,
784 1420, 1429, 1432, 1438, 1442, 1446, 1452, 1463, 1468, 1473,
785 1478, 1483, 1488, 1496, 1499, 1504, 1517, 1525, 1536, 1544,
786 1544, 1546, 1546, 1548, 1558, 1563, 1570, 1580, 1589, 1594,
787 1601, 1611, 1621, 1633, 1633, 1634, 1634, 1636, 1646, 1654,
788 1664, 1672, 1680, 1689, 1700, 1704, 1710, 1711, 1712, 1715,
789 1715, 1718, 1718, 1721, 1727, 1735, 1748, 1757, 1766, 1770,
790 1779, 1788, 1799, 1806, 1811, 1820, 1832, 1835, 1844, 1855,
791 1856, 1857, 1860, 1861, 1862, 1865, 1866, 1869, 1870, 1873,
792 1874, 1877, 1888, 1899, 1910
796 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
797 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
798 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
799 static const char *const yytname
[] =
801 "$end", "error", "$undefined", "ARBvp_10", "ARBfp_10", "ADDRESS",
802 "ALIAS", "ATTRIB", "OPTION", "OUTPUT", "PARAM", "TEMP", "END", "BIN_OP",
803 "BINSC_OP", "SAMPLE_OP", "SCALAR_OP", "TRI_OP", "VECTOR_OP", "ARL",
804 "KIL", "SWZ", "INTEGER", "REAL", "AMBIENT", "ATTENUATION", "BACK",
805 "CLIP", "COLOR", "DEPTH", "DIFFUSE", "DIRECTION", "EMISSION", "ENV",
806 "EYE", "FOG", "FOGCOORD", "FRAGMENT", "FRONT", "HALF", "INVERSE",
807 "INVTRANS", "LIGHT", "LIGHTMODEL", "LIGHTPROD", "LOCAL", "MATERIAL",
808 "MAT_PROGRAM", "MATRIX", "MATRIXINDEX", "MODELVIEW", "MVP", "NORMAL",
809 "OBJECT", "PALETTE", "PARAMS", "PLANE", "POINT_TOK", "POINTSIZE",
810 "POSITION", "PRIMARY", "PROGRAM", "PROJECTION", "RANGE", "RESULT", "ROW",
811 "SCENECOLOR", "SECONDARY", "SHININESS", "SIZE_TOK", "SPECULAR", "SPOT",
812 "STATE", "TEXCOORD", "TEXENV", "TEXGEN", "TEXGEN_Q", "TEXGEN_R",
813 "TEXGEN_S", "TEXGEN_T", "TEXTURE", "TRANSPOSE", "TEXTURE_UNIT", "TEX_1D",
814 "TEX_2D", "TEX_3D", "TEX_CUBE", "TEX_RECT", "TEX_SHADOW1D",
815 "TEX_SHADOW2D", "TEX_SHADOWRECT", "TEX_ARRAY1D", "TEX_ARRAY2D",
816 "TEX_ARRAYSHADOW1D", "TEX_ARRAYSHADOW2D", "VERTEX", "VTXATTRIB",
817 "WEIGHT", "IDENTIFIER", "MASK4", "MASK3", "MASK2", "MASK1", "SWIZZLE",
818 "DOT_DOT", "DOT", "';'", "','", "'['", "']'", "'+'", "'-'", "'='", "'{'",
819 "'}'", "$accept", "program", "language", "optionSequence", "option",
820 "statementSequence", "statement", "instruction", "ALU_instruction",
821 "TexInstruction", "ARL_instruction", "VECTORop_instruction",
822 "SCALARop_instruction", "BINSCop_instruction", "BINop_instruction",
823 "TRIop_instruction", "SAMPLE_instruction", "KIL_instruction",
824 "texImageUnit", "texTarget", "SWZ_instruction", "scalarSrcReg",
825 "swizzleSrcReg", "maskedDstReg", "maskedAddrReg", "extendedSwizzle",
826 "extSwizComp", "extSwizSel", "srcReg", "dstReg", "progParamArray",
827 "progParamArrayMem", "progParamArrayAbs", "progParamArrayRel",
828 "addrRegRelOffset", "addrRegPosOffset", "addrRegNegOffset", "addrReg",
829 "addrComponent", "addrWriteMask", "scalarSuffix", "swizzleSuffix",
830 "optionalMask", "namingStatement", "ATTRIB_statement", "attribBinding",
831 "vtxAttribItem", "vtxAttribNum", "vtxOptWeightNum", "vtxWeightNum",
832 "fragAttribItem", "PARAM_statement", "PARAM_singleStmt",
833 "PARAM_multipleStmt", "optArraySize", "paramSingleInit",
834 "paramMultipleInit", "paramMultInitList", "paramSingleItemDecl",
835 "paramSingleItemUse", "paramMultipleItem", "stateMultipleItem",
836 "stateSingleItem", "stateMaterialItem", "stateMatProperty",
837 "stateLightItem", "stateLightProperty", "stateSpotProperty",
838 "stateLightModelItem", "stateLModProperty", "stateLightProdItem",
839 "stateLProdProperty", "stateTexEnvItem", "stateTexEnvProperty",
840 "ambDiffSpecProperty", "stateLightNumber", "stateTexGenItem",
841 "stateTexGenType", "stateTexGenCoord", "stateFogItem",
842 "stateFogProperty", "stateClipPlaneItem", "stateClipPlaneNum",
843 "statePointItem", "statePointProperty", "stateMatrixRow",
844 "stateMatrixRows", "optMatrixRows", "stateMatrixItem",
845 "stateOptMatModifier", "stateMatModifier", "stateMatrixRowNum",
846 "stateMatrixName", "stateOptModMatNum", "stateModMatNum",
847 "statePaletteMatNum", "stateProgramMatNum", "stateDepthItem",
848 "programSingleItem", "programMultipleItem", "progEnvParams",
849 "progEnvParamNums", "progEnvParam", "progLocalParams",
850 "progLocalParamNums", "progLocalParam", "progEnvParamNum",
851 "progLocalParamNum", "paramConstDecl", "paramConstUse",
852 "paramConstScalarDecl", "paramConstScalarUse", "paramConstVector",
853 "signedFloatConstant", "optionalSign", "TEMP_statement", "@1",
854 "ADDRESS_statement", "@2", "varNameList", "OUTPUT_statement",
855 "resultBinding", "resultColBinding", "optResultFaceType",
856 "optResultColorType", "optFaceType", "optColorType",
857 "optTexCoordUnitNum", "optTexImageUnitNum", "optLegacyTexUnitNum",
858 "texCoordUnitNum", "texImageUnitNum", "legacyTexUnitNum",
864 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
866 static const yytype_uint16 yytoknum
[] =
868 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
869 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
870 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
871 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
872 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
873 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
874 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
875 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
876 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
877 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
878 355, 356, 357, 358, 359, 360, 59, 44, 91, 93,
883 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
884 static const yytype_uint8 yyr1
[] =
886 0, 115, 116, 117, 117, 118, 118, 119, 120, 120,
887 121, 121, 122, 122, 123, 123, 123, 123, 123, 123,
888 123, 124, 124, 125, 126, 127, 128, 129, 130, 131,
889 132, 133, 134, 134, 134, 134, 134, 134, 134, 134,
890 134, 134, 134, 134, 135, 136, 137, 138, 139, 140,
891 141, 142, 142, 143, 143, 143, 143, 144, 144, 145,
892 146, 146, 147, 148, 149, 149, 149, 150, 151, 152,
893 153, 154, 155, 156, 156, 156, 156, 157, 157, 157,
894 157, 157, 158, 158, 158, 158, 158, 158, 159, 160,
895 160, 161, 161, 161, 161, 161, 161, 161, 161, 162,
896 163, 163, 164, 165, 165, 165, 165, 166, 166, 167,
897 168, 169, 169, 170, 171, 172, 172, 173, 173, 173,
898 174, 174, 174, 175, 175, 175, 176, 176, 177, 177,
899 177, 177, 177, 177, 177, 177, 177, 177, 177, 178,
900 179, 179, 179, 180, 181, 181, 181, 181, 181, 182,
901 183, 184, 184, 185, 186, 187, 188, 189, 189, 189,
902 190, 191, 192, 192, 193, 193, 193, 193, 194, 195,
903 195, 196, 197, 198, 199, 199, 200, 201, 202, 202,
904 203, 204, 204, 205, 205, 205, 206, 207, 207, 207,
905 207, 207, 207, 208, 208, 209, 210, 211, 212, 213,
906 213, 214, 214, 215, 216, 216, 217, 218, 219, 219,
907 220, 221, 222, 223, 223, 224, 224, 225, 226, 226,
908 227, 227, 227, 227, 228, 228, 229, 229, 229, 231,
909 230, 233, 232, 234, 234, 235, 236, 236, 236, 236,
910 236, 236, 237, 238, 238, 238, 239, 239, 239, 240,
911 240, 240, 241, 241, 241, 242, 242, 243, 243, 244,
912 244, 245, 246, 247, 248
915 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
916 static const yytype_uint8 yyr2
[] =
918 0, 2, 4, 1, 1, 2, 0, 3, 2, 0,
919 2, 2, 1, 1, 1, 1, 1, 1, 1, 1,
920 1, 1, 1, 4, 4, 4, 6, 6, 8, 8,
921 2, 2, 1, 1, 1, 1, 1, 1, 1, 1,
922 1, 1, 1, 1, 6, 3, 3, 2, 2, 7,
923 2, 1, 1, 1, 1, 4, 1, 1, 1, 1,
924 1, 1, 1, 3, 0, 2, 2, 1, 1, 1,
925 1, 1, 1, 1, 1, 1, 0, 1, 1, 1,
926 1, 0, 1, 1, 1, 1, 1, 1, 4, 2,
927 2, 1, 2, 1, 2, 1, 2, 4, 4, 1,
928 0, 3, 1, 1, 2, 1, 2, 1, 1, 3,
929 6, 0, 1, 2, 4, 1, 3, 1, 1, 1,
930 1, 1, 1, 1, 1, 1, 1, 2, 2, 2,
931 2, 2, 2, 2, 2, 2, 2, 2, 2, 3,
932 1, 1, 1, 5, 1, 1, 1, 2, 1, 1,
933 2, 1, 2, 6, 1, 3, 1, 1, 1, 1,
934 1, 4, 1, 1, 1, 1, 1, 1, 2, 1,
935 1, 5, 1, 2, 1, 1, 5, 2, 0, 6,
936 3, 0, 1, 1, 1, 1, 1, 2, 1, 1,
937 2, 4, 4, 0, 3, 1, 1, 1, 2, 1,
938 1, 1, 1, 5, 1, 3, 5, 5, 1, 3,
939 5, 1, 1, 1, 1, 1, 1, 1, 1, 1,
940 3, 5, 7, 9, 2, 2, 1, 1, 0, 0,
941 3, 0, 3, 3, 1, 4, 2, 2, 2, 2,
942 3, 2, 3, 0, 1, 1, 0, 1, 1, 0,
943 1, 1, 0, 1, 1, 0, 3, 0, 3, 0,
947 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
948 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
949 means the default is an error. */
950 static const yytype_uint16 yydefact
[] =
952 0, 3, 4, 0, 6, 1, 9, 0, 5, 0,
953 0, 231, 0, 0, 0, 0, 229, 2, 0, 0,
954 0, 0, 0, 0, 0, 228, 0, 8, 0, 12,
955 13, 14, 15, 16, 17, 18, 19, 21, 22, 20,
956 0, 82, 83, 107, 108, 84, 85, 86, 87, 7,
957 0, 0, 0, 0, 0, 0, 0, 58, 0, 81,
958 57, 0, 0, 0, 0, 0, 69, 0, 0, 226,
959 227, 30, 0, 0, 10, 11, 234, 232, 0, 0,
960 0, 111, 228, 109, 230, 243, 241, 237, 239, 236,
961 255, 238, 228, 77, 78, 79, 80, 47, 228, 228,
962 228, 228, 228, 228, 71, 48, 219, 218, 0, 0,
963 0, 0, 53, 228, 76, 0, 54, 56, 120, 121,
964 199, 200, 122, 215, 216, 0, 0, 264, 88, 235,
965 112, 0, 113, 117, 118, 119, 213, 214, 217, 0,
966 245, 244, 246, 0, 240, 0, 0, 0, 0, 25,
967 0, 24, 23, 252, 105, 103, 255, 90, 0, 0,
968 0, 0, 0, 0, 249, 0, 249, 0, 0, 259,
969 255, 128, 129, 130, 131, 133, 132, 134, 135, 136,
970 137, 0, 138, 252, 95, 0, 93, 91, 255, 0,
971 100, 89, 0, 74, 73, 75, 46, 0, 0, 233,
972 0, 225, 224, 247, 248, 242, 261, 0, 228, 228,
973 0, 0, 228, 253, 254, 104, 106, 0, 0, 0,
974 198, 169, 170, 168, 0, 151, 251, 250, 150, 0,
975 0, 0, 0, 193, 189, 0, 188, 255, 181, 175,
976 174, 173, 0, 0, 0, 0, 94, 0, 96, 0,
977 0, 92, 228, 220, 62, 0, 60, 61, 0, 228,
978 0, 110, 256, 27, 26, 72, 45, 257, 0, 0,
979 211, 0, 212, 0, 172, 0, 160, 0, 152, 0,
980 157, 158, 141, 142, 159, 139, 140, 0, 0, 187,
981 0, 190, 183, 185, 184, 180, 182, 263, 0, 156,
982 155, 162, 163, 0, 0, 102, 0, 99, 0, 0,
983 0, 55, 70, 64, 44, 0, 0, 228, 0, 31,
984 0, 228, 206, 210, 0, 0, 249, 197, 0, 195,
985 0, 196, 0, 260, 167, 166, 164, 165, 161, 186,
986 0, 97, 98, 101, 228, 221, 0, 0, 63, 228,
987 51, 52, 50, 0, 0, 0, 115, 123, 126, 124,
988 201, 202, 125, 262, 0, 32, 33, 34, 35, 36,
989 37, 38, 39, 40, 41, 42, 43, 29, 28, 171,
990 146, 148, 145, 0, 143, 144, 0, 192, 194, 191,
991 176, 0, 67, 65, 68, 66, 0, 0, 0, 127,
992 178, 228, 114, 258, 149, 147, 153, 154, 228, 222,
993 228, 0, 0, 0, 177, 116, 0, 0, 0, 204,
994 0, 208, 0, 223, 228, 203, 0, 207, 0, 0,
995 49, 205, 209, 0, 0, 179
998 /* YYDEFGOTO[NTERM-NUM]. */
999 static const yytype_int16 yydefgoto
[] =
1001 -1, 3, 4, 6, 8, 9, 27, 28, 29, 30,
1002 31, 32, 33, 34, 35, 36, 37, 38, 268, 377,
1003 39, 146, 71, 58, 67, 314, 315, 352, 114, 59,
1004 115, 255, 256, 257, 348, 393, 395, 68, 313, 105,
1005 266, 196, 97, 40, 41, 116, 191, 308, 251, 306,
1006 157, 42, 43, 44, 131, 83, 261, 355, 132, 117,
1007 356, 357, 118, 171, 285, 172, 384, 405, 173, 228,
1008 174, 406, 175, 300, 286, 277, 176, 303, 338, 177,
1009 223, 178, 275, 179, 241, 180, 399, 414, 181, 295,
1010 296, 340, 238, 289, 330, 332, 328, 182, 119, 359,
1011 360, 418, 120, 361, 420, 121, 271, 273, 362, 122,
1012 136, 123, 124, 138, 72, 45, 55, 46, 50, 77,
1013 47, 60, 91, 142, 205, 229, 215, 144, 319, 243,
1017 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
1019 #define YYPACT_NINF -369
1020 static const yytype_int16 yypact
[] =
1022 143, -369, -369, 36, -369, -369, 45, -39, -369, 169,
1023 -33, -369, -19, -6, -4, 12, -369, -369, -34, -34,
1024 -34, -34, -34, -34, 15, 62, -34, -369, 26, -369,
1025 -369, -369, -369, -369, -369, -369, -369, -369, -369, -369,
1026 60, -369, -369, -369, -369, -369, -369, -369, -369, -369,
1027 20, 56, 107, 110, 37, 20, -3, -369, 111, 109,
1028 -369, 113, 114, 116, 117, 118, -369, 119, 125, -369,
1029 -369, -369, -15, 121, -369, -369, -369, 122, 132, -18,
1030 167, 210, -11, -369, 122, 63, -369, -369, -369, -369,
1031 130, -369, 62, -369, -369, -369, -369, -369, 62, 62,
1032 62, 62, 62, 62, -369, -369, -369, -369, 9, 72,
1033 87, -1, 131, 62, 104, 134, -369, -369, -369, -369,
1034 -369, -369, -369, -369, -369, -15, 142, -369, -369, -369,
1035 -369, 135, -369, -369, -369, -369, -369, -369, -369, 182,
1036 -369, -369, 52, 219, -369, 138, 139, -15, 140, -369,
1037 141, -369, -369, 61, -369, -369, 130, -369, 144, 145,
1038 146, 180, 11, 147, 85, 148, 99, 89, -2, 149,
1039 130, -369, -369, -369, -369, -369, -369, -369, -369, -369,
1040 -369, 184, -369, 61, -369, 150, -369, -369, 130, 151,
1041 152, -369, 27, -369, -369, -369, -369, -10, 154, -369,
1042 153, -369, -369, -369, -369, -369, -369, 155, 62, 62,
1043 161, 168, 62, -369, -369, -369, -369, 229, 244, 246,
1044 -369, -369, -369, -369, 247, -369, -369, -369, -369, 204,
1045 247, 17, 163, 164, -369, 165, -369, 130, 67, -369,
1046 -369, -369, 252, 248, 18, 170, -369, 253, -369, 255,
1047 253, -369, 62, -369, -369, 171, -369, -369, 177, 62,
1048 172, -369, -369, -369, -369, -369, -369, 173, 175, 176,
1049 -369, 178, -369, 179, -369, 181, -369, 183, -369, 185,
1050 -369, -369, -369, -369, -369, -369, -369, 262, 264, -369,
1051 267, -369, -369, -369, -369, -369, -369, -369, 186, -369,
1052 -369, -369, -369, 136, 269, -369, 187, -369, 188, 190,
1053 43, -369, -369, 106, -369, 193, -5, -7, 271, -369,
1054 108, 62, -369, -369, 245, 4, 99, -369, 194, -369,
1055 195, -369, 196, -369, -369, -369, -369, -369, -369, -369,
1056 197, -369, -369, -369, 62, -369, 280, 285, -369, 62,
1057 -369, -369, -369, 93, 87, 53, -369, -369, -369, -369,
1058 -369, -369, -369, -369, 199, -369, -369, -369, -369, -369,
1059 -369, -369, -369, -369, -369, -369, -369, -369, -369, -369,
1060 -369, -369, -369, 278, -369, -369, 8, -369, -369, -369,
1061 -369, 57, -369, -369, -369, -369, 203, 205, 206, -369,
1062 250, -7, -369, -369, -369, -369, -369, -369, 62, -369,
1063 62, 229, 244, 208, -369, -369, 198, 211, 202, 213,
1064 214, 218, 269, -369, 62, -369, 229, -369, 244, 54,
1065 -369, -369, -369, 269, 215, -369
1068 /* YYPGOTO[NTERM-NUM]. */
1069 static const yytype_int16 yypgoto
[] =
1071 -369, -369, -369, -369, -369, -369, -369, -369, -369, -369,
1072 -369, -369, -369, -369, -369, -369, -369, -369, -369, -369,
1073 -369, -94, -88, 133, -369, -369, -334, -369, -85, -369,
1074 -369, -369, -369, -369, -369, -369, -369, 128, -369, -369,
1075 -369, -369, -369, -369, -369, 251, -369, -369, -369, 77,
1076 -369, -369, -369, -369, -369, -369, -369, -369, -369, -369,
1077 -72, -369, -81, -369, -369, -369, -369, -369, -369, -369,
1078 -369, -369, -369, -369, -305, 101, -369, -369, -369, -369,
1079 -369, -369, -369, -369, -369, -369, -369, -369, -22, -369,
1080 -369, -336, -369, -369, -369, -369, -369, -369, 254, -369,
1081 -369, -369, -369, -369, -369, -369, -342, -368, 256, -369,
1082 -369, -369, -80, -110, -82, -369, -369, -369, -369, 279,
1083 -369, 257, -369, -369, -369, -161, 156, -146, -369, -369,
1084 -369, -369, -369, -369
1087 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
1088 positive, shift that token. If negative, reduce the rule which
1089 number is the opposite. If zero, do what YYDEFACT says.
1090 If YYTABLE_NINF, syntax error. */
1091 #define YYTABLE_NINF -60
1092 static const yytype_int16 yytable
[] =
1094 139, 133, 137, 192, 145, 231, 149, 106, 107, 152,
1095 216, 148, 254, 150, 151, 396, 147, 350, 147, 108,
1096 385, 147, 108, 239, 244, 85, 86, 183, 280, 380,
1097 56, 139, 280, 87, 281, 184, 5, 153, 281, 221,
1098 198, 280, 248, 381, 421, 154, 109, 281, 185, 282,
1099 109, 186, 301, 7, 353, 88, 89, 110, 187, 10,
1100 432, 110, 210, 382, 57, 354, 222, 240, 155, 419,
1101 90, 302, 188, 49, 284, 383, 417, 111, 284, 51,
1102 111, 407, 156, 112, 431, 283, 429, 284, 66, 140,
1103 430, 291, 52, 351, 53, 189, 190, 434, 113, 69,
1104 70, 141, 113, 69, 70, 158, 113, 292, 293, 225,
1105 54, 226, 203, 66, 160, 264, 161, 159, 76, 204,
1106 263, 213, 162, 227, 269, 226, 397, 147, 214, 163,
1107 164, 165, 74, 166, 252, 167, 232, 227, 398, 233,
1108 234, 253, 310, 235, 168, 81, 1, 2, 294, 82,
1109 344, 236, 61, 62, 63, 64, 65, 345, 433, 73,
1110 401, 169, 170, 390, 408, 386, 75, 402, 78, 237,
1111 139, 409, 69, 70, 11, 12, 13, 316, 14, 15,
1112 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
1113 26, 365, 366, 367, 368, 369, 370, 371, 372, 373,
1114 374, 375, 376, 193, 201, 202, 194, 195, 93, 94,
1115 95, 96, 334, 335, 336, 337, 346, 347, 92, 79,
1116 98, 99, 80, 100, 101, 102, 103, 104, 125, 126,
1117 127, 56, 130, 378, 391, 139, 358, 137, 143, -59,
1118 199, 206, 197, 220, 200, 208, 209, 211, 212, 245,
1119 267, 270, 217, 218, 219, 224, 230, 242, 247, 249,
1120 250, 259, 139, 265, 262, 260, 272, 316, 274, 276,
1121 278, 287, 288, 290, 297, 305, 299, 307, 304, 312,
1122 311, 318, 320, 321, 327, 317, 329, 322, 323, 331,
1123 324, 339, 325, 363, 326, 333, 341, 342, 416, 343,
1124 349, 379, 392, 387, 388, 389, 390, 394, 403, 404,
1125 410, 425, 423, 411, 412, 413, 422, 426, 424, 139,
1126 358, 137, 428, 427, 435, 258, 139, 309, 316, 415,
1127 128, 279, 400, 0, 84, 0, 134, 129, 135, 246,
1131 static const yytype_int16 yycheck
[] =
1133 82, 82, 82, 113, 92, 166, 100, 22, 23, 103,
1134 156, 99, 22, 101, 102, 349, 98, 22, 100, 37,
1135 325, 103, 37, 25, 170, 28, 29, 28, 24, 25,
1136 64, 113, 24, 36, 30, 36, 0, 28, 30, 28,
1137 125, 24, 188, 39, 412, 36, 61, 30, 49, 32,
1138 61, 52, 34, 8, 61, 58, 59, 72, 59, 98,
1139 428, 72, 147, 59, 98, 72, 55, 69, 59, 411,
1140 73, 53, 73, 106, 70, 71, 410, 95, 70, 98,
1141 95, 386, 73, 98, 426, 68, 422, 70, 98, 26,
1142 424, 237, 98, 98, 98, 96, 97, 433, 113, 110,
1143 111, 38, 113, 110, 111, 33, 113, 40, 41, 24,
1144 98, 26, 60, 98, 27, 209, 29, 45, 98, 67,
1145 208, 60, 35, 38, 212, 26, 33, 209, 67, 42,
1146 43, 44, 106, 46, 107, 48, 47, 38, 45, 50,
1147 51, 114, 252, 54, 57, 108, 3, 4, 81, 112,
1148 107, 62, 19, 20, 21, 22, 23, 114, 104, 26,
1149 107, 74, 75, 109, 107, 326, 106, 114, 112, 80,
1150 252, 114, 110, 111, 5, 6, 7, 259, 9, 10,
1151 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
1152 21, 83, 84, 85, 86, 87, 88, 89, 90, 91,
1153 92, 93, 94, 99, 22, 23, 102, 103, 99, 100,
1154 101, 102, 76, 77, 78, 79, 110, 111, 107, 112,
1155 107, 107, 112, 107, 107, 107, 107, 102, 107, 107,
1156 98, 64, 22, 321, 344, 317, 317, 317, 108, 108,
1157 98, 22, 108, 63, 109, 107, 107, 107, 107, 65,
1158 82, 22, 108, 108, 108, 108, 108, 108, 108, 108,
1159 108, 107, 344, 102, 109, 112, 22, 349, 22, 22,
1160 66, 108, 108, 108, 22, 22, 28, 22, 108, 102,
1161 109, 108, 107, 107, 22, 113, 22, 109, 109, 22,
1162 109, 22, 109, 22, 109, 109, 109, 109, 408, 109,
1163 107, 56, 22, 109, 109, 109, 109, 22, 109, 31,
1164 107, 109, 114, 108, 108, 65, 108, 104, 107, 401,
1165 401, 401, 104, 109, 109, 197, 408, 250, 410, 401,
1166 79, 230, 354, -1, 55, -1, 82, 80, 82, 183,
1170 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
1171 symbol of state STATE-NUM. */
1172 static const yytype_uint8 yystos
[] =
1174 0, 3, 4, 116, 117, 0, 118, 8, 119, 120,
1175 98, 5, 6, 7, 9, 10, 11, 12, 13, 14,
1176 15, 16, 17, 18, 19, 20, 21, 121, 122, 123,
1177 124, 125, 126, 127, 128, 129, 130, 131, 132, 135,
1178 158, 159, 166, 167, 168, 230, 232, 235, 248, 106,
1179 233, 98, 98, 98, 98, 231, 64, 98, 138, 144,
1180 236, 138, 138, 138, 138, 138, 98, 139, 152, 110,
1181 111, 137, 229, 138, 106, 106, 98, 234, 112, 112,
1182 112, 108, 112, 170, 234, 28, 29, 36, 58, 59,
1183 73, 237, 107, 99, 100, 101, 102, 157, 107, 107,
1184 107, 107, 107, 107, 102, 154, 22, 23, 37, 61,
1185 72, 95, 98, 113, 143, 145, 160, 174, 177, 213,
1186 217, 220, 224, 226, 227, 107, 107, 98, 160, 236,
1187 22, 169, 173, 177, 213, 223, 225, 227, 228, 229,
1188 26, 38, 238, 108, 242, 137, 136, 229, 137, 136,
1189 137, 137, 136, 28, 36, 59, 73, 165, 33, 45,
1190 27, 29, 35, 42, 43, 44, 46, 48, 57, 74,
1191 75, 178, 180, 183, 185, 187, 191, 194, 196, 198,
1192 200, 203, 212, 28, 36, 49, 52, 59, 73, 96,
1193 97, 161, 228, 99, 102, 103, 156, 108, 143, 98,
1194 109, 22, 23, 60, 67, 239, 22, 245, 107, 107,
1195 143, 107, 107, 60, 67, 241, 242, 108, 108, 108,
1196 63, 28, 55, 195, 108, 24, 26, 38, 184, 240,
1197 108, 240, 47, 50, 51, 54, 62, 80, 207, 25,
1198 69, 199, 108, 244, 242, 65, 241, 108, 242, 108,
1199 108, 163, 107, 114, 22, 146, 147, 148, 152, 107,
1200 112, 171, 109, 137, 136, 102, 155, 82, 133, 137,
1201 22, 221, 22, 222, 22, 197, 22, 190, 66, 190,
1202 24, 30, 32, 68, 70, 179, 189, 108, 108, 208,
1203 108, 242, 40, 41, 81, 204, 205, 22, 247, 28,
1204 188, 34, 53, 192, 108, 22, 164, 22, 162, 164,
1205 228, 109, 102, 153, 140, 141, 229, 113, 108, 243,
1206 107, 107, 109, 109, 109, 109, 109, 22, 211, 22,
1207 209, 22, 210, 109, 76, 77, 78, 79, 193, 22,
1208 206, 109, 109, 109, 107, 114, 110, 111, 149, 107,
1209 22, 98, 142, 61, 72, 172, 175, 176, 177, 214,
1210 215, 218, 223, 22, 246, 83, 84, 85, 86, 87,
1211 88, 89, 90, 91, 92, 93, 94, 134, 137, 56,
1212 25, 39, 59, 71, 181, 189, 240, 109, 109, 109,
1213 109, 228, 22, 150, 22, 151, 141, 33, 45, 201,
1214 203, 107, 114, 109, 31, 182, 186, 189, 107, 114,
1215 107, 108, 108, 65, 202, 175, 228, 141, 216, 221,
1216 219, 222, 108, 114, 107, 109, 104, 109, 104, 206,
1217 141, 221, 222, 104, 206, 109
1220 #define yyerrok (yyerrstatus = 0)
1221 #define yyclearin (yychar = YYEMPTY)
1222 #define YYEMPTY (-2)
1225 #define YYACCEPT goto yyacceptlab
1226 #define YYABORT goto yyabortlab
1227 #define YYERROR goto yyerrorlab
1230 /* Like YYERROR except do call yyerror. This remains here temporarily
1231 to ease the transition to the new meaning of YYERROR, for GCC.
1232 Once GCC version 2 has supplanted version 1, this can go. */
1234 #define YYFAIL goto yyerrlab
1236 #define YYRECOVERING() (!!yyerrstatus)
1238 #define YYBACKUP(Token, Value) \
1240 if (yychar == YYEMPTY && yylen == 1) \
1244 yytoken = YYTRANSLATE (yychar); \
1250 yyerror (&yylloc, state, YY_("syntax error: cannot back up")); \
1257 #define YYERRCODE 256
1260 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
1261 If N is 0, then set CURRENT to the empty location which ends
1262 the previous symbol: RHS[0] (always defined). */
1264 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
1265 #ifndef YYLLOC_DEFAULT
1266 # define YYLLOC_DEFAULT(Current, Rhs, N) \
1270 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
1271 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
1272 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
1273 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
1277 (Current).first_line = (Current).last_line = \
1278 YYRHSLOC (Rhs, 0).last_line; \
1279 (Current).first_column = (Current).last_column = \
1280 YYRHSLOC (Rhs, 0).last_column; \
1286 /* YY_LOCATION_PRINT -- Print the location on the stream.
1287 This macro was not mandated originally: define only if we know
1288 we won't break user code: when these are the locations we know. */
1290 #ifndef YY_LOCATION_PRINT
1291 # if YYLTYPE_IS_TRIVIAL
1292 # define YY_LOCATION_PRINT(File, Loc) \
1293 fprintf (File, "%d.%d-%d.%d", \
1294 (Loc).first_line, (Loc).first_column, \
1295 (Loc).last_line, (Loc).last_column)
1297 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
1302 /* YYLEX -- calling `yylex' with the right arguments. */
1305 # define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM)
1307 # define YYLEX yylex (&yylval, &yylloc, scanner)
1310 /* Enable debugging if requested. */
1314 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
1315 # define YYFPRINTF fprintf
1318 # define YYDPRINTF(Args) \
1324 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
1328 YYFPRINTF (stderr, "%s ", Title); \
1329 yy_symbol_print (stderr, \
1330 Type, Value, Location, state); \
1331 YYFPRINTF (stderr, "\n"); \
1336 /*--------------------------------.
1337 | Print this symbol on YYOUTPUT. |
1338 `--------------------------------*/
1341 #if (defined __STDC__ || defined __C99__FUNC__ \
1342 || defined __cplusplus || defined _MSC_VER)
1344 yy_symbol_value_print (FILE *yyoutput
, int yytype
, YYSTYPE
const * const yyvaluep
, YYLTYPE
const * const yylocationp
, struct asm_parser_state
*state
)
1347 yy_symbol_value_print (yyoutput
, yytype
, yyvaluep
, yylocationp
, state
)
1350 YYSTYPE
const * const yyvaluep
;
1351 YYLTYPE
const * const yylocationp
;
1352 struct asm_parser_state
*state
;
1357 YYUSE (yylocationp
);
1360 if (yytype
< YYNTOKENS
)
1361 YYPRINT (yyoutput
, yytoknum
[yytype
], *yyvaluep
);
1373 /*--------------------------------.
1374 | Print this symbol on YYOUTPUT. |
1375 `--------------------------------*/
1377 #if (defined __STDC__ || defined __C99__FUNC__ \
1378 || defined __cplusplus || defined _MSC_VER)
1380 yy_symbol_print (FILE *yyoutput
, int yytype
, YYSTYPE
const * const yyvaluep
, YYLTYPE
const * const yylocationp
, struct asm_parser_state
*state
)
1383 yy_symbol_print (yyoutput
, yytype
, yyvaluep
, yylocationp
, state
)
1386 YYSTYPE
const * const yyvaluep
;
1387 YYLTYPE
const * const yylocationp
;
1388 struct asm_parser_state
*state
;
1391 if (yytype
< YYNTOKENS
)
1392 YYFPRINTF (yyoutput
, "token %s (", yytname
[yytype
]);
1394 YYFPRINTF (yyoutput
, "nterm %s (", yytname
[yytype
]);
1396 YY_LOCATION_PRINT (yyoutput
, *yylocationp
);
1397 YYFPRINTF (yyoutput
, ": ");
1398 yy_symbol_value_print (yyoutput
, yytype
, yyvaluep
, yylocationp
, state
);
1399 YYFPRINTF (yyoutput
, ")");
1402 /*------------------------------------------------------------------.
1403 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
1405 `------------------------------------------------------------------*/
1407 #if (defined __STDC__ || defined __C99__FUNC__ \
1408 || defined __cplusplus || defined _MSC_VER)
1410 yy_stack_print (yytype_int16
*yybottom
, yytype_int16
*yytop
)
1413 yy_stack_print (yybottom
, yytop
)
1414 yytype_int16
*yybottom
;
1415 yytype_int16
*yytop
;
1418 YYFPRINTF (stderr
, "Stack now");
1419 for (; yybottom
<= yytop
; yybottom
++)
1421 int yybot
= *yybottom
;
1422 YYFPRINTF (stderr
, " %d", yybot
);
1424 YYFPRINTF (stderr
, "\n");
1427 # define YY_STACK_PRINT(Bottom, Top) \
1430 yy_stack_print ((Bottom), (Top)); \
1434 /*------------------------------------------------.
1435 | Report that the YYRULE is going to be reduced. |
1436 `------------------------------------------------*/
1438 #if (defined __STDC__ || defined __C99__FUNC__ \
1439 || defined __cplusplus || defined _MSC_VER)
1441 yy_reduce_print (YYSTYPE
*yyvsp
, YYLTYPE
*yylsp
, int yyrule
, struct asm_parser_state
*state
)
1444 yy_reduce_print (yyvsp
, yylsp
, yyrule
, state
)
1448 struct asm_parser_state
*state
;
1451 int yynrhs
= yyr2
[yyrule
];
1453 unsigned long int yylno
= yyrline
[yyrule
];
1454 YYFPRINTF (stderr
, "Reducing stack by rule %d (line %lu):\n",
1456 /* The symbols being reduced. */
1457 for (yyi
= 0; yyi
< yynrhs
; yyi
++)
1459 YYFPRINTF (stderr
, " $%d = ", yyi
+ 1);
1460 yy_symbol_print (stderr
, yyrhs
[yyprhs
[yyrule
] + yyi
],
1461 &(yyvsp
[(yyi
+ 1) - (yynrhs
)])
1462 , &(yylsp
[(yyi
+ 1) - (yynrhs
)]) , state
);
1463 YYFPRINTF (stderr
, "\n");
1467 # define YY_REDUCE_PRINT(Rule) \
1470 yy_reduce_print (yyvsp, yylsp, Rule, state); \
1473 /* Nonzero means print parse trace. It is left uninitialized so that
1474 multiple parsers can coexist. */
1476 #else /* !YYDEBUG */
1477 # define YYDPRINTF(Args)
1478 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1479 # define YY_STACK_PRINT(Bottom, Top)
1480 # define YY_REDUCE_PRINT(Rule)
1481 #endif /* !YYDEBUG */
1484 /* YYINITDEPTH -- initial size of the parser's stacks. */
1486 # define YYINITDEPTH 200
1489 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1490 if the built-in stack extension method is used).
1492 Do not make this value too large; the results are undefined if
1493 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1494 evaluated with infinite-precision integer arithmetic. */
1497 # define YYMAXDEPTH 10000
1505 # if defined __GLIBC__ && defined _STRING_H
1506 # define yystrlen strlen
1508 /* Return the length of YYSTR. */
1509 #if (defined __STDC__ || defined __C99__FUNC__ \
1510 || defined __cplusplus || defined _MSC_VER)
1512 yystrlen (const char *yystr
)
1520 for (yylen
= 0; yystr
[yylen
]; yylen
++)
1528 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1529 # define yystpcpy stpcpy
1531 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1533 #if (defined __STDC__ || defined __C99__FUNC__ \
1534 || defined __cplusplus || defined _MSC_VER)
1536 yystpcpy (char *yydest
, const char *yysrc
)
1539 yystpcpy (yydest
, yysrc
)
1545 const char *yys
= yysrc
;
1547 while ((*yyd
++ = *yys
++) != '\0')
1556 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1557 quotes and backslashes, so that it's suitable for yyerror. The
1558 heuristic is that double-quoting is unnecessary unless the string
1559 contains an apostrophe, a comma, or backslash (other than
1560 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1561 null, do not copy; instead, return the length of what the result
1564 yytnamerr (char *yyres
, const char *yystr
)
1569 char const *yyp
= yystr
;
1576 goto do_not_strip_quotes
;
1580 goto do_not_strip_quotes
;
1593 do_not_strip_quotes
: ;
1597 return yystrlen (yystr
);
1599 return yystpcpy (yyres
, yystr
) - yyres
;
1603 /* Copy into YYRESULT an error message about the unexpected token
1604 YYCHAR while in state YYSTATE. Return the number of bytes copied,
1605 including the terminating null byte. If YYRESULT is null, do not
1606 copy anything; just return the number of bytes that would be
1607 copied. As a special case, return 0 if an ordinary "syntax error"
1608 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
1609 size calculation. */
1611 yysyntax_error (char *yyresult
, int yystate
, int yychar
)
1613 int yyn
= yypact
[yystate
];
1615 if (! (YYPACT_NINF
< yyn
&& yyn
<= YYLAST
))
1619 int yytype
= YYTRANSLATE (yychar
);
1620 YYSIZE_T yysize0
= yytnamerr (0, yytname
[yytype
]);
1621 YYSIZE_T yysize
= yysize0
;
1623 int yysize_overflow
= 0;
1624 enum { YYERROR_VERBOSE_ARGS_MAXIMUM
= 5 };
1625 char const *yyarg
[YYERROR_VERBOSE_ARGS_MAXIMUM
];
1629 /* This is so xgettext sees the translatable formats that are
1630 constructed on the fly. */
1631 YY_("syntax error, unexpected %s");
1632 YY_("syntax error, unexpected %s, expecting %s");
1633 YY_("syntax error, unexpected %s, expecting %s or %s");
1634 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1635 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1639 static char const yyunexpected
[] = "syntax error, unexpected %s";
1640 static char const yyexpecting
[] = ", expecting %s";
1641 static char const yyor
[] = " or %s";
1642 char yyformat
[sizeof yyunexpected
1643 + sizeof yyexpecting
- 1
1644 + ((YYERROR_VERBOSE_ARGS_MAXIMUM
- 2)
1645 * (sizeof yyor
- 1))];
1646 char const *yyprefix
= yyexpecting
;
1648 /* Start YYX at -YYN if negative to avoid negative indexes in
1650 int yyxbegin
= yyn
< 0 ? -yyn
: 0;
1652 /* Stay within bounds of both yycheck and yytname. */
1653 int yychecklim
= YYLAST
- yyn
+ 1;
1654 int yyxend
= yychecklim
< YYNTOKENS
? yychecklim
: YYNTOKENS
;
1657 yyarg
[0] = yytname
[yytype
];
1658 yyfmt
= yystpcpy (yyformat
, yyunexpected
);
1660 for (yyx
= yyxbegin
; yyx
< yyxend
; ++yyx
)
1661 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
)
1663 if (yycount
== YYERROR_VERBOSE_ARGS_MAXIMUM
)
1667 yyformat
[sizeof yyunexpected
- 1] = '\0';
1670 yyarg
[yycount
++] = yytname
[yyx
];
1671 yysize1
= yysize
+ yytnamerr (0, yytname
[yyx
]);
1672 yysize_overflow
|= (yysize1
< yysize
);
1674 yyfmt
= yystpcpy (yyfmt
, yyprefix
);
1678 yyf
= YY_(yyformat
);
1679 yysize1
= yysize
+ yystrlen (yyf
);
1680 yysize_overflow
|= (yysize1
< yysize
);
1683 if (yysize_overflow
)
1684 return YYSIZE_MAXIMUM
;
1688 /* Avoid sprintf, as that infringes on the user's name space.
1689 Don't have undefined behavior even if the translation
1690 produced a string with the wrong number of "%s"s. */
1691 char *yyp
= yyresult
;
1693 while ((*yyp
= *yyf
) != '\0')
1695 if (*yyp
== '%' && yyf
[1] == 's' && yyi
< yycount
)
1697 yyp
+= yytnamerr (yyp
, yyarg
[yyi
++]);
1710 #endif /* YYERROR_VERBOSE */
1713 /*-----------------------------------------------.
1714 | Release the memory associated to this symbol. |
1715 `-----------------------------------------------*/
1718 #if (defined __STDC__ || defined __C99__FUNC__ \
1719 || defined __cplusplus || defined _MSC_VER)
1721 yydestruct (const char *yymsg
, int yytype
, YYSTYPE
*yyvaluep
, YYLTYPE
*yylocationp
, struct asm_parser_state
*state
)
1724 yydestruct (yymsg
, yytype
, yyvaluep
, yylocationp
, state
)
1728 YYLTYPE
*yylocationp
;
1729 struct asm_parser_state
*state
;
1733 YYUSE (yylocationp
);
1738 YY_SYMBOL_PRINT (yymsg
, yytype
, yyvaluep
, yylocationp
);
1748 /* Prevent warnings from -Wmissing-prototypes. */
1749 #ifdef YYPARSE_PARAM
1750 #if defined __STDC__ || defined __cplusplus
1751 int yyparse (void *YYPARSE_PARAM
);
1755 #else /* ! YYPARSE_PARAM */
1756 #if defined __STDC__ || defined __cplusplus
1757 int yyparse (struct asm_parser_state
*state
);
1761 #endif /* ! YYPARSE_PARAM */
1767 /*-------------------------.
1768 | yyparse or yypush_parse. |
1769 `-------------------------*/
1771 #ifdef YYPARSE_PARAM
1772 #if (defined __STDC__ || defined __C99__FUNC__ \
1773 || defined __cplusplus || defined _MSC_VER)
1775 yyparse (void *YYPARSE_PARAM
)
1778 yyparse (YYPARSE_PARAM
)
1779 void *YYPARSE_PARAM
;
1781 #else /* ! YYPARSE_PARAM */
1782 #if (defined __STDC__ || defined __C99__FUNC__ \
1783 || defined __cplusplus || defined _MSC_VER)
1785 yyparse (struct asm_parser_state
*state
)
1789 struct asm_parser_state
*state
;
1793 /* The lookahead symbol. */
1796 /* The semantic value of the lookahead symbol. */
1799 /* Location data for the lookahead symbol. */
1802 /* Number of syntax errors so far. */
1806 /* Number of tokens to shift before error messages enabled. */
1809 /* The stacks and their tools:
1810 `yyss': related to states.
1811 `yyvs': related to semantic values.
1812 `yyls': related to locations.
1814 Refer to the stacks thru separate pointers, to allow yyoverflow
1815 to reallocate them elsewhere. */
1817 /* The state stack. */
1818 yytype_int16 yyssa
[YYINITDEPTH
];
1820 yytype_int16
*yyssp
;
1822 /* The semantic value stack. */
1823 YYSTYPE yyvsa
[YYINITDEPTH
];
1827 /* The location stack. */
1828 YYLTYPE yylsa
[YYINITDEPTH
];
1832 /* The locations where the error started and ended. */
1833 YYLTYPE yyerror_range
[2];
1835 YYSIZE_T yystacksize
;
1839 /* Lookahead token as an internal (translated) token number. */
1841 /* The variables used to return semantic value and location from the
1847 /* Buffer for error messages, and its allocated size. */
1849 char *yymsg
= yymsgbuf
;
1850 YYSIZE_T yymsg_alloc
= sizeof yymsgbuf
;
1853 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
1855 /* The number of symbols on the RHS of the reduced rule.
1856 Keep to zero when no symbol should be popped. */
1863 yystacksize
= YYINITDEPTH
;
1865 YYDPRINTF ((stderr
, "Starting parse\n"));
1870 yychar
= YYEMPTY
; /* Cause a token to be read. */
1872 /* Initialize stack pointers.
1873 Waste one element of value and location stack
1874 so that they stay on the same level as the state stack.
1875 The wasted elements are never initialized. */
1880 #if YYLTYPE_IS_TRIVIAL
1881 /* Initialize the default location before parsing starts. */
1882 yylloc
.first_line
= yylloc
.last_line
= 1;
1883 yylloc
.first_column
= yylloc
.last_column
= 1;
1888 /*------------------------------------------------------------.
1889 | yynewstate -- Push a new state, which is found in yystate. |
1890 `------------------------------------------------------------*/
1892 /* In all cases, when you get here, the value and location stacks
1893 have just been pushed. So pushing a state here evens the stacks. */
1899 if (yyss
+ yystacksize
- 1 <= yyssp
)
1901 /* Get the current used size of the three stacks, in elements. */
1902 YYSIZE_T yysize
= yyssp
- yyss
+ 1;
1906 /* Give user a chance to reallocate the stack. Use copies of
1907 these so that the &'s don't force the real ones into
1909 YYSTYPE
*yyvs1
= yyvs
;
1910 yytype_int16
*yyss1
= yyss
;
1911 YYLTYPE
*yyls1
= yyls
;
1913 /* Each stack pointer address is followed by the size of the
1914 data in use in that stack, in bytes. This used to be a
1915 conditional around just the two extra args, but that might
1916 be undefined if yyoverflow is a macro. */
1917 yyoverflow (YY_("memory exhausted"),
1918 &yyss1
, yysize
* sizeof (*yyssp
),
1919 &yyvs1
, yysize
* sizeof (*yyvsp
),
1920 &yyls1
, yysize
* sizeof (*yylsp
),
1927 #else /* no yyoverflow */
1928 # ifndef YYSTACK_RELOCATE
1929 goto yyexhaustedlab
;
1931 /* Extend the stack our own way. */
1932 if (YYMAXDEPTH
<= yystacksize
)
1933 goto yyexhaustedlab
;
1935 if (YYMAXDEPTH
< yystacksize
)
1936 yystacksize
= YYMAXDEPTH
;
1939 yytype_int16
*yyss1
= yyss
;
1940 union yyalloc
*yyptr
=
1941 (union yyalloc
*) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize
));
1943 goto yyexhaustedlab
;
1944 YYSTACK_RELOCATE (yyss_alloc
, yyss
);
1945 YYSTACK_RELOCATE (yyvs_alloc
, yyvs
);
1946 YYSTACK_RELOCATE (yyls_alloc
, yyls
);
1947 # undef YYSTACK_RELOCATE
1949 YYSTACK_FREE (yyss1
);
1952 #endif /* no yyoverflow */
1954 yyssp
= yyss
+ yysize
- 1;
1955 yyvsp
= yyvs
+ yysize
- 1;
1956 yylsp
= yyls
+ yysize
- 1;
1958 YYDPRINTF ((stderr
, "Stack size increased to %lu\n",
1959 (unsigned long int) yystacksize
));
1961 if (yyss
+ yystacksize
- 1 <= yyssp
)
1965 YYDPRINTF ((stderr
, "Entering state %d\n", yystate
));
1967 if (yystate
== YYFINAL
)
1977 /* Do appropriate processing given the current state. Read a
1978 lookahead token if we need one and don't already have one. */
1980 /* First try to decide what to do without reference to lookahead token. */
1981 yyn
= yypact
[yystate
];
1982 if (yyn
== YYPACT_NINF
)
1985 /* Not known => get a lookahead token if don't already have one. */
1987 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1988 if (yychar
== YYEMPTY
)
1990 YYDPRINTF ((stderr
, "Reading a token: "));
1994 if (yychar
<= YYEOF
)
1996 yychar
= yytoken
= YYEOF
;
1997 YYDPRINTF ((stderr
, "Now at end of input.\n"));
2001 yytoken
= YYTRANSLATE (yychar
);
2002 YY_SYMBOL_PRINT ("Next token is", yytoken
, &yylval
, &yylloc
);
2005 /* If the proper action on seeing token YYTOKEN is to reduce or to
2006 detect an error, take that action. */
2008 if (yyn
< 0 || YYLAST
< yyn
|| yycheck
[yyn
] != yytoken
)
2013 if (yyn
== 0 || yyn
== YYTABLE_NINF
)
2019 /* Count tokens shifted since error; after three, turn off error
2024 /* Shift the lookahead token. */
2025 YY_SYMBOL_PRINT ("Shifting", yytoken
, &yylval
, &yylloc
);
2027 /* Discard the shifted token. */
2036 /*-----------------------------------------------------------.
2037 | yydefault -- do the default action for the current state. |
2038 `-----------------------------------------------------------*/
2040 yyn
= yydefact
[yystate
];
2046 /*-----------------------------.
2047 | yyreduce -- Do a reduction. |
2048 `-----------------------------*/
2050 /* yyn is the number of a rule to reduce with. */
2053 /* If YYLEN is nonzero, implement the default value of the action:
2056 Otherwise, the following line sets YYVAL to garbage.
2057 This behavior is undocumented and Bison
2058 users should not rely upon it. Assigning to YYVAL
2059 unconditionally makes the parser a bit smaller, and it avoids a
2060 GCC warning that YYVAL may be used uninitialized. */
2061 yyval
= yyvsp
[1-yylen
];
2063 /* Default location. */
2064 YYLLOC_DEFAULT (yyloc
, (yylsp
- yylen
), yylen
);
2065 YY_REDUCE_PRINT (yyn
);
2070 /* Line 1455 of yacc.c */
2071 #line 260 "program_parse.y"
2073 if (state
->prog
->Target
!= GL_VERTEX_PROGRAM_ARB
) {
2074 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid fragment program header");
2077 state
->mode
= ARB_vertex
;
2083 /* Line 1455 of yacc.c */
2084 #line 268 "program_parse.y"
2086 if (state
->prog
->Target
!= GL_FRAGMENT_PROGRAM_ARB
) {
2087 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid vertex program header");
2089 state
->mode
= ARB_fragment
;
2091 state
->option
.TexRect
=
2092 (state
->ctx
->Extensions
.NV_texture_rectangle
!= GL_FALSE
);
2098 /* Line 1455 of yacc.c */
2099 #line 284 "program_parse.y"
2103 if (state
->mode
== ARB_vertex
) {
2104 valid
= _mesa_ARBvp_parse_option(state
, (yyvsp
[(2) - (3)].string
));
2105 } else if (state
->mode
== ARB_fragment
) {
2106 valid
= _mesa_ARBfp_parse_option(state
, (yyvsp
[(2) - (3)].string
));
2111 const char *const err_str
= (state
->mode
== ARB_vertex
)
2112 ? "invalid ARB vertex program option"
2113 : "invalid ARB fragment program option";
2115 yyerror(& (yylsp
[(2) - (3)]), state
, err_str
);
2123 /* Line 1455 of yacc.c */
2124 #line 310 "program_parse.y"
2126 if ((yyvsp
[(1) - (2)].inst
) != NULL
) {
2127 if (state
->inst_tail
== NULL
) {
2128 state
->inst_head
= (yyvsp
[(1) - (2)].inst
);
2130 state
->inst_tail
->next
= (yyvsp
[(1) - (2)].inst
);
2133 state
->inst_tail
= (yyvsp
[(1) - (2)].inst
);
2134 (yyvsp
[(1) - (2)].inst
)->next
= NULL
;
2136 state
->prog
->NumInstructions
++;
2143 /* Line 1455 of yacc.c */
2144 #line 328 "program_parse.y"
2146 (yyval
.inst
) = (yyvsp
[(1) - (1)].inst
);
2147 state
->prog
->NumAluInstructions
++;
2153 /* Line 1455 of yacc.c */
2154 #line 333 "program_parse.y"
2156 (yyval
.inst
) = (yyvsp
[(1) - (1)].inst
);
2157 state
->prog
->NumTexInstructions
++;
2163 /* Line 1455 of yacc.c */
2164 #line 353 "program_parse.y"
2166 (yyval
.inst
) = asm_instruction_ctor(OPCODE_ARL
, & (yyvsp
[(2) - (4)].dst_reg
), & (yyvsp
[(4) - (4)].src_reg
), NULL
, NULL
);
2172 /* Line 1455 of yacc.c */
2173 #line 359 "program_parse.y"
2175 (yyval
.inst
) = asm_instruction_ctor((yyvsp
[(1) - (4)].temp_inst
).Opcode
, & (yyvsp
[(2) - (4)].dst_reg
), & (yyvsp
[(4) - (4)].src_reg
), NULL
, NULL
);
2176 (yyval
.inst
)->Base
.SaturateMode
= (yyvsp
[(1) - (4)].temp_inst
).SaturateMode
;
2182 /* Line 1455 of yacc.c */
2183 #line 366 "program_parse.y"
2185 (yyval
.inst
) = asm_instruction_ctor((yyvsp
[(1) - (4)].temp_inst
).Opcode
, & (yyvsp
[(2) - (4)].dst_reg
), & (yyvsp
[(4) - (4)].src_reg
), NULL
, NULL
);
2186 (yyval
.inst
)->Base
.SaturateMode
= (yyvsp
[(1) - (4)].temp_inst
).SaturateMode
;
2192 /* Line 1455 of yacc.c */
2193 #line 373 "program_parse.y"
2195 (yyval
.inst
) = asm_instruction_ctor((yyvsp
[(1) - (6)].temp_inst
).Opcode
, & (yyvsp
[(2) - (6)].dst_reg
), & (yyvsp
[(4) - (6)].src_reg
), & (yyvsp
[(6) - (6)].src_reg
), NULL
);
2196 (yyval
.inst
)->Base
.SaturateMode
= (yyvsp
[(1) - (6)].temp_inst
).SaturateMode
;
2202 /* Line 1455 of yacc.c */
2203 #line 381 "program_parse.y"
2205 (yyval
.inst
) = asm_instruction_ctor((yyvsp
[(1) - (6)].temp_inst
).Opcode
, & (yyvsp
[(2) - (6)].dst_reg
), & (yyvsp
[(4) - (6)].src_reg
), & (yyvsp
[(6) - (6)].src_reg
), NULL
);
2206 (yyval
.inst
)->Base
.SaturateMode
= (yyvsp
[(1) - (6)].temp_inst
).SaturateMode
;
2212 /* Line 1455 of yacc.c */
2213 #line 389 "program_parse.y"
2215 (yyval
.inst
) = asm_instruction_ctor((yyvsp
[(1) - (8)].temp_inst
).Opcode
, & (yyvsp
[(2) - (8)].dst_reg
), & (yyvsp
[(4) - (8)].src_reg
), & (yyvsp
[(6) - (8)].src_reg
), & (yyvsp
[(8) - (8)].src_reg
));
2216 (yyval
.inst
)->Base
.SaturateMode
= (yyvsp
[(1) - (8)].temp_inst
).SaturateMode
;
2222 /* Line 1455 of yacc.c */
2223 #line 396 "program_parse.y"
2225 (yyval
.inst
) = asm_instruction_ctor((yyvsp
[(1) - (8)].temp_inst
).Opcode
, & (yyvsp
[(2) - (8)].dst_reg
), & (yyvsp
[(4) - (8)].src_reg
), NULL
, NULL
);
2226 if ((yyval
.inst
) != NULL
) {
2227 const GLbitfield tex_mask
= (1U << (yyvsp
[(6) - (8)].integer
));
2228 GLbitfield shadow_tex
= 0;
2229 GLbitfield target_mask
= 0;
2232 (yyval
.inst
)->Base
.SaturateMode
= (yyvsp
[(1) - (8)].temp_inst
).SaturateMode
;
2233 (yyval
.inst
)->Base
.TexSrcUnit
= (yyvsp
[(6) - (8)].integer
);
2235 if ((yyvsp
[(8) - (8)].integer
) < 0) {
2236 shadow_tex
= tex_mask
;
2238 (yyval
.inst
)->Base
.TexSrcTarget
= -(yyvsp
[(8) - (8)].integer
);
2239 (yyval
.inst
)->Base
.TexShadow
= 1;
2241 (yyval
.inst
)->Base
.TexSrcTarget
= (yyvsp
[(8) - (8)].integer
);
2244 target_mask
= (1U << (yyval
.inst
)->Base
.TexSrcTarget
);
2246 /* If this texture unit was previously accessed and that access
2247 * had a different texture target, generate an error.
2249 * If this texture unit was previously accessed and that access
2250 * had a different shadow mode, generate an error.
2252 if ((state
->prog
->TexturesUsed
[(yyvsp
[(6) - (8)].integer
)] != 0)
2253 && ((state
->prog
->TexturesUsed
[(yyvsp
[(6) - (8)].integer
)] != target_mask
)
2254 || ((state
->prog
->ShadowSamplers
& tex_mask
)
2256 yyerror(& (yylsp
[(8) - (8)]), state
,
2257 "multiple targets used on one texture image unit");
2262 state
->prog
->TexturesUsed
[(yyvsp
[(6) - (8)].integer
)] |= target_mask
;
2263 state
->prog
->ShadowSamplers
|= shadow_tex
;
2270 /* Line 1455 of yacc.c */
2271 #line 441 "program_parse.y"
2273 (yyval
.inst
) = asm_instruction_ctor(OPCODE_KIL
, NULL
, & (yyvsp
[(2) - (2)].src_reg
), NULL
, NULL
);
2274 state
->fragment
.UsesKill
= 1;
2280 /* Line 1455 of yacc.c */
2281 #line 448 "program_parse.y"
2283 (yyval
.integer
) = (yyvsp
[(2) - (2)].integer
);
2289 /* Line 1455 of yacc.c */
2290 #line 453 "program_parse.y"
2291 { (yyval
.integer
) = TEXTURE_1D_INDEX
; ;}
2296 /* Line 1455 of yacc.c */
2297 #line 454 "program_parse.y"
2298 { (yyval
.integer
) = TEXTURE_2D_INDEX
; ;}
2303 /* Line 1455 of yacc.c */
2304 #line 455 "program_parse.y"
2305 { (yyval
.integer
) = TEXTURE_3D_INDEX
; ;}
2310 /* Line 1455 of yacc.c */
2311 #line 456 "program_parse.y"
2312 { (yyval
.integer
) = TEXTURE_CUBE_INDEX
; ;}
2317 /* Line 1455 of yacc.c */
2318 #line 457 "program_parse.y"
2319 { (yyval
.integer
) = TEXTURE_RECT_INDEX
; ;}
2324 /* Line 1455 of yacc.c */
2325 #line 458 "program_parse.y"
2326 { (yyval
.integer
) = -TEXTURE_1D_INDEX
; ;}
2331 /* Line 1455 of yacc.c */
2332 #line 459 "program_parse.y"
2333 { (yyval
.integer
) = -TEXTURE_2D_INDEX
; ;}
2338 /* Line 1455 of yacc.c */
2339 #line 460 "program_parse.y"
2340 { (yyval
.integer
) = -TEXTURE_RECT_INDEX
; ;}
2345 /* Line 1455 of yacc.c */
2346 #line 461 "program_parse.y"
2347 { (yyval
.integer
) = TEXTURE_1D_ARRAY_INDEX
; ;}
2352 /* Line 1455 of yacc.c */
2353 #line 462 "program_parse.y"
2354 { (yyval
.integer
) = TEXTURE_2D_ARRAY_INDEX
; ;}
2359 /* Line 1455 of yacc.c */
2360 #line 463 "program_parse.y"
2361 { (yyval
.integer
) = -TEXTURE_1D_ARRAY_INDEX
; ;}
2366 /* Line 1455 of yacc.c */
2367 #line 464 "program_parse.y"
2368 { (yyval
.integer
) = -TEXTURE_2D_ARRAY_INDEX
; ;}
2373 /* Line 1455 of yacc.c */
2374 #line 468 "program_parse.y"
2376 /* FIXME: Is this correct? Should the extenedSwizzle be applied
2377 * FIXME: to the existing swizzle?
2379 (yyvsp
[(4) - (6)].src_reg
).Base
.Swizzle
= (yyvsp
[(6) - (6)].swiz_mask
).swizzle
;
2380 (yyvsp
[(4) - (6)].src_reg
).Base
.Negate
= (yyvsp
[(6) - (6)].swiz_mask
).mask
;
2382 (yyval
.inst
) = asm_instruction_ctor(OPCODE_SWZ
, & (yyvsp
[(2) - (6)].dst_reg
), & (yyvsp
[(4) - (6)].src_reg
), NULL
, NULL
);
2383 (yyval
.inst
)->Base
.SaturateMode
= (yyvsp
[(1) - (6)].temp_inst
).SaturateMode
;
2389 /* Line 1455 of yacc.c */
2390 #line 481 "program_parse.y"
2392 (yyval
.src_reg
) = (yyvsp
[(2) - (3)].src_reg
);
2394 if ((yyvsp
[(1) - (3)].negate
)) {
2395 (yyval
.src_reg
).Base
.Negate
= ~(yyval
.src_reg
).Base
.Negate
;
2398 (yyval
.src_reg
).Base
.Swizzle
= _mesa_combine_swizzles((yyval
.src_reg
).Base
.Swizzle
,
2399 (yyvsp
[(3) - (3)].swiz_mask
).swizzle
);
2405 /* Line 1455 of yacc.c */
2406 #line 494 "program_parse.y"
2408 (yyval
.src_reg
) = (yyvsp
[(2) - (3)].src_reg
);
2410 if ((yyvsp
[(1) - (3)].negate
)) {
2411 (yyval
.src_reg
).Base
.Negate
= ~(yyval
.src_reg
).Base
.Negate
;
2414 (yyval
.src_reg
).Base
.Swizzle
= _mesa_combine_swizzles((yyval
.src_reg
).Base
.Swizzle
,
2415 (yyvsp
[(3) - (3)].swiz_mask
).swizzle
);
2421 /* Line 1455 of yacc.c */
2422 #line 507 "program_parse.y"
2424 (yyval
.dst_reg
) = (yyvsp
[(1) - (2)].dst_reg
);
2425 (yyval
.dst_reg
).WriteMask
= (yyvsp
[(2) - (2)].swiz_mask
).mask
;
2427 if ((yyval
.dst_reg
).File
== PROGRAM_OUTPUT
) {
2428 /* Technically speaking, this should check that it is in
2429 * vertex program mode. However, PositionInvariant can never be
2430 * set in fragment program mode, so it is somewhat irrelevant.
2432 if (state
->option
.PositionInvariant
2433 && ((yyval
.dst_reg
).Index
== VERT_RESULT_HPOS
)) {
2434 yyerror(& (yylsp
[(1) - (2)]), state
, "position-invariant programs cannot "
2439 state
->prog
->OutputsWritten
|= (1U << (yyval
.dst_reg
).Index
);
2446 /* Line 1455 of yacc.c */
2447 #line 529 "program_parse.y"
2449 init_dst_reg(& (yyval
.dst_reg
));
2450 (yyval
.dst_reg
).File
= PROGRAM_ADDRESS
;
2451 (yyval
.dst_reg
).Index
= 0;
2452 (yyval
.dst_reg
).WriteMask
= (yyvsp
[(2) - (2)].swiz_mask
).mask
;
2458 /* Line 1455 of yacc.c */
2459 #line 538 "program_parse.y"
2461 const unsigned xyzw_valid
=
2462 ((yyvsp
[(1) - (7)].ext_swizzle
).xyzw_valid
<< 0)
2463 | ((yyvsp
[(3) - (7)].ext_swizzle
).xyzw_valid
<< 1)
2464 | ((yyvsp
[(5) - (7)].ext_swizzle
).xyzw_valid
<< 2)
2465 | ((yyvsp
[(7) - (7)].ext_swizzle
).xyzw_valid
<< 3);
2466 const unsigned rgba_valid
=
2467 ((yyvsp
[(1) - (7)].ext_swizzle
).rgba_valid
<< 0)
2468 | ((yyvsp
[(3) - (7)].ext_swizzle
).rgba_valid
<< 1)
2469 | ((yyvsp
[(5) - (7)].ext_swizzle
).rgba_valid
<< 2)
2470 | ((yyvsp
[(7) - (7)].ext_swizzle
).rgba_valid
<< 3);
2472 /* All of the swizzle components have to be valid in either RGBA
2473 * or XYZW. Note that 0 and 1 are valid in both, so both masks
2474 * can have some bits set.
2476 * We somewhat deviate from the spec here. It would be really hard
2477 * to figure out which component is the error, and there probably
2478 * isn't a lot of benefit.
2480 if ((rgba_valid
!= 0x0f) && (xyzw_valid
!= 0x0f)) {
2481 yyerror(& (yylsp
[(1) - (7)]), state
, "cannot combine RGBA and XYZW swizzle "
2486 (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
);
2487 (yyval
.swiz_mask
).mask
= ((yyvsp
[(1) - (7)].ext_swizzle
).negate
) | ((yyvsp
[(3) - (7)].ext_swizzle
).negate
<< 1) | ((yyvsp
[(5) - (7)].ext_swizzle
).negate
<< 2)
2488 | ((yyvsp
[(7) - (7)].ext_swizzle
).negate
<< 3);
2494 /* Line 1455 of yacc.c */
2495 #line 571 "program_parse.y"
2497 (yyval
.ext_swizzle
) = (yyvsp
[(2) - (2)].ext_swizzle
);
2498 (yyval
.ext_swizzle
).negate
= ((yyvsp
[(1) - (2)].negate
)) ? 1 : 0;
2504 /* Line 1455 of yacc.c */
2505 #line 578 "program_parse.y"
2507 if (((yyvsp
[(1) - (1)].integer
) != 0) && ((yyvsp
[(1) - (1)].integer
) != 1)) {
2508 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid extended swizzle selector");
2512 (yyval
.ext_swizzle
).swz
= ((yyvsp
[(1) - (1)].integer
) == 0) ? SWIZZLE_ZERO
: SWIZZLE_ONE
;
2514 /* 0 and 1 are valid for both RGBA swizzle names and XYZW
2517 (yyval
.ext_swizzle
).xyzw_valid
= 1;
2518 (yyval
.ext_swizzle
).rgba_valid
= 1;
2524 /* Line 1455 of yacc.c */
2525 #line 593 "program_parse.y"
2527 if (strlen((yyvsp
[(1) - (1)].string
)) > 1) {
2528 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid extended swizzle selector");
2532 switch ((yyvsp
[(1) - (1)].string
)[0]) {
2534 (yyval
.ext_swizzle
).swz
= SWIZZLE_X
;
2535 (yyval
.ext_swizzle
).xyzw_valid
= 1;
2538 (yyval
.ext_swizzle
).swz
= SWIZZLE_Y
;
2539 (yyval
.ext_swizzle
).xyzw_valid
= 1;
2542 (yyval
.ext_swizzle
).swz
= SWIZZLE_Z
;
2543 (yyval
.ext_swizzle
).xyzw_valid
= 1;
2546 (yyval
.ext_swizzle
).swz
= SWIZZLE_W
;
2547 (yyval
.ext_swizzle
).xyzw_valid
= 1;
2551 (yyval
.ext_swizzle
).swz
= SWIZZLE_X
;
2552 (yyval
.ext_swizzle
).rgba_valid
= 1;
2555 (yyval
.ext_swizzle
).swz
= SWIZZLE_Y
;
2556 (yyval
.ext_swizzle
).rgba_valid
= 1;
2559 (yyval
.ext_swizzle
).swz
= SWIZZLE_Z
;
2560 (yyval
.ext_swizzle
).rgba_valid
= 1;
2563 (yyval
.ext_swizzle
).swz
= SWIZZLE_W
;
2564 (yyval
.ext_swizzle
).rgba_valid
= 1;
2568 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid extended swizzle selector");
2577 /* Line 1455 of yacc.c */
2578 #line 643 "program_parse.y"
2580 struct asm_symbol
*const s
= (struct asm_symbol
*)
2581 _mesa_symbol_table_find_symbol(state
->st
, 0, (yyvsp
[(1) - (1)].string
));
2584 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid operand variable");
2586 } else if ((s
->type
!= at_param
) && (s
->type
!= at_temp
)
2587 && (s
->type
!= at_attrib
)) {
2588 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid operand variable");
2590 } else if ((s
->type
== at_param
) && s
->param_is_array
) {
2591 yyerror(& (yylsp
[(1) - (1)]), state
, "non-array access to array PARAM");
2595 init_src_reg(& (yyval
.src_reg
));
2598 (yyval
.src_reg
).Base
.File
= PROGRAM_TEMPORARY
;
2599 (yyval
.src_reg
).Base
.Index
= s
->temp_binding
;
2602 (yyval
.src_reg
).Base
.File
= s
->param_binding_type
;
2603 (yyval
.src_reg
).Base
.Index
= s
->param_binding_begin
;
2606 (yyval
.src_reg
).Base
.File
= PROGRAM_INPUT
;
2607 (yyval
.src_reg
).Base
.Index
= s
->attrib_binding
;
2608 state
->prog
->InputsRead
|= (1U << (yyval
.src_reg
).Base
.Index
);
2610 if (!validate_inputs(& (yylsp
[(1) - (1)]), state
)) {
2624 /* Line 1455 of yacc.c */
2625 #line 685 "program_parse.y"
2627 init_src_reg(& (yyval
.src_reg
));
2628 (yyval
.src_reg
).Base
.File
= PROGRAM_INPUT
;
2629 (yyval
.src_reg
).Base
.Index
= (yyvsp
[(1) - (1)].attrib
);
2630 state
->prog
->InputsRead
|= (1U << (yyval
.src_reg
).Base
.Index
);
2632 if (!validate_inputs(& (yylsp
[(1) - (1)]), state
)) {
2640 /* Line 1455 of yacc.c */
2641 #line 696 "program_parse.y"
2643 if (! (yyvsp
[(3) - (4)].src_reg
).Base
.RelAddr
2644 && ((unsigned) (yyvsp
[(3) - (4)].src_reg
).Base
.Index
>= (yyvsp
[(1) - (4)].sym
)->param_binding_length
)) {
2645 yyerror(& (yylsp
[(3) - (4)]), state
, "out of bounds array access");
2649 init_src_reg(& (yyval
.src_reg
));
2650 (yyval
.src_reg
).Base
.File
= (yyvsp
[(1) - (4)].sym
)->param_binding_type
;
2652 if ((yyvsp
[(3) - (4)].src_reg
).Base
.RelAddr
) {
2653 (yyvsp
[(1) - (4)].sym
)->param_accessed_indirectly
= 1;
2655 (yyval
.src_reg
).Base
.RelAddr
= 1;
2656 (yyval
.src_reg
).Base
.Index
= (yyvsp
[(3) - (4)].src_reg
).Base
.Index
;
2657 (yyval
.src_reg
).Symbol
= (yyvsp
[(1) - (4)].sym
);
2659 (yyval
.src_reg
).Base
.Index
= (yyvsp
[(1) - (4)].sym
)->param_binding_begin
+ (yyvsp
[(3) - (4)].src_reg
).Base
.Index
;
2666 /* Line 1455 of yacc.c */
2667 #line 717 "program_parse.y"
2669 init_src_reg(& (yyval
.src_reg
));
2670 (yyval
.src_reg
).Base
.File
= ((yyvsp
[(1) - (1)].temp_sym
).name
!= NULL
)
2671 ? (yyvsp
[(1) - (1)].temp_sym
).param_binding_type
2673 (yyval
.src_reg
).Base
.Index
= (yyvsp
[(1) - (1)].temp_sym
).param_binding_begin
;
2679 /* Line 1455 of yacc.c */
2680 #line 727 "program_parse.y"
2682 init_dst_reg(& (yyval
.dst_reg
));
2683 (yyval
.dst_reg
).File
= PROGRAM_OUTPUT
;
2684 (yyval
.dst_reg
).Index
= (yyvsp
[(1) - (1)].result
);
2690 /* Line 1455 of yacc.c */
2691 #line 733 "program_parse.y"
2693 struct asm_symbol
*const s
= (struct asm_symbol
*)
2694 _mesa_symbol_table_find_symbol(state
->st
, 0, (yyvsp
[(1) - (1)].string
));
2697 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid operand variable");
2699 } else if ((s
->type
!= at_output
) && (s
->type
!= at_temp
)) {
2700 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid operand variable");
2704 init_dst_reg(& (yyval
.dst_reg
));
2707 (yyval
.dst_reg
).File
= PROGRAM_TEMPORARY
;
2708 (yyval
.dst_reg
).Index
= s
->temp_binding
;
2711 (yyval
.dst_reg
).File
= PROGRAM_OUTPUT
;
2712 (yyval
.dst_reg
).Index
= s
->output_binding
;
2715 (yyval
.dst_reg
).File
= s
->param_binding_type
;
2716 (yyval
.dst_reg
).Index
= s
->param_binding_begin
;
2724 /* Line 1455 of yacc.c */
2725 #line 764 "program_parse.y"
2727 struct asm_symbol
*const s
= (struct asm_symbol
*)
2728 _mesa_symbol_table_find_symbol(state
->st
, 0, (yyvsp
[(1) - (1)].string
));
2731 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid operand variable");
2733 } else if ((s
->type
!= at_param
) || !s
->param_is_array
) {
2734 yyerror(& (yylsp
[(1) - (1)]), state
, "array access to non-PARAM variable");
2744 /* Line 1455 of yacc.c */
2745 #line 783 "program_parse.y"
2747 init_src_reg(& (yyval
.src_reg
));
2748 (yyval
.src_reg
).Base
.Index
= (yyvsp
[(1) - (1)].integer
);
2754 /* Line 1455 of yacc.c */
2755 #line 790 "program_parse.y"
2757 /* FINISHME: Add support for multiple address registers.
2759 /* FINISHME: Add support for 4-component address registers.
2761 init_src_reg(& (yyval
.src_reg
));
2762 (yyval
.src_reg
).Base
.RelAddr
= 1;
2763 (yyval
.src_reg
).Base
.Index
= (yyvsp
[(3) - (3)].integer
);
2769 /* Line 1455 of yacc.c */
2770 #line 801 "program_parse.y"
2771 { (yyval
.integer
) = 0; ;}
2776 /* Line 1455 of yacc.c */
2777 #line 802 "program_parse.y"
2778 { (yyval
.integer
) = (yyvsp
[(2) - (2)].integer
); ;}
2783 /* Line 1455 of yacc.c */
2784 #line 803 "program_parse.y"
2785 { (yyval
.integer
) = -(yyvsp
[(2) - (2)].integer
); ;}
2790 /* Line 1455 of yacc.c */
2791 #line 807 "program_parse.y"
2793 if (((yyvsp
[(1) - (1)].integer
) < 0) || ((yyvsp
[(1) - (1)].integer
) > 63)) {
2795 _mesa_snprintf(s
, sizeof(s
),
2796 "relative address offset too large (%d)", (yyvsp
[(1) - (1)].integer
));
2797 yyerror(& (yylsp
[(1) - (1)]), state
, s
);
2800 (yyval
.integer
) = (yyvsp
[(1) - (1)].integer
);
2807 /* Line 1455 of yacc.c */
2808 #line 821 "program_parse.y"
2810 if (((yyvsp
[(1) - (1)].integer
) < 0) || ((yyvsp
[(1) - (1)].integer
) > 64)) {
2812 _mesa_snprintf(s
, sizeof(s
),
2813 "relative address offset too large (%d)", (yyvsp
[(1) - (1)].integer
));
2814 yyerror(& (yylsp
[(1) - (1)]), state
, s
);
2817 (yyval
.integer
) = (yyvsp
[(1) - (1)].integer
);
2824 /* Line 1455 of yacc.c */
2825 #line 835 "program_parse.y"
2827 struct asm_symbol
*const s
= (struct asm_symbol
*)
2828 _mesa_symbol_table_find_symbol(state
->st
, 0, (yyvsp
[(1) - (1)].string
));
2831 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid array member");
2833 } else if (s
->type
!= at_address
) {
2834 yyerror(& (yylsp
[(1) - (1)]), state
,
2835 "invalid variable for indexed array access");
2845 /* Line 1455 of yacc.c */
2846 #line 853 "program_parse.y"
2848 if ((yyvsp
[(1) - (1)].swiz_mask
).mask
!= WRITEMASK_X
) {
2849 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid address component selector");
2852 (yyval
.swiz_mask
) = (yyvsp
[(1) - (1)].swiz_mask
);
2859 /* Line 1455 of yacc.c */
2860 #line 864 "program_parse.y"
2862 if ((yyvsp
[(1) - (1)].swiz_mask
).mask
!= WRITEMASK_X
) {
2863 yyerror(& (yylsp
[(1) - (1)]), state
,
2864 "address register write mask must be \".x\"");
2867 (yyval
.swiz_mask
) = (yyvsp
[(1) - (1)].swiz_mask
);
2874 /* Line 1455 of yacc.c */
2875 #line 880 "program_parse.y"
2876 { (yyval
.swiz_mask
).swizzle
= SWIZZLE_NOOP
; (yyval
.swiz_mask
).mask
= WRITEMASK_XYZW
; ;}
2881 /* Line 1455 of yacc.c */
2882 #line 884 "program_parse.y"
2883 { (yyval
.swiz_mask
).swizzle
= SWIZZLE_NOOP
; (yyval
.swiz_mask
).mask
= WRITEMASK_XYZW
; ;}
2888 /* Line 1455 of yacc.c */
2889 #line 896 "program_parse.y"
2891 struct asm_symbol
*const s
=
2892 declare_variable(state
, (yyvsp
[(2) - (4)].string
), at_attrib
, & (yylsp
[(2) - (4)]));
2897 s
->attrib_binding
= (yyvsp
[(4) - (4)].attrib
);
2898 state
->InputsBound
|= (1U << s
->attrib_binding
);
2900 if (!validate_inputs(& (yylsp
[(4) - (4)]), state
)) {
2909 /* Line 1455 of yacc.c */
2910 #line 914 "program_parse.y"
2912 (yyval
.attrib
) = (yyvsp
[(2) - (2)].attrib
);
2918 /* Line 1455 of yacc.c */
2919 #line 918 "program_parse.y"
2921 (yyval
.attrib
) = (yyvsp
[(2) - (2)].attrib
);
2927 /* Line 1455 of yacc.c */
2928 #line 924 "program_parse.y"
2930 (yyval
.attrib
) = VERT_ATTRIB_POS
;
2936 /* Line 1455 of yacc.c */
2937 #line 928 "program_parse.y"
2939 (yyval
.attrib
) = VERT_ATTRIB_WEIGHT
;
2945 /* Line 1455 of yacc.c */
2946 #line 932 "program_parse.y"
2948 (yyval
.attrib
) = VERT_ATTRIB_NORMAL
;
2954 /* Line 1455 of yacc.c */
2955 #line 936 "program_parse.y"
2957 if (!state
->ctx
->Extensions
.EXT_secondary_color
) {
2958 yyerror(& (yylsp
[(2) - (2)]), state
, "GL_EXT_secondary_color not supported");
2962 (yyval
.attrib
) = VERT_ATTRIB_COLOR0
+ (yyvsp
[(2) - (2)].integer
);
2968 /* Line 1455 of yacc.c */
2969 #line 945 "program_parse.y"
2971 if (!state
->ctx
->Extensions
.EXT_fog_coord
) {
2972 yyerror(& (yylsp
[(1) - (1)]), state
, "GL_EXT_fog_coord not supported");
2976 (yyval
.attrib
) = VERT_ATTRIB_FOG
;
2982 /* Line 1455 of yacc.c */
2983 #line 954 "program_parse.y"
2985 (yyval
.attrib
) = VERT_ATTRIB_TEX0
+ (yyvsp
[(2) - (2)].integer
);
2991 /* Line 1455 of yacc.c */
2992 #line 958 "program_parse.y"
2994 yyerror(& (yylsp
[(1) - (4)]), state
, "GL_ARB_matrix_palette not supported");
3001 /* Line 1455 of yacc.c */
3002 #line 963 "program_parse.y"
3004 (yyval
.attrib
) = VERT_ATTRIB_GENERIC0
+ (yyvsp
[(3) - (4)].integer
);
3010 /* Line 1455 of yacc.c */
3011 #line 969 "program_parse.y"
3013 if ((unsigned) (yyvsp
[(1) - (1)].integer
) >= state
->limits
->MaxAttribs
) {
3014 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid vertex attribute reference");
3018 (yyval
.integer
) = (yyvsp
[(1) - (1)].integer
);
3024 /* Line 1455 of yacc.c */
3025 #line 983 "program_parse.y"
3027 (yyval
.attrib
) = FRAG_ATTRIB_WPOS
;
3033 /* Line 1455 of yacc.c */
3034 #line 987 "program_parse.y"
3036 (yyval
.attrib
) = FRAG_ATTRIB_COL0
+ (yyvsp
[(2) - (2)].integer
);
3042 /* Line 1455 of yacc.c */
3043 #line 991 "program_parse.y"
3045 (yyval
.attrib
) = FRAG_ATTRIB_FOGC
;
3051 /* Line 1455 of yacc.c */
3052 #line 995 "program_parse.y"
3054 (yyval
.attrib
) = FRAG_ATTRIB_TEX0
+ (yyvsp
[(2) - (2)].integer
);
3060 /* Line 1455 of yacc.c */
3061 #line 1003 "program_parse.y"
3063 struct asm_symbol
*const s
=
3064 declare_variable(state
, (yyvsp
[(2) - (3)].string
), at_param
, & (yylsp
[(2) - (3)]));
3069 s
->param_binding_type
= (yyvsp
[(3) - (3)].temp_sym
).param_binding_type
;
3070 s
->param_binding_begin
= (yyvsp
[(3) - (3)].temp_sym
).param_binding_begin
;
3071 s
->param_binding_length
= (yyvsp
[(3) - (3)].temp_sym
).param_binding_length
;
3072 s
->param_is_array
= 0;
3079 /* Line 1455 of yacc.c */
3080 #line 1019 "program_parse.y"
3082 if (((yyvsp
[(4) - (6)].integer
) != 0) && ((unsigned) (yyvsp
[(4) - (6)].integer
) != (yyvsp
[(6) - (6)].temp_sym
).param_binding_length
)) {
3083 yyerror(& (yylsp
[(4) - (6)]), state
,
3084 "parameter array size and number of bindings must match");
3087 struct asm_symbol
*const s
=
3088 declare_variable(state
, (yyvsp
[(2) - (6)].string
), (yyvsp
[(6) - (6)].temp_sym
).type
, & (yylsp
[(2) - (6)]));
3093 s
->param_binding_type
= (yyvsp
[(6) - (6)].temp_sym
).param_binding_type
;
3094 s
->param_binding_begin
= (yyvsp
[(6) - (6)].temp_sym
).param_binding_begin
;
3095 s
->param_binding_length
= (yyvsp
[(6) - (6)].temp_sym
).param_binding_length
;
3096 s
->param_is_array
= 1;
3104 /* Line 1455 of yacc.c */
3105 #line 1041 "program_parse.y"
3107 (yyval
.integer
) = 0;
3113 /* Line 1455 of yacc.c */
3114 #line 1045 "program_parse.y"
3116 if (((yyvsp
[(1) - (1)].integer
) < 1) || ((unsigned) (yyvsp
[(1) - (1)].integer
) >= state
->limits
->MaxParameters
)) {
3117 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid parameter array size");
3120 (yyval
.integer
) = (yyvsp
[(1) - (1)].integer
);
3127 /* Line 1455 of yacc.c */
3128 #line 1056 "program_parse.y"
3130 (yyval
.temp_sym
) = (yyvsp
[(2) - (2)].temp_sym
);
3136 /* Line 1455 of yacc.c */
3137 #line 1062 "program_parse.y"
3139 (yyval
.temp_sym
) = (yyvsp
[(3) - (4)].temp_sym
);
3145 /* Line 1455 of yacc.c */
3146 #line 1069 "program_parse.y"
3148 (yyvsp
[(1) - (3)].temp_sym
).param_binding_length
+= (yyvsp
[(3) - (3)].temp_sym
).param_binding_length
;
3149 (yyval
.temp_sym
) = (yyvsp
[(1) - (3)].temp_sym
);
3155 /* Line 1455 of yacc.c */
3156 #line 1076 "program_parse.y"
3158 memset(& (yyval
.temp_sym
), 0, sizeof((yyval
.temp_sym
)));
3159 (yyval
.temp_sym
).param_binding_begin
= ~0;
3160 initialize_symbol_from_state(state
->prog
, & (yyval
.temp_sym
), (yyvsp
[(1) - (1)].state
));
3166 /* Line 1455 of yacc.c */
3167 #line 1082 "program_parse.y"
3169 memset(& (yyval
.temp_sym
), 0, sizeof((yyval
.temp_sym
)));
3170 (yyval
.temp_sym
).param_binding_begin
= ~0;
3171 initialize_symbol_from_param(state
->prog
, & (yyval
.temp_sym
), (yyvsp
[(1) - (1)].state
));
3177 /* Line 1455 of yacc.c */
3178 #line 1088 "program_parse.y"
3180 memset(& (yyval
.temp_sym
), 0, sizeof((yyval
.temp_sym
)));
3181 (yyval
.temp_sym
).param_binding_begin
= ~0;
3182 initialize_symbol_from_const(state
->prog
, & (yyval
.temp_sym
), & (yyvsp
[(1) - (1)].vector
));
3188 /* Line 1455 of yacc.c */
3189 #line 1096 "program_parse.y"
3191 memset(& (yyval
.temp_sym
), 0, sizeof((yyval
.temp_sym
)));
3192 (yyval
.temp_sym
).param_binding_begin
= ~0;
3193 initialize_symbol_from_state(state
->prog
, & (yyval
.temp_sym
), (yyvsp
[(1) - (1)].state
));
3199 /* Line 1455 of yacc.c */
3200 #line 1102 "program_parse.y"
3202 memset(& (yyval
.temp_sym
), 0, sizeof((yyval
.temp_sym
)));
3203 (yyval
.temp_sym
).param_binding_begin
= ~0;
3204 initialize_symbol_from_param(state
->prog
, & (yyval
.temp_sym
), (yyvsp
[(1) - (1)].state
));
3210 /* Line 1455 of yacc.c */
3211 #line 1108 "program_parse.y"
3213 memset(& (yyval
.temp_sym
), 0, sizeof((yyval
.temp_sym
)));
3214 (yyval
.temp_sym
).param_binding_begin
= ~0;
3215 initialize_symbol_from_const(state
->prog
, & (yyval
.temp_sym
), & (yyvsp
[(1) - (1)].vector
));
3221 /* Line 1455 of yacc.c */
3222 #line 1116 "program_parse.y"
3224 memset(& (yyval
.temp_sym
), 0, sizeof((yyval
.temp_sym
)));
3225 (yyval
.temp_sym
).param_binding_begin
= ~0;
3226 initialize_symbol_from_state(state
->prog
, & (yyval
.temp_sym
), (yyvsp
[(1) - (1)].state
));
3232 /* Line 1455 of yacc.c */
3233 #line 1122 "program_parse.y"
3235 memset(& (yyval
.temp_sym
), 0, sizeof((yyval
.temp_sym
)));
3236 (yyval
.temp_sym
).param_binding_begin
= ~0;
3237 initialize_symbol_from_param(state
->prog
, & (yyval
.temp_sym
), (yyvsp
[(1) - (1)].state
));
3243 /* Line 1455 of yacc.c */
3244 #line 1128 "program_parse.y"
3246 memset(& (yyval
.temp_sym
), 0, sizeof((yyval
.temp_sym
)));
3247 (yyval
.temp_sym
).param_binding_begin
= ~0;
3248 initialize_symbol_from_const(state
->prog
, & (yyval
.temp_sym
), & (yyvsp
[(1) - (1)].vector
));
3254 /* Line 1455 of yacc.c */
3255 #line 1135 "program_parse.y"
3256 { memcpy((yyval
.state
), (yyvsp
[(1) - (1)].state
), sizeof((yyval
.state
))); ;}
3261 /* Line 1455 of yacc.c */
3262 #line 1136 "program_parse.y"
3263 { memcpy((yyval
.state
), (yyvsp
[(2) - (2)].state
), sizeof((yyval
.state
))); ;}
3268 /* Line 1455 of yacc.c */
3269 #line 1139 "program_parse.y"
3270 { memcpy((yyval
.state
), (yyvsp
[(2) - (2)].state
), sizeof((yyval
.state
))); ;}
3275 /* Line 1455 of yacc.c */
3276 #line 1140 "program_parse.y"
3277 { memcpy((yyval
.state
), (yyvsp
[(2) - (2)].state
), sizeof((yyval
.state
))); ;}
3282 /* Line 1455 of yacc.c */
3283 #line 1141 "program_parse.y"
3284 { memcpy((yyval
.state
), (yyvsp
[(2) - (2)].state
), sizeof((yyval
.state
))); ;}
3289 /* Line 1455 of yacc.c */
3290 #line 1142 "program_parse.y"
3291 { memcpy((yyval
.state
), (yyvsp
[(2) - (2)].state
), sizeof((yyval
.state
))); ;}
3296 /* Line 1455 of yacc.c */
3297 #line 1143 "program_parse.y"
3298 { memcpy((yyval
.state
), (yyvsp
[(2) - (2)].state
), sizeof((yyval
.state
))); ;}
3303 /* Line 1455 of yacc.c */
3304 #line 1144 "program_parse.y"
3305 { memcpy((yyval
.state
), (yyvsp
[(2) - (2)].state
), sizeof((yyval
.state
))); ;}
3310 /* Line 1455 of yacc.c */
3311 #line 1145 "program_parse.y"
3312 { memcpy((yyval
.state
), (yyvsp
[(2) - (2)].state
), sizeof((yyval
.state
))); ;}
3317 /* Line 1455 of yacc.c */
3318 #line 1146 "program_parse.y"
3319 { memcpy((yyval
.state
), (yyvsp
[(2) - (2)].state
), sizeof((yyval
.state
))); ;}
3324 /* Line 1455 of yacc.c */
3325 #line 1147 "program_parse.y"
3326 { memcpy((yyval
.state
), (yyvsp
[(2) - (2)].state
), sizeof((yyval
.state
))); ;}
3331 /* Line 1455 of yacc.c */
3332 #line 1148 "program_parse.y"
3333 { memcpy((yyval
.state
), (yyvsp
[(2) - (2)].state
), sizeof((yyval
.state
))); ;}
3338 /* Line 1455 of yacc.c */
3339 #line 1149 "program_parse.y"
3340 { memcpy((yyval
.state
), (yyvsp
[(2) - (2)].state
), sizeof((yyval
.state
))); ;}
3345 /* Line 1455 of yacc.c */
3346 #line 1153 "program_parse.y"
3348 memset((yyval
.state
), 0, sizeof((yyval
.state
)));
3349 (yyval
.state
)[0] = STATE_MATERIAL
;
3350 (yyval
.state
)[1] = (yyvsp
[(2) - (3)].integer
);
3351 (yyval
.state
)[2] = (yyvsp
[(3) - (3)].integer
);
3357 /* Line 1455 of yacc.c */
3358 #line 1162 "program_parse.y"
3360 (yyval
.integer
) = (yyvsp
[(1) - (1)].integer
);
3366 /* Line 1455 of yacc.c */
3367 #line 1166 "program_parse.y"
3369 (yyval
.integer
) = STATE_EMISSION
;
3375 /* Line 1455 of yacc.c */
3376 #line 1170 "program_parse.y"
3378 (yyval
.integer
) = STATE_SHININESS
;
3384 /* Line 1455 of yacc.c */
3385 #line 1176 "program_parse.y"
3387 memset((yyval
.state
), 0, sizeof((yyval
.state
)));
3388 (yyval
.state
)[0] = STATE_LIGHT
;
3389 (yyval
.state
)[1] = (yyvsp
[(3) - (5)].integer
);
3390 (yyval
.state
)[2] = (yyvsp
[(5) - (5)].integer
);
3396 /* Line 1455 of yacc.c */
3397 #line 1185 "program_parse.y"
3399 (yyval
.integer
) = (yyvsp
[(1) - (1)].integer
);
3405 /* Line 1455 of yacc.c */
3406 #line 1189 "program_parse.y"
3408 (yyval
.integer
) = STATE_POSITION
;
3414 /* Line 1455 of yacc.c */
3415 #line 1193 "program_parse.y"
3417 if (!state
->ctx
->Extensions
.EXT_point_parameters
) {
3418 yyerror(& (yylsp
[(1) - (1)]), state
, "GL_ARB_point_parameters not supported");
3422 (yyval
.integer
) = STATE_ATTENUATION
;
3428 /* Line 1455 of yacc.c */
3429 #line 1202 "program_parse.y"
3431 (yyval
.integer
) = (yyvsp
[(2) - (2)].integer
);
3437 /* Line 1455 of yacc.c */
3438 #line 1206 "program_parse.y"
3440 (yyval
.integer
) = STATE_HALF_VECTOR
;
3446 /* Line 1455 of yacc.c */
3447 #line 1212 "program_parse.y"
3449 (yyval
.integer
) = STATE_SPOT_DIRECTION
;
3455 /* Line 1455 of yacc.c */
3456 #line 1218 "program_parse.y"
3458 (yyval
.state
)[0] = (yyvsp
[(2) - (2)].state
)[0];
3459 (yyval
.state
)[1] = (yyvsp
[(2) - (2)].state
)[1];
3465 /* Line 1455 of yacc.c */
3466 #line 1225 "program_parse.y"
3468 memset((yyval
.state
), 0, sizeof((yyval
.state
)));
3469 (yyval
.state
)[0] = STATE_LIGHTMODEL_AMBIENT
;
3475 /* Line 1455 of yacc.c */
3476 #line 1230 "program_parse.y"
3478 memset((yyval
.state
), 0, sizeof((yyval
.state
)));
3479 (yyval
.state
)[0] = STATE_LIGHTMODEL_SCENECOLOR
;
3480 (yyval
.state
)[1] = (yyvsp
[(1) - (2)].integer
);
3486 /* Line 1455 of yacc.c */
3487 #line 1238 "program_parse.y"
3489 memset((yyval
.state
), 0, sizeof((yyval
.state
)));
3490 (yyval
.state
)[0] = STATE_LIGHTPROD
;
3491 (yyval
.state
)[1] = (yyvsp
[(3) - (6)].integer
);
3492 (yyval
.state
)[2] = (yyvsp
[(5) - (6)].integer
);
3493 (yyval
.state
)[3] = (yyvsp
[(6) - (6)].integer
);
3499 /* Line 1455 of yacc.c */
3500 #line 1250 "program_parse.y"
3502 memset((yyval
.state
), 0, sizeof((yyval
.state
)));
3503 (yyval
.state
)[0] = (yyvsp
[(3) - (3)].integer
);
3504 (yyval
.state
)[1] = (yyvsp
[(2) - (3)].integer
);
3510 /* Line 1455 of yacc.c */
3511 #line 1258 "program_parse.y"
3513 (yyval
.integer
) = STATE_TEXENV_COLOR
;
3519 /* Line 1455 of yacc.c */
3520 #line 1264 "program_parse.y"
3522 (yyval
.integer
) = STATE_AMBIENT
;
3528 /* Line 1455 of yacc.c */
3529 #line 1268 "program_parse.y"
3531 (yyval
.integer
) = STATE_DIFFUSE
;
3537 /* Line 1455 of yacc.c */
3538 #line 1272 "program_parse.y"
3540 (yyval
.integer
) = STATE_SPECULAR
;
3546 /* Line 1455 of yacc.c */
3547 #line 1278 "program_parse.y"
3549 if ((unsigned) (yyvsp
[(1) - (1)].integer
) >= state
->MaxLights
) {
3550 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid light selector");
3554 (yyval
.integer
) = (yyvsp
[(1) - (1)].integer
);
3560 /* Line 1455 of yacc.c */
3561 #line 1289 "program_parse.y"
3563 memset((yyval
.state
), 0, sizeof((yyval
.state
)));
3564 (yyval
.state
)[0] = STATE_TEXGEN
;
3565 (yyval
.state
)[1] = (yyvsp
[(2) - (4)].integer
);
3566 (yyval
.state
)[2] = (yyvsp
[(3) - (4)].integer
) + (yyvsp
[(4) - (4)].integer
);
3572 /* Line 1455 of yacc.c */
3573 #line 1298 "program_parse.y"
3575 (yyval
.integer
) = STATE_TEXGEN_EYE_S
;
3581 /* Line 1455 of yacc.c */
3582 #line 1302 "program_parse.y"
3584 (yyval
.integer
) = STATE_TEXGEN_OBJECT_S
;
3590 /* Line 1455 of yacc.c */
3591 #line 1307 "program_parse.y"
3593 (yyval
.integer
) = STATE_TEXGEN_EYE_S
- STATE_TEXGEN_EYE_S
;
3599 /* Line 1455 of yacc.c */
3600 #line 1311 "program_parse.y"
3602 (yyval
.integer
) = STATE_TEXGEN_EYE_T
- STATE_TEXGEN_EYE_S
;
3608 /* Line 1455 of yacc.c */
3609 #line 1315 "program_parse.y"
3611 (yyval
.integer
) = STATE_TEXGEN_EYE_R
- STATE_TEXGEN_EYE_S
;
3617 /* Line 1455 of yacc.c */
3618 #line 1319 "program_parse.y"
3620 (yyval
.integer
) = STATE_TEXGEN_EYE_Q
- STATE_TEXGEN_EYE_S
;
3626 /* Line 1455 of yacc.c */
3627 #line 1325 "program_parse.y"
3629 memset((yyval
.state
), 0, sizeof((yyval
.state
)));
3630 (yyval
.state
)[0] = (yyvsp
[(2) - (2)].integer
);
3636 /* Line 1455 of yacc.c */
3637 #line 1332 "program_parse.y"
3639 (yyval
.integer
) = STATE_FOG_COLOR
;
3645 /* Line 1455 of yacc.c */
3646 #line 1336 "program_parse.y"
3648 (yyval
.integer
) = STATE_FOG_PARAMS
;
3654 /* Line 1455 of yacc.c */
3655 #line 1342 "program_parse.y"
3657 memset((yyval
.state
), 0, sizeof((yyval
.state
)));
3658 (yyval
.state
)[0] = STATE_CLIPPLANE
;
3659 (yyval
.state
)[1] = (yyvsp
[(3) - (5)].integer
);
3665 /* Line 1455 of yacc.c */
3666 #line 1350 "program_parse.y"
3668 if ((unsigned) (yyvsp
[(1) - (1)].integer
) >= state
->MaxClipPlanes
) {
3669 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid clip plane selector");
3673 (yyval
.integer
) = (yyvsp
[(1) - (1)].integer
);
3679 /* Line 1455 of yacc.c */
3680 #line 1361 "program_parse.y"
3682 memset((yyval
.state
), 0, sizeof((yyval
.state
)));
3683 (yyval
.state
)[0] = (yyvsp
[(2) - (2)].integer
);
3689 /* Line 1455 of yacc.c */
3690 #line 1368 "program_parse.y"
3692 (yyval
.integer
) = STATE_POINT_SIZE
;
3698 /* Line 1455 of yacc.c */
3699 #line 1372 "program_parse.y"
3701 (yyval
.integer
) = STATE_POINT_ATTENUATION
;
3707 /* Line 1455 of yacc.c */
3708 #line 1378 "program_parse.y"
3710 (yyval
.state
)[0] = (yyvsp
[(1) - (5)].state
)[0];
3711 (yyval
.state
)[1] = (yyvsp
[(1) - (5)].state
)[1];
3712 (yyval
.state
)[2] = (yyvsp
[(4) - (5)].integer
);
3713 (yyval
.state
)[3] = (yyvsp
[(4) - (5)].integer
);
3714 (yyval
.state
)[4] = (yyvsp
[(1) - (5)].state
)[2];
3720 /* Line 1455 of yacc.c */
3721 #line 1388 "program_parse.y"
3723 (yyval
.state
)[0] = (yyvsp
[(1) - (2)].state
)[0];
3724 (yyval
.state
)[1] = (yyvsp
[(1) - (2)].state
)[1];
3725 (yyval
.state
)[2] = (yyvsp
[(2) - (2)].state
)[2];
3726 (yyval
.state
)[3] = (yyvsp
[(2) - (2)].state
)[3];
3727 (yyval
.state
)[4] = (yyvsp
[(1) - (2)].state
)[2];
3733 /* Line 1455 of yacc.c */
3734 #line 1398 "program_parse.y"
3736 (yyval
.state
)[2] = 0;
3737 (yyval
.state
)[3] = 3;
3743 /* Line 1455 of yacc.c */
3744 #line 1403 "program_parse.y"
3746 /* It seems logical that the matrix row range specifier would have
3747 * to specify a range or more than one row (i.e., $5 > $3).
3748 * However, the ARB_vertex_program spec says "a program will fail
3749 * to load if <a> is greater than <b>." This means that $3 == $5
3752 if ((yyvsp
[(3) - (6)].integer
) > (yyvsp
[(5) - (6)].integer
)) {
3753 yyerror(& (yylsp
[(3) - (6)]), state
, "invalid matrix row range");
3757 (yyval
.state
)[2] = (yyvsp
[(3) - (6)].integer
);
3758 (yyval
.state
)[3] = (yyvsp
[(5) - (6)].integer
);
3764 /* Line 1455 of yacc.c */
3765 #line 1421 "program_parse.y"
3767 (yyval
.state
)[0] = (yyvsp
[(2) - (3)].state
)[0];
3768 (yyval
.state
)[1] = (yyvsp
[(2) - (3)].state
)[1];
3769 (yyval
.state
)[2] = (yyvsp
[(3) - (3)].integer
);
3775 /* Line 1455 of yacc.c */
3776 #line 1429 "program_parse.y"
3778 (yyval
.integer
) = 0;
3784 /* Line 1455 of yacc.c */
3785 #line 1433 "program_parse.y"
3787 (yyval
.integer
) = (yyvsp
[(1) - (1)].integer
);
3793 /* Line 1455 of yacc.c */
3794 #line 1439 "program_parse.y"
3796 (yyval
.integer
) = STATE_MATRIX_INVERSE
;
3802 /* Line 1455 of yacc.c */
3803 #line 1443 "program_parse.y"
3805 (yyval
.integer
) = STATE_MATRIX_TRANSPOSE
;
3811 /* Line 1455 of yacc.c */
3812 #line 1447 "program_parse.y"
3814 (yyval
.integer
) = STATE_MATRIX_INVTRANS
;
3820 /* Line 1455 of yacc.c */
3821 #line 1453 "program_parse.y"
3823 if ((yyvsp
[(1) - (1)].integer
) > 3) {
3824 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid matrix row reference");
3828 (yyval
.integer
) = (yyvsp
[(1) - (1)].integer
);
3834 /* Line 1455 of yacc.c */
3835 #line 1464 "program_parse.y"
3837 (yyval
.state
)[0] = STATE_MODELVIEW_MATRIX
;
3838 (yyval
.state
)[1] = (yyvsp
[(2) - (2)].integer
);
3844 /* Line 1455 of yacc.c */
3845 #line 1469 "program_parse.y"
3847 (yyval
.state
)[0] = STATE_PROJECTION_MATRIX
;
3848 (yyval
.state
)[1] = 0;
3854 /* Line 1455 of yacc.c */
3855 #line 1474 "program_parse.y"
3857 (yyval
.state
)[0] = STATE_MVP_MATRIX
;
3858 (yyval
.state
)[1] = 0;
3864 /* Line 1455 of yacc.c */
3865 #line 1479 "program_parse.y"
3867 (yyval
.state
)[0] = STATE_TEXTURE_MATRIX
;
3868 (yyval
.state
)[1] = (yyvsp
[(2) - (2)].integer
);
3874 /* Line 1455 of yacc.c */
3875 #line 1484 "program_parse.y"
3877 yyerror(& (yylsp
[(1) - (4)]), state
, "GL_ARB_matrix_palette not supported");
3884 /* Line 1455 of yacc.c */
3885 #line 1489 "program_parse.y"
3887 (yyval
.state
)[0] = STATE_PROGRAM_MATRIX
;
3888 (yyval
.state
)[1] = (yyvsp
[(3) - (4)].integer
);
3894 /* Line 1455 of yacc.c */
3895 #line 1496 "program_parse.y"
3897 (yyval
.integer
) = 0;
3903 /* Line 1455 of yacc.c */
3904 #line 1500 "program_parse.y"
3906 (yyval
.integer
) = (yyvsp
[(2) - (3)].integer
);
3912 /* Line 1455 of yacc.c */
3913 #line 1505 "program_parse.y"
3915 /* Since GL_ARB_vertex_blend isn't supported, only modelview matrix
3918 if ((yyvsp
[(1) - (1)].integer
) != 0) {
3919 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid modelview matrix index");
3923 (yyval
.integer
) = (yyvsp
[(1) - (1)].integer
);
3929 /* Line 1455 of yacc.c */
3930 #line 1518 "program_parse.y"
3932 /* Since GL_ARB_matrix_palette isn't supported, just let any value
3933 * through here. The error will be generated later.
3935 (yyval
.integer
) = (yyvsp
[(1) - (1)].integer
);
3941 /* Line 1455 of yacc.c */
3942 #line 1526 "program_parse.y"
3944 if ((unsigned) (yyvsp
[(1) - (1)].integer
) >= state
->MaxProgramMatrices
) {
3945 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid program matrix selector");
3949 (yyval
.integer
) = (yyvsp
[(1) - (1)].integer
);
3955 /* Line 1455 of yacc.c */
3956 #line 1537 "program_parse.y"
3958 memset((yyval
.state
), 0, sizeof((yyval
.state
)));
3959 (yyval
.state
)[0] = STATE_DEPTH_RANGE
;
3965 /* Line 1455 of yacc.c */
3966 #line 1549 "program_parse.y"
3968 memset((yyval
.state
), 0, sizeof((yyval
.state
)));
3969 (yyval
.state
)[0] = state
->state_param_enum
;
3970 (yyval
.state
)[1] = STATE_ENV
;
3971 (yyval
.state
)[2] = (yyvsp
[(4) - (5)].state
)[0];
3972 (yyval
.state
)[3] = (yyvsp
[(4) - (5)].state
)[1];
3978 /* Line 1455 of yacc.c */
3979 #line 1559 "program_parse.y"
3981 (yyval
.state
)[0] = (yyvsp
[(1) - (1)].integer
);
3982 (yyval
.state
)[1] = (yyvsp
[(1) - (1)].integer
);
3988 /* Line 1455 of yacc.c */
3989 #line 1564 "program_parse.y"
3991 (yyval
.state
)[0] = (yyvsp
[(1) - (3)].integer
);
3992 (yyval
.state
)[1] = (yyvsp
[(3) - (3)].integer
);
3998 /* Line 1455 of yacc.c */
3999 #line 1571 "program_parse.y"
4001 memset((yyval
.state
), 0, sizeof((yyval
.state
)));
4002 (yyval
.state
)[0] = state
->state_param_enum
;
4003 (yyval
.state
)[1] = STATE_ENV
;
4004 (yyval
.state
)[2] = (yyvsp
[(4) - (5)].integer
);
4005 (yyval
.state
)[3] = (yyvsp
[(4) - (5)].integer
);
4011 /* Line 1455 of yacc.c */
4012 #line 1581 "program_parse.y"
4014 memset((yyval
.state
), 0, sizeof((yyval
.state
)));
4015 (yyval
.state
)[0] = state
->state_param_enum
;
4016 (yyval
.state
)[1] = STATE_LOCAL
;
4017 (yyval
.state
)[2] = (yyvsp
[(4) - (5)].state
)[0];
4018 (yyval
.state
)[3] = (yyvsp
[(4) - (5)].state
)[1];
4024 /* Line 1455 of yacc.c */
4025 #line 1590 "program_parse.y"
4027 (yyval
.state
)[0] = (yyvsp
[(1) - (1)].integer
);
4028 (yyval
.state
)[1] = (yyvsp
[(1) - (1)].integer
);
4034 /* Line 1455 of yacc.c */
4035 #line 1595 "program_parse.y"
4037 (yyval
.state
)[0] = (yyvsp
[(1) - (3)].integer
);
4038 (yyval
.state
)[1] = (yyvsp
[(3) - (3)].integer
);
4044 /* Line 1455 of yacc.c */
4045 #line 1602 "program_parse.y"
4047 memset((yyval
.state
), 0, sizeof((yyval
.state
)));
4048 (yyval
.state
)[0] = state
->state_param_enum
;
4049 (yyval
.state
)[1] = STATE_LOCAL
;
4050 (yyval
.state
)[2] = (yyvsp
[(4) - (5)].integer
);
4051 (yyval
.state
)[3] = (yyvsp
[(4) - (5)].integer
);
4057 /* Line 1455 of yacc.c */
4058 #line 1612 "program_parse.y"
4060 if ((unsigned) (yyvsp
[(1) - (1)].integer
) >= state
->limits
->MaxEnvParams
) {
4061 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid environment parameter reference");
4064 (yyval
.integer
) = (yyvsp
[(1) - (1)].integer
);
4070 /* Line 1455 of yacc.c */
4071 #line 1622 "program_parse.y"
4073 if ((unsigned) (yyvsp
[(1) - (1)].integer
) >= state
->limits
->MaxLocalParams
) {
4074 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid local parameter reference");
4077 (yyval
.integer
) = (yyvsp
[(1) - (1)].integer
);
4083 /* Line 1455 of yacc.c */
4084 #line 1637 "program_parse.y"
4086 (yyval
.vector
).count
= 4;
4087 (yyval
.vector
).data
[0] = (yyvsp
[(1) - (1)].real
);
4088 (yyval
.vector
).data
[1] = (yyvsp
[(1) - (1)].real
);
4089 (yyval
.vector
).data
[2] = (yyvsp
[(1) - (1)].real
);
4090 (yyval
.vector
).data
[3] = (yyvsp
[(1) - (1)].real
);
4096 /* Line 1455 of yacc.c */
4097 #line 1647 "program_parse.y"
4099 (yyval
.vector
).count
= 1;
4100 (yyval
.vector
).data
[0] = (yyvsp
[(1) - (1)].real
);
4101 (yyval
.vector
).data
[1] = (yyvsp
[(1) - (1)].real
);
4102 (yyval
.vector
).data
[2] = (yyvsp
[(1) - (1)].real
);
4103 (yyval
.vector
).data
[3] = (yyvsp
[(1) - (1)].real
);
4109 /* Line 1455 of yacc.c */
4110 #line 1655 "program_parse.y"
4112 (yyval
.vector
).count
= 1;
4113 (yyval
.vector
).data
[0] = (float) (yyvsp
[(1) - (1)].integer
);
4114 (yyval
.vector
).data
[1] = (float) (yyvsp
[(1) - (1)].integer
);
4115 (yyval
.vector
).data
[2] = (float) (yyvsp
[(1) - (1)].integer
);
4116 (yyval
.vector
).data
[3] = (float) (yyvsp
[(1) - (1)].integer
);
4122 /* Line 1455 of yacc.c */
4123 #line 1665 "program_parse.y"
4125 (yyval
.vector
).count
= 4;
4126 (yyval
.vector
).data
[0] = (yyvsp
[(2) - (3)].real
);
4127 (yyval
.vector
).data
[1] = 0.0f
;
4128 (yyval
.vector
).data
[2] = 0.0f
;
4129 (yyval
.vector
).data
[3] = 1.0f
;
4135 /* Line 1455 of yacc.c */
4136 #line 1673 "program_parse.y"
4138 (yyval
.vector
).count
= 4;
4139 (yyval
.vector
).data
[0] = (yyvsp
[(2) - (5)].real
);
4140 (yyval
.vector
).data
[1] = (yyvsp
[(4) - (5)].real
);
4141 (yyval
.vector
).data
[2] = 0.0f
;
4142 (yyval
.vector
).data
[3] = 1.0f
;
4148 /* Line 1455 of yacc.c */
4149 #line 1682 "program_parse.y"
4151 (yyval
.vector
).count
= 4;
4152 (yyval
.vector
).data
[0] = (yyvsp
[(2) - (7)].real
);
4153 (yyval
.vector
).data
[1] = (yyvsp
[(4) - (7)].real
);
4154 (yyval
.vector
).data
[2] = (yyvsp
[(6) - (7)].real
);
4155 (yyval
.vector
).data
[3] = 1.0f
;
4161 /* Line 1455 of yacc.c */
4162 #line 1691 "program_parse.y"
4164 (yyval
.vector
).count
= 4;
4165 (yyval
.vector
).data
[0] = (yyvsp
[(2) - (9)].real
);
4166 (yyval
.vector
).data
[1] = (yyvsp
[(4) - (9)].real
);
4167 (yyval
.vector
).data
[2] = (yyvsp
[(6) - (9)].real
);
4168 (yyval
.vector
).data
[3] = (yyvsp
[(8) - (9)].real
);
4174 /* Line 1455 of yacc.c */
4175 #line 1701 "program_parse.y"
4177 (yyval
.real
) = ((yyvsp
[(1) - (2)].negate
)) ? -(yyvsp
[(2) - (2)].real
) : (yyvsp
[(2) - (2)].real
);
4183 /* Line 1455 of yacc.c */
4184 #line 1705 "program_parse.y"
4186 (yyval
.real
) = (float)(((yyvsp
[(1) - (2)].negate
)) ? -(yyvsp
[(2) - (2)].integer
) : (yyvsp
[(2) - (2)].integer
));
4192 /* Line 1455 of yacc.c */
4193 #line 1710 "program_parse.y"
4194 { (yyval
.negate
) = FALSE
; ;}
4199 /* Line 1455 of yacc.c */
4200 #line 1711 "program_parse.y"
4201 { (yyval
.negate
) = TRUE
; ;}
4206 /* Line 1455 of yacc.c */
4207 #line 1712 "program_parse.y"
4208 { (yyval
.negate
) = FALSE
; ;}
4213 /* Line 1455 of yacc.c */
4214 #line 1715 "program_parse.y"
4215 { (yyval
.integer
) = (yyvsp
[(1) - (1)].integer
); ;}
4220 /* Line 1455 of yacc.c */
4221 #line 1718 "program_parse.y"
4222 { (yyval
.integer
) = (yyvsp
[(1) - (1)].integer
); ;}
4227 /* Line 1455 of yacc.c */
4228 #line 1722 "program_parse.y"
4230 if (!declare_variable(state
, (yyvsp
[(3) - (3)].string
), (yyvsp
[(0) - (3)].integer
), & (yylsp
[(3) - (3)]))) {
4238 /* Line 1455 of yacc.c */
4239 #line 1728 "program_parse.y"
4241 if (!declare_variable(state
, (yyvsp
[(1) - (1)].string
), (yyvsp
[(0) - (1)].integer
), & (yylsp
[(1) - (1)]))) {
4249 /* Line 1455 of yacc.c */
4250 #line 1736 "program_parse.y"
4252 struct asm_symbol
*const s
=
4253 declare_variable(state
, (yyvsp
[(2) - (4)].string
), at_output
, & (yylsp
[(2) - (4)]));
4258 s
->output_binding
= (yyvsp
[(4) - (4)].result
);
4265 /* Line 1455 of yacc.c */
4266 #line 1749 "program_parse.y"
4268 if (state
->mode
== ARB_vertex
) {
4269 (yyval
.result
) = VERT_RESULT_HPOS
;
4271 yyerror(& (yylsp
[(2) - (2)]), state
, "invalid program result name");
4279 /* Line 1455 of yacc.c */
4280 #line 1758 "program_parse.y"
4282 if (state
->mode
== ARB_vertex
) {
4283 (yyval
.result
) = VERT_RESULT_FOGC
;
4285 yyerror(& (yylsp
[(2) - (2)]), state
, "invalid program result name");
4293 /* Line 1455 of yacc.c */
4294 #line 1767 "program_parse.y"
4296 (yyval
.result
) = (yyvsp
[(2) - (2)].result
);
4302 /* Line 1455 of yacc.c */
4303 #line 1771 "program_parse.y"
4305 if (state
->mode
== ARB_vertex
) {
4306 (yyval
.result
) = VERT_RESULT_PSIZ
;
4308 yyerror(& (yylsp
[(2) - (2)]), state
, "invalid program result name");
4316 /* Line 1455 of yacc.c */
4317 #line 1780 "program_parse.y"
4319 if (state
->mode
== ARB_vertex
) {
4320 (yyval
.result
) = VERT_RESULT_TEX0
+ (yyvsp
[(3) - (3)].integer
);
4322 yyerror(& (yylsp
[(2) - (3)]), state
, "invalid program result name");
4330 /* Line 1455 of yacc.c */
4331 #line 1789 "program_parse.y"
4333 if (state
->mode
== ARB_fragment
) {
4334 (yyval
.result
) = FRAG_RESULT_DEPTH
;
4336 yyerror(& (yylsp
[(2) - (2)]), state
, "invalid program result name");
4344 /* Line 1455 of yacc.c */
4345 #line 1800 "program_parse.y"
4347 (yyval
.result
) = (yyvsp
[(2) - (3)].integer
) + (yyvsp
[(3) - (3)].integer
);
4353 /* Line 1455 of yacc.c */
4354 #line 1806 "program_parse.y"
4356 (yyval
.integer
) = (state
->mode
== ARB_vertex
)
4358 : FRAG_RESULT_COLOR
;
4364 /* Line 1455 of yacc.c */
4365 #line 1812 "program_parse.y"
4367 if (state
->mode
== ARB_vertex
) {
4368 (yyval
.integer
) = VERT_RESULT_COL0
;
4370 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid program result name");
4378 /* Line 1455 of yacc.c */
4379 #line 1821 "program_parse.y"
4381 if (state
->mode
== ARB_vertex
) {
4382 (yyval
.integer
) = VERT_RESULT_BFC0
;
4384 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid program result name");
4392 /* Line 1455 of yacc.c */
4393 #line 1832 "program_parse.y"
4395 (yyval
.integer
) = 0;
4401 /* Line 1455 of yacc.c */
4402 #line 1836 "program_parse.y"
4404 if (state
->mode
== ARB_vertex
) {
4405 (yyval
.integer
) = 0;
4407 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid program result name");
4415 /* Line 1455 of yacc.c */
4416 #line 1845 "program_parse.y"
4418 if (state
->mode
== ARB_vertex
) {
4419 (yyval
.integer
) = 1;
4421 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid program result name");
4429 /* Line 1455 of yacc.c */
4430 #line 1855 "program_parse.y"
4431 { (yyval
.integer
) = 0; ;}
4436 /* Line 1455 of yacc.c */
4437 #line 1856 "program_parse.y"
4438 { (yyval
.integer
) = 0; ;}
4443 /* Line 1455 of yacc.c */
4444 #line 1857 "program_parse.y"
4445 { (yyval
.integer
) = 1; ;}
4450 /* Line 1455 of yacc.c */
4451 #line 1860 "program_parse.y"
4452 { (yyval
.integer
) = 0; ;}
4457 /* Line 1455 of yacc.c */
4458 #line 1861 "program_parse.y"
4459 { (yyval
.integer
) = 0; ;}
4464 /* Line 1455 of yacc.c */
4465 #line 1862 "program_parse.y"
4466 { (yyval
.integer
) = 1; ;}
4471 /* Line 1455 of yacc.c */
4472 #line 1865 "program_parse.y"
4473 { (yyval
.integer
) = 0; ;}
4478 /* Line 1455 of yacc.c */
4479 #line 1866 "program_parse.y"
4480 { (yyval
.integer
) = (yyvsp
[(2) - (3)].integer
); ;}
4485 /* Line 1455 of yacc.c */
4486 #line 1869 "program_parse.y"
4487 { (yyval
.integer
) = 0; ;}
4492 /* Line 1455 of yacc.c */
4493 #line 1870 "program_parse.y"
4494 { (yyval
.integer
) = (yyvsp
[(2) - (3)].integer
); ;}
4499 /* Line 1455 of yacc.c */
4500 #line 1873 "program_parse.y"
4501 { (yyval
.integer
) = 0; ;}
4506 /* Line 1455 of yacc.c */
4507 #line 1874 "program_parse.y"
4508 { (yyval
.integer
) = (yyvsp
[(2) - (3)].integer
); ;}
4513 /* Line 1455 of yacc.c */
4514 #line 1878 "program_parse.y"
4516 if ((unsigned) (yyvsp
[(1) - (1)].integer
) >= state
->MaxTextureCoordUnits
) {
4517 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid texture coordinate unit selector");
4521 (yyval
.integer
) = (yyvsp
[(1) - (1)].integer
);
4527 /* Line 1455 of yacc.c */
4528 #line 1889 "program_parse.y"
4530 if ((unsigned) (yyvsp
[(1) - (1)].integer
) >= state
->MaxTextureImageUnits
) {
4531 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid texture image unit selector");
4535 (yyval
.integer
) = (yyvsp
[(1) - (1)].integer
);
4541 /* Line 1455 of yacc.c */
4542 #line 1900 "program_parse.y"
4544 if ((unsigned) (yyvsp
[(1) - (1)].integer
) >= state
->MaxTextureUnits
) {
4545 yyerror(& (yylsp
[(1) - (1)]), state
, "invalid texture unit selector");
4549 (yyval
.integer
) = (yyvsp
[(1) - (1)].integer
);
4555 /* Line 1455 of yacc.c */
4556 #line 1911 "program_parse.y"
4558 struct asm_symbol
*exist
= (struct asm_symbol
*)
4559 _mesa_symbol_table_find_symbol(state
->st
, 0, (yyvsp
[(2) - (4)].string
));
4560 struct asm_symbol
*target
= (struct asm_symbol
*)
4561 _mesa_symbol_table_find_symbol(state
->st
, 0, (yyvsp
[(4) - (4)].string
));
4564 if (exist
!= NULL
) {
4565 yyerror(& (yylsp
[(2) - (4)]), state
, "redeclared identifier");
4567 } else if (target
== NULL
) {
4568 yyerror(& (yylsp
[(4) - (4)]), state
,
4569 "undefined variable binding in ALIAS statement");
4572 _mesa_symbol_table_add_symbol(state
->st
, 0, (yyvsp
[(2) - (4)].string
), target
);
4579 /* Line 1455 of yacc.c */
4580 #line 4581 "program_parse.tab.c"
4583 YY_SYMBOL_PRINT ("-> $$ =", yyr1
[yyn
], &yyval
, &yyloc
);
4587 YY_STACK_PRINT (yyss
, yyssp
);
4592 /* Now `shift' the result of the reduction. Determine what state
4593 that goes to, based on the state we popped back to and the rule
4594 number reduced by. */
4598 yystate
= yypgoto
[yyn
- YYNTOKENS
] + *yyssp
;
4599 if (0 <= yystate
&& yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
4600 yystate
= yytable
[yystate
];
4602 yystate
= yydefgoto
[yyn
- YYNTOKENS
];
4607 /*------------------------------------.
4608 | yyerrlab -- here on detecting error |
4609 `------------------------------------*/
4611 /* If not already recovering from an error, report this error. */
4615 #if ! YYERROR_VERBOSE
4616 yyerror (&yylloc
, state
, YY_("syntax error"));
4619 YYSIZE_T yysize
= yysyntax_error (0, yystate
, yychar
);
4620 if (yymsg_alloc
< yysize
&& yymsg_alloc
< YYSTACK_ALLOC_MAXIMUM
)
4622 YYSIZE_T yyalloc
= 2 * yysize
;
4623 if (! (yysize
<= yyalloc
&& yyalloc
<= YYSTACK_ALLOC_MAXIMUM
))
4624 yyalloc
= YYSTACK_ALLOC_MAXIMUM
;
4625 if (yymsg
!= yymsgbuf
)
4626 YYSTACK_FREE (yymsg
);
4627 yymsg
= (char *) YYSTACK_ALLOC (yyalloc
);
4629 yymsg_alloc
= yyalloc
;
4633 yymsg_alloc
= sizeof yymsgbuf
;
4637 if (0 < yysize
&& yysize
<= yymsg_alloc
)
4639 (void) yysyntax_error (yymsg
, yystate
, yychar
);
4640 yyerror (&yylloc
, state
, yymsg
);
4644 yyerror (&yylloc
, state
, YY_("syntax error"));
4646 goto yyexhaustedlab
;
4652 yyerror_range
[0] = yylloc
;
4654 if (yyerrstatus
== 3)
4656 /* If just tried and failed to reuse lookahead token after an
4657 error, discard it. */
4659 if (yychar
<= YYEOF
)
4661 /* Return failure if at end of input. */
4662 if (yychar
== YYEOF
)
4667 yydestruct ("Error: discarding",
4668 yytoken
, &yylval
, &yylloc
, state
);
4673 /* Else will try to reuse lookahead token after shifting the error
4678 /*---------------------------------------------------.
4679 | yyerrorlab -- error raised explicitly by YYERROR. |
4680 `---------------------------------------------------*/
4683 /* Pacify compilers like GCC when the user code never invokes
4684 YYERROR and the label yyerrorlab therefore never appears in user
4686 if (/*CONSTCOND*/ 0)
4689 yyerror_range
[0] = yylsp
[1-yylen
];
4690 /* Do not reclaim the symbols of the rule which action triggered
4694 YY_STACK_PRINT (yyss
, yyssp
);
4699 /*-------------------------------------------------------------.
4700 | yyerrlab1 -- common code for both syntax error and YYERROR. |
4701 `-------------------------------------------------------------*/
4703 yyerrstatus
= 3; /* Each real token shifted decrements this. */
4707 yyn
= yypact
[yystate
];
4708 if (yyn
!= YYPACT_NINF
)
4711 if (0 <= yyn
&& yyn
<= YYLAST
&& yycheck
[yyn
] == YYTERROR
)
4719 /* Pop the current state because it cannot handle the error token. */
4723 yyerror_range
[0] = *yylsp
;
4724 yydestruct ("Error: popping",
4725 yystos
[yystate
], yyvsp
, yylsp
, state
);
4728 YY_STACK_PRINT (yyss
, yyssp
);
4733 yyerror_range
[1] = yylloc
;
4734 /* Using YYLLOC is tempting, but would change the location of
4735 the lookahead. YYLOC is available though. */
4736 YYLLOC_DEFAULT (yyloc
, (yyerror_range
- 1), 2);
4739 /* Shift the error token. */
4740 YY_SYMBOL_PRINT ("Shifting", yystos
[yyn
], yyvsp
, yylsp
);
4746 /*-------------------------------------.
4747 | yyacceptlab -- YYACCEPT comes here. |
4748 `-------------------------------------*/
4753 /*-----------------------------------.
4754 | yyabortlab -- YYABORT comes here. |
4755 `-----------------------------------*/
4760 #if !defined(yyoverflow) || YYERROR_VERBOSE
4761 /*-------------------------------------------------.
4762 | yyexhaustedlab -- memory exhaustion comes here. |
4763 `-------------------------------------------------*/
4765 yyerror (&yylloc
, state
, YY_("memory exhausted"));
4771 if (yychar
!= YYEMPTY
)
4772 yydestruct ("Cleanup: discarding lookahead",
4773 yytoken
, &yylval
, &yylloc
, state
);
4774 /* Do not reclaim the symbols of the rule which action triggered
4775 this YYABORT or YYACCEPT. */
4777 YY_STACK_PRINT (yyss
, yyssp
);
4778 while (yyssp
!= yyss
)
4780 yydestruct ("Cleanup: popping",
4781 yystos
[*yyssp
], yyvsp
, yylsp
, state
);
4786 YYSTACK_FREE (yyss
);
4789 if (yymsg
!= yymsgbuf
)
4790 YYSTACK_FREE (yymsg
);
4792 /* Make sure YYID is used. */
4793 return YYID (yyresult
);
4798 /* Line 1675 of yacc.c */
4799 #line 1931 "program_parse.y"
4802 struct asm_instruction
*
4803 asm_instruction_ctor(gl_inst_opcode op
,
4804 const struct prog_dst_register
*dst
,
4805 const struct asm_src_register
*src0
,
4806 const struct asm_src_register
*src1
,
4807 const struct asm_src_register
*src2
)
4809 struct asm_instruction
*inst
= calloc(1, sizeof(struct asm_instruction
));
4812 _mesa_init_instructions(& inst
->Base
, 1);
4813 inst
->Base
.Opcode
= op
;
4815 /* In the core ARB extensions only the KIL instruction doesn't have a
4816 * destination register.
4819 init_dst_reg(& inst
->Base
.DstReg
);
4821 inst
->Base
.DstReg
= *dst
;
4824 inst
->Base
.SrcReg
[0] = src0
->Base
;
4825 inst
->SrcReg
[0] = *src0
;
4828 inst
->Base
.SrcReg
[1] = src1
->Base
;
4829 inst
->SrcReg
[1] = *src1
;
4831 init_src_reg(& inst
->SrcReg
[1]);
4835 inst
->Base
.SrcReg
[2] = src2
->Base
;
4836 inst
->SrcReg
[2] = *src2
;
4838 init_src_reg(& inst
->SrcReg
[2]);
4847 init_dst_reg(struct prog_dst_register
*r
)
4849 memset(r
, 0, sizeof(*r
));
4850 r
->File
= PROGRAM_UNDEFINED
;
4851 r
->WriteMask
= WRITEMASK_XYZW
;
4852 r
->CondMask
= COND_TR
;
4853 r
->CondSwizzle
= SWIZZLE_NOOP
;
4858 init_src_reg(struct asm_src_register
*r
)
4860 memset(r
, 0, sizeof(*r
));
4861 r
->Base
.File
= PROGRAM_UNDEFINED
;
4862 r
->Base
.Swizzle
= SWIZZLE_NOOP
;
4868 * Validate the set of inputs used by a program
4870 * Validates that legal sets of inputs are used by the program. In this case
4871 * "used" included both reading the input or binding the input to a name using
4872 * the \c ATTRIB command.
4875 * \c TRUE if the combination of inputs used is valid, \c FALSE otherwise.
4878 validate_inputs(struct YYLTYPE
*locp
, struct asm_parser_state
*state
)
4880 const int inputs
= state
->prog
->InputsRead
| state
->InputsBound
;
4882 if (((inputs
& 0x0ffff) & (inputs
>> 16)) != 0) {
4883 yyerror(locp
, state
, "illegal use of generic attribute and name attribute");
4892 declare_variable(struct asm_parser_state
*state
, char *name
, enum asm_type t
,
4893 struct YYLTYPE
*locp
)
4895 struct asm_symbol
*s
= NULL
;
4896 struct asm_symbol
*exist
= (struct asm_symbol
*)
4897 _mesa_symbol_table_find_symbol(state
->st
, 0, name
);
4900 if (exist
!= NULL
) {
4901 yyerror(locp
, state
, "redeclared identifier");
4903 s
= calloc(1, sizeof(struct asm_symbol
));
4909 if (state
->prog
->NumTemporaries
>= state
->limits
->MaxTemps
) {
4910 yyerror(locp
, state
, "too many temporaries declared");
4915 s
->temp_binding
= state
->prog
->NumTemporaries
;
4916 state
->prog
->NumTemporaries
++;
4920 if (state
->prog
->NumAddressRegs
>= state
->limits
->MaxAddressRegs
) {
4921 yyerror(locp
, state
, "too many address registers declared");
4926 /* FINISHME: Add support for multiple address registers.
4928 state
->prog
->NumAddressRegs
++;
4935 _mesa_symbol_table_add_symbol(state
->st
, 0, s
->name
, s
);
4936 s
->next
= state
->sym
;
4944 int add_state_reference(struct gl_program_parameter_list
*param_list
,
4945 const gl_state_index tokens
[STATE_LENGTH
])
4947 const GLuint size
= 4; /* XXX fix */
4951 name
= _mesa_program_state_string(tokens
);
4952 index
= _mesa_add_parameter(param_list
, PROGRAM_STATE_VAR
, name
,
4953 size
, GL_NONE
, NULL
, tokens
, 0x0);
4954 param_list
->StateFlags
|= _mesa_program_state_flags(tokens
);
4956 /* free name string here since we duplicated it in add_parameter() */
4964 initialize_symbol_from_state(struct gl_program
*prog
,
4965 struct asm_symbol
*param_var
,
4966 const gl_state_index tokens
[STATE_LENGTH
])
4969 gl_state_index state_tokens
[STATE_LENGTH
];
4972 memcpy(state_tokens
, tokens
, sizeof(state_tokens
));
4974 param_var
->type
= at_param
;
4975 param_var
->param_binding_type
= PROGRAM_STATE_VAR
;
4977 /* If we are adding a STATE_MATRIX that has multiple rows, we need to
4978 * unroll it and call add_state_reference() for each row
4980 if ((state_tokens
[0] == STATE_MODELVIEW_MATRIX
||
4981 state_tokens
[0] == STATE_PROJECTION_MATRIX
||
4982 state_tokens
[0] == STATE_MVP_MATRIX
||
4983 state_tokens
[0] == STATE_TEXTURE_MATRIX
||
4984 state_tokens
[0] == STATE_PROGRAM_MATRIX
)
4985 && (state_tokens
[2] != state_tokens
[3])) {
4987 const int first_row
= state_tokens
[2];
4988 const int last_row
= state_tokens
[3];
4990 for (row
= first_row
; row
<= last_row
; row
++) {
4991 state_tokens
[2] = state_tokens
[3] = row
;
4993 idx
= add_state_reference(prog
->Parameters
, state_tokens
);
4994 if (param_var
->param_binding_begin
== ~0U)
4995 param_var
->param_binding_begin
= idx
;
4996 param_var
->param_binding_length
++;
5000 idx
= add_state_reference(prog
->Parameters
, state_tokens
);
5001 if (param_var
->param_binding_begin
== ~0U)
5002 param_var
->param_binding_begin
= idx
;
5003 param_var
->param_binding_length
++;
5011 initialize_symbol_from_param(struct gl_program
*prog
,
5012 struct asm_symbol
*param_var
,
5013 const gl_state_index tokens
[STATE_LENGTH
])
5016 gl_state_index state_tokens
[STATE_LENGTH
];
5019 memcpy(state_tokens
, tokens
, sizeof(state_tokens
));
5021 assert((state_tokens
[0] == STATE_VERTEX_PROGRAM
)
5022 || (state_tokens
[0] == STATE_FRAGMENT_PROGRAM
));
5023 assert((state_tokens
[1] == STATE_ENV
)
5024 || (state_tokens
[1] == STATE_LOCAL
));
5026 param_var
->type
= at_param
;
5027 param_var
->param_binding_type
= (state_tokens
[1] == STATE_ENV
)
5028 ? PROGRAM_ENV_PARAM
: PROGRAM_LOCAL_PARAM
;
5030 /* If we are adding a STATE_ENV or STATE_LOCAL that has multiple elements,
5031 * we need to unroll it and call add_state_reference() for each row
5033 if (state_tokens
[2] != state_tokens
[3]) {
5035 const int first_row
= state_tokens
[2];
5036 const int last_row
= state_tokens
[3];
5038 for (row
= first_row
; row
<= last_row
; row
++) {
5039 state_tokens
[2] = state_tokens
[3] = row
;
5041 idx
= add_state_reference(prog
->Parameters
, state_tokens
);
5042 if (param_var
->param_binding_begin
== ~0U)
5043 param_var
->param_binding_begin
= idx
;
5044 param_var
->param_binding_length
++;
5048 idx
= add_state_reference(prog
->Parameters
, state_tokens
);
5049 if (param_var
->param_binding_begin
== ~0U)
5050 param_var
->param_binding_begin
= idx
;
5051 param_var
->param_binding_length
++;
5059 initialize_symbol_from_const(struct gl_program
*prog
,
5060 struct asm_symbol
*param_var
,
5061 const struct asm_vector
*vec
)
5063 const int idx
= _mesa_add_parameter(prog
->Parameters
, PROGRAM_CONSTANT
,
5064 NULL
, vec
->count
, GL_NONE
, vec
->data
,
5067 param_var
->type
= at_param
;
5068 param_var
->param_binding_type
= PROGRAM_CONSTANT
;
5070 if (param_var
->param_binding_begin
== ~0U)
5071 param_var
->param_binding_begin
= idx
;
5072 param_var
->param_binding_length
++;
5079 make_error_string(const char *fmt
, ...)
5085 va_start(args
, fmt
);
5087 /* Call vsnprintf once to determine how large the final string is. Call it
5088 * again to do the actual formatting. from the vsnprintf manual page:
5090 * Upon successful return, these functions return the number of
5091 * characters printed (not including the trailing '\0' used to end
5092 * output to strings).
5094 length
= 1 + vsnprintf(NULL
, 0, fmt
, args
);
5096 str
= _mesa_malloc(length
);
5098 vsnprintf(str
, length
, fmt
, args
);
5108 yyerror(YYLTYPE
*locp
, struct asm_parser_state
*state
, const char *s
)
5113 err_str
= make_error_string("glProgramStringARB(%s)\n", s
);
5115 _mesa_error(state
->ctx
, GL_INVALID_OPERATION
, err_str
);
5116 _mesa_free(err_str
);
5119 err_str
= make_error_string("line %u, char %u: error: %s\n",
5120 locp
->first_line
, locp
->first_column
, s
);
5121 _mesa_set_program_error(state
->ctx
, locp
->position
, err_str
);
5124 _mesa_free(err_str
);
5130 _mesa_parse_arb_program(GLcontext
*ctx
, GLenum target
, const GLubyte
*str
,
5131 GLsizei len
, struct asm_parser_state
*state
)
5133 struct asm_instruction
*inst
;
5136 GLboolean result
= GL_FALSE
;
5138 struct asm_symbol
*sym
;
5141 state
->prog
->Target
= target
;
5142 state
->prog
->Parameters
= _mesa_new_parameter_list();
5144 /* Make a copy of the program string and force it to be NUL-terminated.
5146 strz
= (GLubyte
*) _mesa_malloc(len
+ 1);
5148 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glProgramStringARB");
5151 _mesa_memcpy (strz
, str
, len
);
5154 state
->prog
->String
= strz
;
5156 state
->st
= _mesa_symbol_table_ctor();
5158 state
->limits
= (target
== GL_VERTEX_PROGRAM_ARB
)
5159 ? & ctx
->Const
.VertexProgram
5160 : & ctx
->Const
.FragmentProgram
;
5162 state
->MaxTextureImageUnits
= ctx
->Const
.MaxTextureImageUnits
;
5163 state
->MaxTextureCoordUnits
= ctx
->Const
.MaxTextureCoordUnits
;
5164 state
->MaxTextureUnits
= ctx
->Const
.MaxTextureUnits
;
5165 state
->MaxClipPlanes
= ctx
->Const
.MaxClipPlanes
;
5166 state
->MaxLights
= ctx
->Const
.MaxLights
;
5167 state
->MaxProgramMatrices
= ctx
->Const
.MaxProgramMatrices
;
5169 state
->state_param_enum
= (target
== GL_VERTEX_PROGRAM_ARB
)
5170 ? STATE_VERTEX_PROGRAM
: STATE_FRAGMENT_PROGRAM
;
5172 _mesa_set_program_error(ctx
, -1, NULL
);
5174 _mesa_program_lexer_ctor(& state
->scanner
, state
, (const char *) str
, len
);
5176 _mesa_program_lexer_dtor(state
->scanner
);
5179 if (ctx
->Program
.ErrorPos
!= -1) {
5183 if (! _mesa_layout_parameters(state
)) {
5187 loc
.first_column
= 0;
5190 yyerror(& loc
, state
, "invalid PARAM usage");
5196 /* Add one instruction to store the "END" instruction.
5198 state
->prog
->Instructions
=
5199 _mesa_alloc_instructions(state
->prog
->NumInstructions
+ 1);
5200 inst
= state
->inst_head
;
5201 for (i
= 0; i
< state
->prog
->NumInstructions
; i
++) {
5202 struct asm_instruction
*const temp
= inst
->next
;
5204 state
->prog
->Instructions
[i
] = inst
->Base
;
5208 /* Finally, tag on an OPCODE_END instruction */
5210 const GLuint numInst
= state
->prog
->NumInstructions
;
5211 _mesa_init_instructions(state
->prog
->Instructions
+ numInst
, 1);
5212 state
->prog
->Instructions
[numInst
].Opcode
= OPCODE_END
;
5214 state
->prog
->NumInstructions
++;
5216 state
->prog
->NumParameters
= state
->prog
->Parameters
->NumParameters
;
5217 state
->prog
->NumAttributes
= _mesa_bitcount(state
->prog
->InputsRead
);
5220 * Initialize native counts to logical counts. The device driver may
5221 * change them if program is translated into a hardware program.
5223 state
->prog
->NumNativeInstructions
= state
->prog
->NumInstructions
;
5224 state
->prog
->NumNativeTemporaries
= state
->prog
->NumTemporaries
;
5225 state
->prog
->NumNativeParameters
= state
->prog
->NumParameters
;
5226 state
->prog
->NumNativeAttributes
= state
->prog
->NumAttributes
;
5227 state
->prog
->NumNativeAddressRegs
= state
->prog
->NumAddressRegs
;
5232 for (inst
= state
->inst_head
; inst
!= NULL
; inst
= temp
) {
5237 state
->inst_head
= NULL
;
5238 state
->inst_tail
= NULL
;
5240 for (sym
= state
->sym
; sym
!= NULL
; sym
= temp
) {
5243 _mesa_free((void *) sym
->name
);
5248 _mesa_symbol_table_dtor(state
->st
);