diff options
-rw-r--r-- | src/mesa/drivers/x11/xm_span.c | 8 | ||||
-rw-r--r-- | src/mesa/main/histogram.c | 2 | ||||
-rw-r--r-- | src/mesa/shader/arbprogparse.c | 6 | ||||
-rw-r--r-- | src/mesa/shader/lex.yy.c | 391 | ||||
-rw-r--r-- | src/mesa/shader/program_lexer.l | 41 | ||||
-rw-r--r-- | src/mesa/shader/program_parse.tab.c | 565 | ||||
-rw-r--r-- | src/mesa/shader/program_parse.y | 49 | ||||
-rw-r--r-- | src/mesa/shader/program_parser.h | 16 |
8 files changed, 508 insertions, 570 deletions
diff --git a/src/mesa/drivers/x11/xm_span.c b/src/mesa/drivers/x11/xm_span.c index 309cefcb8e8..c39d87c4516 100644 --- a/src/mesa/drivers/x11/xm_span.c +++ b/src/mesa/drivers/x11/xm_span.c @@ -3773,7 +3773,7 @@ static void put_values_ci_ximage( PUT_VALUES_ARGS ) * else return number of pixels to skip in the destination array. */ static int -clip_for_xgetimage(GLcontext *ctx, GLuint *n, GLint *x, GLint *y) +clip_for_xgetimage(GLcontext *ctx, XMesaPixmap pixmap, GLuint *n, GLint *x, GLint *y) { XMesaContext xmesa = XMESA_CONTEXT(ctx); XMesaBuffer source = XMESA_BUFFER(ctx->DrawBuffer); @@ -3783,7 +3783,7 @@ clip_for_xgetimage(GLcontext *ctx, GLuint *n, GLint *x, GLint *y) GLint dx, dy; if (source->type == PBUFFER || source->type == PIXMAP) return 0; - XTranslateCoordinates(xmesa->display, source->frontxrb->pixmap, rootWin, + XTranslateCoordinates(xmesa->display, pixmap, rootWin, *x, *y, &dx, &dy, &child); if (dx >= screenWidth) { /* totally clipped on right */ @@ -3827,7 +3827,7 @@ get_row_ci(GLcontext *ctx, struct gl_renderbuffer *rb, #ifndef XFree86Server XMesaImage *span = NULL; int error; - int k = clip_for_xgetimage(ctx, &n, &x, &y); + int k = clip_for_xgetimage(ctx, xrb->pixmap, &n, &x, &y); if (k < 0) return; index += k; @@ -3892,7 +3892,7 @@ get_row_rgba(GLcontext *ctx, struct gl_renderbuffer *rb, #else int k; y = YFLIP(xrb, y); - k = clip_for_xgetimage(ctx, &n, &x, &y); + k = clip_for_xgetimage(ctx, xrb->pixmap, &n, &x, &y); if (k < 0) return; rgba += k; diff --git a/src/mesa/main/histogram.c b/src/mesa/main/histogram.c index dfbe910a064..c7304e8dd75 100644 --- a/src/mesa/main/histogram.c +++ b/src/mesa/main/histogram.c @@ -190,7 +190,7 @@ pack_histogram( GLcontext *ctx, /* temporarily store as GLuints */ GLuint temp[4*HISTOGRAM_TABLE_SIZE]; GLuint *dst = temp; - GLhalfARB *half = destination; + GLhalfARB *half = (GLhalfARB *) destination; GLuint i; /* get GLuint values */ PACK_MACRO(GLuint); diff --git a/src/mesa/shader/arbprogparse.c b/src/mesa/shader/arbprogparse.c index 05ee4f563eb..dd732b6666b 100644 --- a/src/mesa/shader/arbprogparse.c +++ b/src/mesa/shader/arbprogparse.c @@ -87,6 +87,9 @@ _mesa_parse_arb_fragment_program(GLcontext* ctx, GLenum target, return; } + if (program->Base.String != NULL) + _mesa_free(program->Base.String); + /* Copy the relevant contents of the arb_program struct into the * fragment_program struct. */ @@ -178,6 +181,9 @@ _mesa_parse_arb_vertex_program(GLcontext *ctx, GLenum target, return; } + if (program->Base.String != NULL) + _mesa_free(program->Base.String); + /* Copy the relevant contents of the arb_program struct into the * vertex_program struct. */ diff --git a/src/mesa/shader/lex.yy.c b/src/mesa/shader/lex.yy.c index fc78b30fb49..68543ae2e12 100644 --- a/src/mesa/shader/lex.yy.c +++ b/src/mesa/shader/lex.yy.c @@ -1097,45 +1097,6 @@ static yyconst flex_int16_t yy_chk[1368] = #define SWIZZLE_INVAL MAKE_SWIZZLE4(SWIZZLE_NIL, SWIZZLE_NIL, \ SWIZZLE_NIL, SWIZZLE_NIL) -/** - * Send a string to the parser using asm_parser_state::string_dumpster - * - * Sends a string to the parser using asm_parser_state::string_dumpster as a - * temporary storage buffer. Data previously stored in - * asm_parser_state::string_dumpster will be lost. If - * asm_parser_state::string_dumpster is not large enough to hold the new - * string, the buffer size will be increased. The buffer size is \b never - * decreased. - * - * \param state Assembler parser state tracking - * \param str String to be passed to the parser - * - * \return - * A pointer to asm_parser_state::string_dumpster on success or \c NULL on - * failure. Currently the only failure case is \c ENOMEM. - */ -static char * -return_string(struct asm_parser_state *state, const char *str) -{ - const size_t len = strlen(str); - - if (len >= state->dumpster_size) { - char *const dumpster = _mesa_realloc(state->string_dumpster, - state->dumpster_size, - len + 1); - if (dumpster == NULL) { - return NULL; - } - - state->string_dumpster = dumpster; - state->dumpster_size = len + 1; - } - - memcpy(state->string_dumpster, str, len + 1); - return state->string_dumpster; -} - - static unsigned mask_from_char(char c) { @@ -1181,7 +1142,7 @@ swiz_from_char(char c) static int handle_ident(struct asm_parser_state *state, const char *text, YYSTYPE *lval) { - lval->string = return_string(state, text); + lval->string = strdup(text); return (_mesa_symbol_table_find_symbol(state->st, 0, text) == NULL) ? IDENTIFIER : USED_IDENTIFIER; @@ -1200,7 +1161,7 @@ handle_ident(struct asm_parser_state *state, const char *text, YYSTYPE *lval) } while(0); #define YY_EXTRA_TYPE struct asm_parser_state * -#line 1204 "lex.yy.c" +#line 1165 "lex.yy.c" #define INITIAL 0 @@ -1446,10 +1407,10 @@ YY_DECL register int yy_act; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; -#line 196 "program_lexer.l" +#line 157 "program_lexer.l" -#line 1453 "lex.yy.c" +#line 1414 "lex.yy.c" yylval = yylval_param; @@ -1538,17 +1499,17 @@ do_action: /* This label is used only to access EOF actions. */ case 1: YY_RULE_SETUP -#line 198 "program_lexer.l" +#line 159 "program_lexer.l" { return ARBvp_10; } YY_BREAK case 2: YY_RULE_SETUP -#line 199 "program_lexer.l" +#line 160 "program_lexer.l" { return ARBfp_10; } YY_BREAK case 3: YY_RULE_SETUP -#line 200 "program_lexer.l" +#line 161 "program_lexer.l" { yylval->integer = at_address; return_token_or_IDENTIFIER(require_ARB_vp, ADDRESS); @@ -1556,692 +1517,692 @@ YY_RULE_SETUP YY_BREAK case 4: YY_RULE_SETUP -#line 204 "program_lexer.l" +#line 165 "program_lexer.l" { return ALIAS; } YY_BREAK case 5: YY_RULE_SETUP -#line 205 "program_lexer.l" +#line 166 "program_lexer.l" { return ATTRIB; } YY_BREAK case 6: YY_RULE_SETUP -#line 206 "program_lexer.l" +#line 167 "program_lexer.l" { return END; } YY_BREAK case 7: YY_RULE_SETUP -#line 207 "program_lexer.l" +#line 168 "program_lexer.l" { return OPTION; } YY_BREAK case 8: YY_RULE_SETUP -#line 208 "program_lexer.l" +#line 169 "program_lexer.l" { return OUTPUT; } YY_BREAK case 9: YY_RULE_SETUP -#line 209 "program_lexer.l" +#line 170 "program_lexer.l" { return PARAM; } YY_BREAK case 10: YY_RULE_SETUP -#line 210 "program_lexer.l" +#line 171 "program_lexer.l" { yylval->integer = at_temp; return TEMP; } YY_BREAK case 11: YY_RULE_SETUP -#line 212 "program_lexer.l" +#line 173 "program_lexer.l" { return_opcode( 1, VECTOR_OP, ABS, 3); } YY_BREAK case 12: YY_RULE_SETUP -#line 213 "program_lexer.l" +#line 174 "program_lexer.l" { return_opcode( 1, BIN_OP, ADD, 3); } YY_BREAK case 13: YY_RULE_SETUP -#line 214 "program_lexer.l" +#line 175 "program_lexer.l" { return_opcode(require_ARB_vp, ARL, ARL, 3); } YY_BREAK case 14: YY_RULE_SETUP -#line 216 "program_lexer.l" +#line 177 "program_lexer.l" { return_opcode(require_ARB_fp, TRI_OP, CMP, 3); } YY_BREAK case 15: YY_RULE_SETUP -#line 217 "program_lexer.l" +#line 178 "program_lexer.l" { return_opcode(require_ARB_fp, SCALAR_OP, COS, 3); } YY_BREAK case 16: YY_RULE_SETUP -#line 219 "program_lexer.l" +#line 180 "program_lexer.l" { return_opcode(require_NV_fp, VECTOR_OP, DDX, 3); } YY_BREAK case 17: YY_RULE_SETUP -#line 220 "program_lexer.l" +#line 181 "program_lexer.l" { return_opcode(require_NV_fp, VECTOR_OP, DDY, 3); } YY_BREAK case 18: YY_RULE_SETUP -#line 221 "program_lexer.l" +#line 182 "program_lexer.l" { return_opcode( 1, BIN_OP, DP3, 3); } YY_BREAK case 19: YY_RULE_SETUP -#line 222 "program_lexer.l" +#line 183 "program_lexer.l" { return_opcode( 1, BIN_OP, DP4, 3); } YY_BREAK case 20: YY_RULE_SETUP -#line 223 "program_lexer.l" +#line 184 "program_lexer.l" { return_opcode( 1, BIN_OP, DPH, 3); } YY_BREAK case 21: YY_RULE_SETUP -#line 224 "program_lexer.l" +#line 185 "program_lexer.l" { return_opcode( 1, BIN_OP, DST, 3); } YY_BREAK case 22: YY_RULE_SETUP -#line 226 "program_lexer.l" +#line 187 "program_lexer.l" { return_opcode( 1, SCALAR_OP, EX2, 3); } YY_BREAK case 23: YY_RULE_SETUP -#line 227 "program_lexer.l" +#line 188 "program_lexer.l" { return_opcode(require_ARB_vp, SCALAR_OP, EXP, 3); } YY_BREAK case 24: YY_RULE_SETUP -#line 229 "program_lexer.l" +#line 190 "program_lexer.l" { return_opcode( 1, VECTOR_OP, FLR, 3); } YY_BREAK case 25: YY_RULE_SETUP -#line 230 "program_lexer.l" +#line 191 "program_lexer.l" { return_opcode( 1, VECTOR_OP, FRC, 3); } YY_BREAK case 26: YY_RULE_SETUP -#line 232 "program_lexer.l" +#line 193 "program_lexer.l" { return_opcode(require_ARB_fp, KIL, KIL, 3); } YY_BREAK case 27: YY_RULE_SETUP -#line 234 "program_lexer.l" +#line 195 "program_lexer.l" { return_opcode( 1, VECTOR_OP, LIT, 3); } YY_BREAK case 28: YY_RULE_SETUP -#line 235 "program_lexer.l" +#line 196 "program_lexer.l" { return_opcode( 1, SCALAR_OP, LG2, 3); } YY_BREAK case 29: YY_RULE_SETUP -#line 236 "program_lexer.l" +#line 197 "program_lexer.l" { return_opcode(require_ARB_vp, SCALAR_OP, LOG, 3); } YY_BREAK case 30: YY_RULE_SETUP -#line 237 "program_lexer.l" +#line 198 "program_lexer.l" { return_opcode(require_ARB_fp, TRI_OP, LRP, 3); } YY_BREAK case 31: YY_RULE_SETUP -#line 239 "program_lexer.l" +#line 200 "program_lexer.l" { return_opcode( 1, TRI_OP, MAD, 3); } YY_BREAK case 32: YY_RULE_SETUP -#line 240 "program_lexer.l" +#line 201 "program_lexer.l" { return_opcode( 1, BIN_OP, MAX, 3); } YY_BREAK case 33: YY_RULE_SETUP -#line 241 "program_lexer.l" +#line 202 "program_lexer.l" { return_opcode( 1, BIN_OP, MIN, 3); } YY_BREAK case 34: YY_RULE_SETUP -#line 242 "program_lexer.l" +#line 203 "program_lexer.l" { return_opcode( 1, VECTOR_OP, MOV, 3); } YY_BREAK case 35: YY_RULE_SETUP -#line 243 "program_lexer.l" +#line 204 "program_lexer.l" { return_opcode( 1, BIN_OP, MUL, 3); } YY_BREAK case 36: YY_RULE_SETUP -#line 245 "program_lexer.l" +#line 206 "program_lexer.l" { return_opcode(require_NV_fp, VECTOR_OP, PK2H, 4); } YY_BREAK case 37: YY_RULE_SETUP -#line 246 "program_lexer.l" +#line 207 "program_lexer.l" { return_opcode(require_NV_fp, VECTOR_OP, PK2US, 5); } YY_BREAK case 38: YY_RULE_SETUP -#line 247 "program_lexer.l" +#line 208 "program_lexer.l" { return_opcode(require_NV_fp, VECTOR_OP, PK4B, 4); } YY_BREAK case 39: YY_RULE_SETUP -#line 248 "program_lexer.l" +#line 209 "program_lexer.l" { return_opcode(require_NV_fp, VECTOR_OP, PK4UB, 5); } YY_BREAK case 40: YY_RULE_SETUP -#line 249 "program_lexer.l" +#line 210 "program_lexer.l" { return_opcode( 1, BINSC_OP, POW, 3); } YY_BREAK case 41: YY_RULE_SETUP -#line 251 "program_lexer.l" +#line 212 "program_lexer.l" { return_opcode( 1, SCALAR_OP, RCP, 3); } YY_BREAK case 42: YY_RULE_SETUP -#line 252 "program_lexer.l" +#line 213 "program_lexer.l" { return_opcode(require_NV_fp, BIN_OP, RFL, 3); } YY_BREAK case 43: YY_RULE_SETUP -#line 253 "program_lexer.l" +#line 214 "program_lexer.l" { return_opcode( 1, SCALAR_OP, RSQ, 3); } YY_BREAK case 44: YY_RULE_SETUP -#line 255 "program_lexer.l" +#line 216 "program_lexer.l" { return_opcode(require_ARB_fp, SCALAR_OP, SCS, 3); } YY_BREAK case 45: YY_RULE_SETUP -#line 256 "program_lexer.l" +#line 217 "program_lexer.l" { return_opcode(require_NV_fp, BIN_OP, SEQ, 3); } YY_BREAK case 46: YY_RULE_SETUP -#line 257 "program_lexer.l" +#line 218 "program_lexer.l" { return_opcode(require_NV_fp, BIN_OP, SFL, 3); } YY_BREAK case 47: YY_RULE_SETUP -#line 258 "program_lexer.l" +#line 219 "program_lexer.l" { return_opcode( 1, BIN_OP, SGE, 3); } YY_BREAK case 48: YY_RULE_SETUP -#line 259 "program_lexer.l" +#line 220 "program_lexer.l" { return_opcode(require_NV_fp, BIN_OP, SGT, 3); } YY_BREAK case 49: YY_RULE_SETUP -#line 260 "program_lexer.l" +#line 221 "program_lexer.l" { return_opcode(require_ARB_fp, SCALAR_OP, SIN, 3); } YY_BREAK case 50: YY_RULE_SETUP -#line 261 "program_lexer.l" +#line 222 "program_lexer.l" { return_opcode(require_NV_fp, BIN_OP, SLE, 3); } YY_BREAK case 51: YY_RULE_SETUP -#line 262 "program_lexer.l" +#line 223 "program_lexer.l" { return_opcode( 1, BIN_OP, SLT, 3); } YY_BREAK case 52: YY_RULE_SETUP -#line 263 "program_lexer.l" +#line 224 "program_lexer.l" { return_opcode(require_NV_fp, BIN_OP, SNE, 3); } YY_BREAK case 53: YY_RULE_SETUP -#line 264 "program_lexer.l" +#line 225 "program_lexer.l" { return_opcode(require_NV_fp, BIN_OP, STR, 3); } YY_BREAK case 54: YY_RULE_SETUP -#line 265 "program_lexer.l" +#line 226 "program_lexer.l" { return_opcode( 1, BIN_OP, SUB, 3); } YY_BREAK case 55: YY_RULE_SETUP -#line 266 "program_lexer.l" +#line 227 "program_lexer.l" { return_opcode( 1, SWZ, SWZ, 3); } YY_BREAK case 56: YY_RULE_SETUP -#line 268 "program_lexer.l" +#line 229 "program_lexer.l" { return_opcode(require_ARB_fp, SAMPLE_OP, TEX, 3); } YY_BREAK case 57: YY_RULE_SETUP -#line 269 "program_lexer.l" +#line 230 "program_lexer.l" { return_opcode(require_ARB_fp, SAMPLE_OP, TXB, 3); } YY_BREAK case 58: YY_RULE_SETUP -#line 270 "program_lexer.l" +#line 231 "program_lexer.l" { return_opcode(require_NV_fp, TXD_OP, TXD, 3); } YY_BREAK case 59: YY_RULE_SETUP -#line 271 "program_lexer.l" +#line 232 "program_lexer.l" { return_opcode(require_ARB_fp, SAMPLE_OP, TXP, 3); } YY_BREAK case 60: YY_RULE_SETUP -#line 273 "program_lexer.l" +#line 234 "program_lexer.l" { return_opcode(require_NV_fp, SCALAR_OP, UP2H, 4); } YY_BREAK case 61: YY_RULE_SETUP -#line 274 "program_lexer.l" +#line 235 "program_lexer.l" { return_opcode(require_NV_fp, SCALAR_OP, UP2US, 5); } YY_BREAK case 62: YY_RULE_SETUP -#line 275 "program_lexer.l" +#line 236 "program_lexer.l" { return_opcode(require_NV_fp, SCALAR_OP, UP4B, 4); } YY_BREAK case 63: YY_RULE_SETUP -#line 276 "program_lexer.l" +#line 237 "program_lexer.l" { return_opcode(require_NV_fp, SCALAR_OP, UP4UB, 5); } YY_BREAK case 64: YY_RULE_SETUP -#line 278 "program_lexer.l" +#line 239 "program_lexer.l" { return_opcode(require_NV_fp, TRI_OP, X2D, 3); } YY_BREAK case 65: YY_RULE_SETUP -#line 279 "program_lexer.l" +#line 240 "program_lexer.l" { return_opcode( 1, BIN_OP, XPD, 3); } YY_BREAK case 66: YY_RULE_SETUP -#line 281 "program_lexer.l" +#line 242 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_vp, VERTEX); } YY_BREAK case 67: YY_RULE_SETUP -#line 282 "program_lexer.l" +#line 243 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp, FRAGMENT); } YY_BREAK case 68: YY_RULE_SETUP -#line 283 "program_lexer.l" +#line 244 "program_lexer.l" { return PROGRAM; } YY_BREAK case 69: YY_RULE_SETUP -#line 284 "program_lexer.l" +#line 245 "program_lexer.l" { return STATE; } YY_BREAK case 70: YY_RULE_SETUP -#line 285 "program_lexer.l" +#line 246 "program_lexer.l" { return RESULT; } YY_BREAK case 71: YY_RULE_SETUP -#line 287 "program_lexer.l" +#line 248 "program_lexer.l" { return AMBIENT; } YY_BREAK case 72: YY_RULE_SETUP -#line 288 "program_lexer.l" +#line 249 "program_lexer.l" { return ATTENUATION; } YY_BREAK case 73: YY_RULE_SETUP -#line 289 "program_lexer.l" +#line 250 "program_lexer.l" { return BACK; } YY_BREAK case 74: YY_RULE_SETUP -#line 290 "program_lexer.l" +#line 251 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, CLIP); } YY_BREAK case 75: YY_RULE_SETUP -#line 291 "program_lexer.l" +#line 252 "program_lexer.l" { return COLOR; } YY_BREAK case 76: YY_RULE_SETUP -#line 292 "program_lexer.l" +#line 253 "program_lexer.l" { return_token_or_DOT(require_ARB_fp, DEPTH); } YY_BREAK case 77: YY_RULE_SETUP -#line 293 "program_lexer.l" +#line 254 "program_lexer.l" { return DIFFUSE; } YY_BREAK case 78: YY_RULE_SETUP -#line 294 "program_lexer.l" +#line 255 "program_lexer.l" { return DIRECTION; } YY_BREAK case 79: YY_RULE_SETUP -#line 295 "program_lexer.l" +#line 256 "program_lexer.l" { return EMISSION; } YY_BREAK case 80: YY_RULE_SETUP -#line 296 "program_lexer.l" +#line 257 "program_lexer.l" { return ENV; } YY_BREAK case 81: YY_RULE_SETUP -#line 297 "program_lexer.l" +#line 258 "program_lexer.l" { return EYE; } YY_BREAK case 82: YY_RULE_SETUP -#line 298 "program_lexer.l" +#line 259 "program_lexer.l" { return FOGCOORD; } YY_BREAK case 83: YY_RULE_SETUP -#line 299 "program_lexer.l" +#line 260 "program_lexer.l" { return FOG; } YY_BREAK case 84: YY_RULE_SETUP -#line 300 "program_lexer.l" +#line 261 "program_lexer.l" { return FRONT; } YY_BREAK case 85: YY_RULE_SETUP -#line 301 "program_lexer.l" +#line 262 "program_lexer.l" { return HALF; } YY_BREAK case 86: YY_RULE_SETUP -#line 302 "program_lexer.l" +#line 263 "program_lexer.l" { return INVERSE; } YY_BREAK case 87: YY_RULE_SETUP -#line 303 "program_lexer.l" +#line 264 "program_lexer.l" { return INVTRANS; } YY_BREAK case 88: YY_RULE_SETUP -#line 304 "program_lexer.l" +#line 265 "program_lexer.l" { return LIGHT; } YY_BREAK case 89: YY_RULE_SETUP -#line 305 "program_lexer.l" +#line 266 "program_lexer.l" { return LIGHTMODEL; } YY_BREAK case 90: YY_RULE_SETUP -#line 306 "program_lexer.l" +#line 267 "program_lexer.l" { return LIGHTPROD; } YY_BREAK case 91: YY_RULE_SETUP -#line 307 "program_lexer.l" +#line 268 "program_lexer.l" { return LOCAL; } YY_BREAK case 92: YY_RULE_SETUP -#line 308 "program_lexer.l" +#line 269 "program_lexer.l" { return MATERIAL; } YY_BREAK case 93: YY_RULE_SETUP -#line 309 "program_lexer.l" +#line 270 "program_lexer.l" { return MAT_PROGRAM; } YY_BREAK case 94: YY_RULE_SETUP -#line 310 "program_lexer.l" +#line 271 "program_lexer.l" { return MATRIX; } YY_BREAK case 95: YY_RULE_SETUP -#line 311 "program_lexer.l" +#line 272 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, MATRIXINDEX); } YY_BREAK case 96: YY_RULE_SETUP -#line 312 "program_lexer.l" +#line 273 "program_lexer.l" { return MODELVIEW; } YY_BREAK case 97: YY_RULE_SETUP -#line 313 "program_lexer.l" +#line 274 "program_lexer.l" { return MVP; } YY_BREAK case 98: YY_RULE_SETUP -#line 314 "program_lexer.l" +#line 275 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, NORMAL); } YY_BREAK case 99: YY_RULE_SETUP -#line 315 "program_lexer.l" +#line 276 "program_lexer.l" { return OBJECT; } YY_BREAK case 100: YY_RULE_SETUP -#line 316 "program_lexer.l" +#line 277 "program_lexer.l" { return PALETTE; } YY_BREAK case 101: YY_RULE_SETUP -#line 317 "program_lexer.l" +#line 278 "program_lexer.l" { return PARAMS; } YY_BREAK case 102: YY_RULE_SETUP -#line 318 "program_lexer.l" +#line 279 "program_lexer.l" { return PLANE; } YY_BREAK case 103: YY_RULE_SETUP -#line 319 "program_lexer.l" +#line 280 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, POINT_TOK); } YY_BREAK case 104: YY_RULE_SETUP -#line 320 "program_lexer.l" +#line 281 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, POINTSIZE); } YY_BREAK case 105: YY_RULE_SETUP -#line 321 "program_lexer.l" +#line 282 "program_lexer.l" { return POSITION; } YY_BREAK case 106: YY_RULE_SETUP -#line 322 "program_lexer.l" +#line 283 "program_lexer.l" { return PRIMARY; } YY_BREAK case 107: YY_RULE_SETUP -#line 323 "program_lexer.l" +#line 284 "program_lexer.l" { return PROJECTION; } YY_BREAK case 108: YY_RULE_SETUP -#line 324 "program_lexer.l" +#line 285 "program_lexer.l" { return_token_or_DOT(require_ARB_fp, RANGE); } YY_BREAK case 109: YY_RULE_SETUP -#line 325 "program_lexer.l" +#line 286 "program_lexer.l" { return ROW; } YY_BREAK case 110: YY_RULE_SETUP -#line 326 "program_lexer.l" +#line 287 "program_lexer.l" { return SCENECOLOR; } YY_BREAK case 111: YY_RULE_SETUP -#line 327 "program_lexer.l" +#line 288 "program_lexer.l" { return SECONDARY; } YY_BREAK case 112: YY_RULE_SETUP -#line 328 "program_lexer.l" +#line 289 "program_lexer.l" { return SHININESS; } YY_BREAK case 113: YY_RULE_SETUP -#line 329 "program_lexer.l" +#line 290 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, SIZE_TOK); } YY_BREAK case 114: YY_RULE_SETUP -#line 330 "program_lexer.l" +#line 291 "program_lexer.l" { return SPECULAR; } YY_BREAK case 115: YY_RULE_SETUP -#line 331 "program_lexer.l" +#line 292 "program_lexer.l" { return SPOT; } YY_BREAK case 116: YY_RULE_SETUP -#line 332 "program_lexer.l" +#line 293 "program_lexer.l" { return TEXCOORD; } YY_BREAK case 117: YY_RULE_SETUP -#line 333 "program_lexer.l" +#line 294 "program_lexer.l" { return_token_or_DOT(require_ARB_fp, TEXENV); } YY_BREAK case 118: YY_RULE_SETUP -#line 334 "program_lexer.l" +#line 295 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, TEXGEN); } YY_BREAK case 119: YY_RULE_SETUP -#line 335 "program_lexer.l" +#line 296 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, TEXGEN_Q); } YY_BREAK case 120: YY_RULE_SETUP -#line 336 "program_lexer.l" +#line 297 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, TEXGEN_S); } YY_BREAK case 121: YY_RULE_SETUP -#line 337 "program_lexer.l" +#line 298 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, TEXGEN_T); } YY_BREAK case 122: YY_RULE_SETUP -#line 338 "program_lexer.l" +#line 299 "program_lexer.l" { return TEXTURE; } YY_BREAK case 123: YY_RULE_SETUP -#line 339 "program_lexer.l" +#line 300 "program_lexer.l" { return TRANSPOSE; } YY_BREAK case 124: YY_RULE_SETUP -#line 340 "program_lexer.l" +#line 301 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, VTXATTRIB); } YY_BREAK case 125: YY_RULE_SETUP -#line 341 "program_lexer.l" +#line 302 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, WEIGHT); } YY_BREAK case 126: YY_RULE_SETUP -#line 343 "program_lexer.l" +#line 304 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp, TEXTURE_UNIT); } YY_BREAK case 127: YY_RULE_SETUP -#line 344 "program_lexer.l" +#line 305 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp, TEX_1D); } YY_BREAK case 128: YY_RULE_SETUP -#line 345 "program_lexer.l" +#line 306 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp, TEX_2D); } YY_BREAK case 129: YY_RULE_SETUP -#line 346 "program_lexer.l" +#line 307 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp, TEX_3D); } YY_BREAK case 130: YY_RULE_SETUP -#line 347 "program_lexer.l" +#line 308 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp, TEX_CUBE); } YY_BREAK case 131: YY_RULE_SETUP -#line 348 "program_lexer.l" +#line 309 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_rect, TEX_RECT); } YY_BREAK case 132: YY_RULE_SETUP -#line 349 "program_lexer.l" +#line 310 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_shadow, TEX_SHADOW1D); } YY_BREAK case 133: YY_RULE_SETUP -#line 350 "program_lexer.l" +#line 311 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_shadow, TEX_SHADOW2D); } YY_BREAK case 134: YY_RULE_SETUP -#line 351 "program_lexer.l" +#line 312 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_shadow && require_rect, TEX_SHADOWRECT); } YY_BREAK case 135: YY_RULE_SETUP -#line 352 "program_lexer.l" +#line 313 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_texarray, TEX_ARRAY1D); } YY_BREAK case 136: YY_RULE_SETUP -#line 353 "program_lexer.l" +#line 314 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_texarray, TEX_ARRAY2D); } YY_BREAK case 137: YY_RULE_SETUP -#line 354 "program_lexer.l" +#line 315 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_shadow && require_texarray, TEX_ARRAYSHADOW1D); } YY_BREAK case 138: YY_RULE_SETUP -#line 355 "program_lexer.l" +#line 316 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_shadow && require_texarray, TEX_ARRAYSHADOW2D); } YY_BREAK case 139: YY_RULE_SETUP -#line 357 "program_lexer.l" +#line 318 "program_lexer.l" { return handle_ident(yyextra, yytext, yylval); } YY_BREAK case 140: YY_RULE_SETUP -#line 359 "program_lexer.l" +#line 320 "program_lexer.l" { return DOT_DOT; } YY_BREAK case 141: YY_RULE_SETUP -#line 361 "program_lexer.l" +#line 322 "program_lexer.l" { yylval->integer = strtol(yytext, NULL, 10); return INTEGER; @@ -2249,7 +2210,7 @@ YY_RULE_SETUP YY_BREAK case 142: YY_RULE_SETUP -#line 365 "program_lexer.l" +#line 326 "program_lexer.l" { yylval->real = _mesa_strtod(yytext, NULL); return REAL; @@ -2261,7 +2222,7 @@ case 143: yyg->yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 369 "program_lexer.l" +#line 330 "program_lexer.l" { yylval->real = _mesa_strtod(yytext, NULL); return REAL; @@ -2269,7 +2230,7 @@ YY_RULE_SETUP YY_BREAK case 144: YY_RULE_SETUP -#line 373 "program_lexer.l" +#line 334 "program_lexer.l" { yylval->real = _mesa_strtod(yytext, NULL); return REAL; @@ -2277,7 +2238,7 @@ YY_RULE_SETUP YY_BREAK case 145: YY_RULE_SETUP -#line 377 "program_lexer.l" +#line 338 "program_lexer.l" { yylval->real = _mesa_strtod(yytext, NULL); return REAL; @@ -2285,7 +2246,7 @@ YY_RULE_SETUP YY_BREAK case 146: YY_RULE_SETUP -#line 382 "program_lexer.l" +#line 343 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_NOOP; yylval->swiz_mask.mask = WRITEMASK_XYZW; @@ -2294,7 +2255,7 @@ YY_RULE_SETUP YY_BREAK case 147: YY_RULE_SETUP -#line 388 "program_lexer.l" +#line 349 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_XY @@ -2304,7 +2265,7 @@ YY_RULE_SETUP YY_BREAK case 148: YY_RULE_SETUP -#line 394 "program_lexer.l" +#line 355 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_XZW; @@ -2313,7 +2274,7 @@ YY_RULE_SETUP YY_BREAK case 149: YY_RULE_SETUP -#line 399 "program_lexer.l" +#line 360 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_YZW; @@ -2322,7 +2283,7 @@ YY_RULE_SETUP YY_BREAK case 150: YY_RULE_SETUP -#line 405 "program_lexer.l" +#line 366 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_X @@ -2332,7 +2293,7 @@ YY_RULE_SETUP YY_BREAK case 151: YY_RULE_SETUP -#line 411 "program_lexer.l" +#line 372 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_Y @@ -2342,7 +2303,7 @@ YY_RULE_SETUP YY_BREAK case 152: YY_RULE_SETUP -#line 417 "program_lexer.l" +#line 378 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_ZW; @@ -2351,7 +2312,7 @@ YY_RULE_SETUP YY_BREAK case 153: YY_RULE_SETUP -#line 423 "program_lexer.l" +#line 384 "program_lexer.l" { const unsigned s = swiz_from_char(yytext[1]); yylval->swiz_mask.swizzle = MAKE_SWIZZLE4(s, s, s, s); @@ -2361,7 +2322,7 @@ YY_RULE_SETUP YY_BREAK case 154: YY_RULE_SETUP -#line 430 "program_lexer.l" +#line 391 "program_lexer.l" { yylval->swiz_mask.swizzle = MAKE_SWIZZLE4(swiz_from_char(yytext[1]), swiz_from_char(yytext[2]), @@ -2373,7 +2334,7 @@ YY_RULE_SETUP YY_BREAK case 155: YY_RULE_SETUP -#line 439 "program_lexer.l" +#line 400 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_NOOP; yylval->swiz_mask.mask = WRITEMASK_XYZW; @@ -2382,7 +2343,7 @@ YY_RULE_SETUP YY_BREAK case 156: YY_RULE_SETUP -#line 445 "program_lexer.l" +#line 406 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_XY @@ -2392,7 +2353,7 @@ YY_RULE_SETUP YY_BREAK case 157: YY_RULE_SETUP -#line 451 "program_lexer.l" +#line 412 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_XZW; @@ -2401,7 +2362,7 @@ YY_RULE_SETUP YY_BREAK case 158: YY_RULE_SETUP -#line 456 "program_lexer.l" +#line 417 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_YZW; @@ -2410,7 +2371,7 @@ YY_RULE_SETUP YY_BREAK case 159: YY_RULE_SETUP -#line 462 "program_lexer.l" +#line 423 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_X @@ -2420,7 +2381,7 @@ YY_RULE_SETUP YY_BREAK case 160: YY_RULE_SETUP -#line 468 "program_lexer.l" +#line 429 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_Y @@ -2430,7 +2391,7 @@ YY_RULE_SETUP YY_BREAK case 161: YY_RULE_SETUP -#line 474 "program_lexer.l" +#line 435 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_ZW; @@ -2439,7 +2400,7 @@ YY_RULE_SETUP YY_BREAK case 162: YY_RULE_SETUP -#line 480 "program_lexer.l" +#line 441 "program_lexer.l" { const unsigned s = swiz_from_char(yytext[1]); yylval->swiz_mask.swizzle = MAKE_SWIZZLE4(s, s, s, s); @@ -2449,7 +2410,7 @@ YY_RULE_SETUP YY_BREAK case 163: YY_RULE_SETUP -#line 488 "program_lexer.l" +#line 449 "program_lexer.l" { if (require_ARB_vp) { return TEXGEN_R; @@ -2463,7 +2424,7 @@ YY_RULE_SETUP YY_BREAK case 164: YY_RULE_SETUP -#line 499 "program_lexer.l" +#line 460 "program_lexer.l" { yylval->swiz_mask.swizzle = MAKE_SWIZZLE4(swiz_from_char(yytext[1]), swiz_from_char(yytext[2]), @@ -2475,13 +2436,13 @@ YY_RULE_SETUP YY_BREAK case 165: YY_RULE_SETUP -#line 508 "program_lexer.l" +#line 469 "program_lexer.l" { return DOT; } YY_BREAK case 166: /* rule 166 can match eol */ YY_RULE_SETUP -#line 510 "program_lexer.l" +#line 471 "program_lexer.l" { yylloc->first_line++; yylloc->first_column = 1; @@ -2492,7 +2453,7 @@ YY_RULE_SETUP YY_BREAK case 167: YY_RULE_SETUP -#line 517 "program_lexer.l" +#line 478 "program_lexer.l" /* eat whitespace */ ; YY_BREAK case 168: @@ -2500,20 +2461,20 @@ case 168: yyg->yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 518 "program_lexer.l" +#line 479 "program_lexer.l" /* eat comments */ ; YY_BREAK case 169: YY_RULE_SETUP -#line 519 "program_lexer.l" +#line 480 "program_lexer.l" { return yytext[0]; } YY_BREAK case 170: YY_RULE_SETUP -#line 520 "program_lexer.l" +#line 481 "program_lexer.l" ECHO; YY_BREAK -#line 2517 "lex.yy.c" +#line 2478 "lex.yy.c" case YY_STATE_EOF(INITIAL): yyterminate(); @@ -3688,7 +3649,7 @@ void yyfree (void * ptr , yyscan_t yyscanner) #define YYTABLES_NAME "yytables" -#line 520 "program_lexer.l" +#line 481 "program_lexer.l" diff --git a/src/mesa/shader/program_lexer.l b/src/mesa/shader/program_lexer.l index e8dae7bc267..e2acb3c0c96 100644 --- a/src/mesa/shader/program_lexer.l +++ b/src/mesa/shader/program_lexer.l @@ -77,45 +77,6 @@ #define SWIZZLE_INVAL MAKE_SWIZZLE4(SWIZZLE_NIL, SWIZZLE_NIL, \ SWIZZLE_NIL, SWIZZLE_NIL) -/** - * Send a string to the parser using asm_parser_state::string_dumpster - * - * Sends a string to the parser using asm_parser_state::string_dumpster as a - * temporary storage buffer. Data previously stored in - * asm_parser_state::string_dumpster will be lost. If - * asm_parser_state::string_dumpster is not large enough to hold the new - * string, the buffer size will be increased. The buffer size is \b never - * decreased. - * - * \param state Assembler parser state tracking - * \param str String to be passed to the parser - * - * \return - * A pointer to asm_parser_state::string_dumpster on success or \c NULL on - * failure. Currently the only failure case is \c ENOMEM. - */ -static char * -return_string(struct asm_parser_state *state, const char *str) -{ - const size_t len = strlen(str); - - if (len >= state->dumpster_size) { - char *const dumpster = _mesa_realloc(state->string_dumpster, - state->dumpster_size, - len + 1); - if (dumpster == NULL) { - return NULL; - } - - state->string_dumpster = dumpster; - state->dumpster_size = len + 1; - } - - memcpy(state->string_dumpster, str, len + 1); - return state->string_dumpster; -} - - static unsigned mask_from_char(char c) { @@ -161,7 +122,7 @@ swiz_from_char(char c) static int handle_ident(struct asm_parser_state *state, const char *text, YYSTYPE *lval) { - lval->string = return_string(state, text); + lval->string = strdup(text); return (_mesa_symbol_table_find_symbol(state->st, 0, text) == NULL) ? IDENTIFIER : USED_IDENTIFIER; diff --git a/src/mesa/shader/program_parse.tab.c b/src/mesa/shader/program_parse.tab.c index e57c83ea65f..b9ef88b64bc 100644 --- a/src/mesa/shader/program_parse.tab.c +++ b/src/mesa/shader/program_parse.tab.c @@ -788,35 +788,35 @@ static const yytype_int16 yyrhs[] = /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 274, 274, 277, 285, 297, 298, 301, 323, 324, - 327, 342, 345, 350, 357, 358, 359, 360, 361, 362, - 363, 366, 367, 368, 371, 377, 383, 389, 396, 402, - 409, 453, 458, 468, 512, 518, 519, 520, 521, 522, - 523, 524, 525, 526, 527, 528, 529, 532, 544, 552, - 569, 576, 593, 604, 624, 649, 656, 689, 696, 711, - 761, 800, 809, 830, 839, 843, 870, 887, 887, 889, - 896, 908, 909, 910, 913, 927, 941, 959, 970, 982, - 984, 985, 986, 987, 990, 990, 990, 990, 991, 994, - 998, 1003, 1010, 1017, 1024, 1047, 1070, 1071, 1072, 1073, - 1074, 1075, 1078, 1096, 1100, 1106, 1110, 1114, 1118, 1127, - 1136, 1140, 1145, 1151, 1162, 1162, 1163, 1165, 1169, 1173, - 1177, 1183, 1183, 1185, 1201, 1224, 1227, 1238, 1244, 1250, - 1251, 1258, 1264, 1270, 1278, 1284, 1290, 1298, 1304, 1310, - 1318, 1319, 1322, 1323, 1324, 1325, 1326, 1327, 1328, 1329, - 1330, 1331, 1332, 1335, 1344, 1348, 1352, 1358, 1367, 1371, - 1375, 1384, 1388, 1394, 1400, 1407, 1412, 1420, 1430, 1432, - 1440, 1446, 1450, 1454, 1460, 1471, 1480, 1484, 1489, 1493, - 1497, 1501, 1507, 1514, 1518, 1524, 1532, 1543, 1550, 1554, - 1560, 1570, 1581, 1585, 1603, 1612, 1615, 1621, 1625, 1629, - 1635, 1646, 1651, 1656, 1661, 1666, 1671, 1679, 1682, 1687, - 1700, 1708, 1719, 1727, 1727, 1729, 1729, 1731, 1741, 1746, - 1753, 1763, 1772, 1777, 1784, 1794, 1804, 1816, 1816, 1817, - 1817, 1819, 1829, 1837, 1847, 1855, 1863, 1872, 1883, 1887, - 1893, 1894, 1895, 1898, 1898, 1901, 1936, 1940, 1940, 1943, - 1949, 1957, 1970, 1979, 1988, 1992, 2001, 2010, 2021, 2028, - 2033, 2042, 2054, 2057, 2066, 2077, 2078, 2079, 2082, 2083, - 2084, 2087, 2088, 2091, 2092, 2095, 2096, 2099, 2110, 2121, - 2132, 2154, 2155 + 0, 274, 274, 277, 285, 297, 298, 301, 325, 326, + 329, 344, 347, 352, 359, 360, 361, 362, 363, 364, + 365, 368, 369, 370, 373, 379, 385, 391, 398, 404, + 411, 455, 460, 470, 514, 520, 521, 522, 523, 524, + 525, 526, 527, 528, 529, 530, 531, 534, 546, 554, + 571, 578, 595, 606, 626, 651, 658, 691, 698, 713, + 768, 809, 818, 839, 848, 852, 881, 900, 900, 902, + 909, 921, 922, 923, 926, 940, 954, 974, 985, 997, + 999, 1000, 1001, 1002, 1005, 1005, 1005, 1005, 1006, 1009, + 1013, 1018, 1025, 1032, 1039, 1062, 1085, 1086, 1087, 1088, + 1089, 1090, 1093, 1112, 1116, 1122, 1126, 1130, 1134, 1143, + 1152, 1156, 1161, 1167, 1178, 1178, 1179, 1181, 1185, 1189, + 1193, 1199, 1199, 1201, 1218, 1243, 1246, 1257, 1263, 1269, + 1270, 1277, 1283, 1289, 1297, 1303, 1309, 1317, 1323, 1329, + 1337, 1338, 1341, 1342, 1343, 1344, 1345, 1346, 1347, 1348, + 1349, 1350, 1351, 1354, 1363, 1367, 1371, 1377, 1386, 1390, + 1394, 1403, 1407, 1413, 1419, 1426, 1431, 1439, 1449, 1451, + 1459, 1465, 1469, 1473, 1479, 1490, 1499, 1503, 1508, 1512, + 1516, 1520, 1526, 1533, 1537, 1543, 1551, 1562, 1569, 1573, + 1579, 1589, 1600, 1604, 1622, 1631, 1634, 1640, 1644, 1648, + 1654, 1665, 1670, 1675, 1680, 1685, 1690, 1698, 1701, 1706, + 1719, 1727, 1738, 1746, 1746, 1748, 1748, 1750, 1760, 1765, + 1772, 1782, 1791, 1796, 1803, 1813, 1823, 1835, 1835, 1836, + 1836, 1838, 1848, 1856, 1866, 1874, 1882, 1891, 1902, 1906, + 1912, 1913, 1914, 1917, 1917, 1920, 1955, 1959, 1959, 1962, + 1969, 1978, 1992, 2001, 2010, 2014, 2023, 2032, 2043, 2050, + 2055, 2064, 2076, 2079, 2088, 2099, 2100, 2101, 2104, 2105, + 2106, 2109, 2110, 2113, 2114, 2117, 2118, 2121, 2132, 2143, + 2154, 2180, 2181 }; #endif @@ -2164,6 +2164,8 @@ yyreduce: } + free((yyvsp[(2) - (3)].string)); + if (!valid) { const char *const err_str = (state->mode == ARB_vertex) ? "invalid ARB vertex program option" @@ -2178,7 +2180,7 @@ yyreduce: case 10: /* Line 1455 of yacc.c */ -#line 328 "program_parse.y" +#line 330 "program_parse.y" { if ((yyvsp[(1) - (2)].inst) != NULL) { if (state->inst_tail == NULL) { @@ -2198,7 +2200,7 @@ yyreduce: case 12: /* Line 1455 of yacc.c */ -#line 346 "program_parse.y" +#line 348 "program_parse.y" { (yyval.inst) = (yyvsp[(1) - (1)].inst); state->prog->NumAluInstructions++; @@ -2208,7 +2210,7 @@ yyreduce: case 13: /* Line 1455 of yacc.c */ -#line 351 "program_parse.y" +#line 353 "program_parse.y" { (yyval.inst) = (yyvsp[(1) - (1)].inst); state->prog->NumTexInstructions++; @@ -2218,7 +2220,7 @@ yyreduce: case 24: /* Line 1455 of yacc.c */ -#line 372 "program_parse.y" +#line 374 "program_parse.y" { (yyval.inst) = asm_instruction_ctor(OPCODE_ARL, & (yyvsp[(2) - (4)].dst_reg), & (yyvsp[(4) - (4)].src_reg), NULL, NULL); ;} @@ -2227,7 +2229,7 @@ yyreduce: case 25: /* Line 1455 of yacc.c */ -#line 378 "program_parse.y" +#line 380 "program_parse.y" { (yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (4)].temp_inst), & (yyvsp[(2) - (4)].dst_reg), & (yyvsp[(4) - (4)].src_reg), NULL, NULL); ;} @@ -2236,7 +2238,7 @@ yyreduce: case 26: /* Line 1455 of yacc.c */ -#line 384 "program_parse.y" +#line 386 "program_parse.y" { (yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (4)].temp_inst), & (yyvsp[(2) - (4)].dst_reg), & (yyvsp[(4) - (4)].src_reg), NULL, NULL); ;} @@ -2245,7 +2247,7 @@ yyreduce: case 27: /* Line 1455 of yacc.c */ -#line 390 "program_parse.y" +#line 392 "program_parse.y" { (yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (6)].temp_inst), & (yyvsp[(2) - (6)].dst_reg), & (yyvsp[(4) - (6)].src_reg), & (yyvsp[(6) - (6)].src_reg), NULL); ;} @@ -2254,7 +2256,7 @@ yyreduce: case 28: /* Line 1455 of yacc.c */ -#line 397 "program_parse.y" +#line 399 "program_parse.y" { (yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (6)].temp_inst), & (yyvsp[(2) - (6)].dst_reg), & (yyvsp[(4) - (6)].src_reg), & (yyvsp[(6) - (6)].src_reg), NULL); ;} @@ -2263,7 +2265,7 @@ yyreduce: case 29: /* Line 1455 of yacc.c */ -#line 404 "program_parse.y" +#line 406 "program_parse.y" { (yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (8)].temp_inst), & (yyvsp[(2) - (8)].dst_reg), & (yyvsp[(4) - (8)].src_reg), & (yyvsp[(6) - (8)].src_reg), & (yyvsp[(8) - (8)].src_reg)); ;} @@ -2272,7 +2274,7 @@ yyreduce: case 30: /* Line 1455 of yacc.c */ -#line 410 "program_parse.y" +#line 412 "program_parse.y" { (yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (8)].temp_inst), & (yyvsp[(2) - (8)].dst_reg), & (yyvsp[(4) - (8)].src_reg), NULL, NULL); if ((yyval.inst) != NULL) { @@ -2319,7 +2321,7 @@ yyreduce: case 31: /* Line 1455 of yacc.c */ -#line 454 "program_parse.y" +#line 456 "program_parse.y" { (yyval.inst) = asm_instruction_ctor(OPCODE_KIL, NULL, & (yyvsp[(2) - (2)].src_reg), NULL, NULL); state->fragment.UsesKill = 1; @@ -2329,7 +2331,7 @@ yyreduce: case 32: /* Line 1455 of yacc.c */ -#line 459 "program_parse.y" +#line 461 "program_parse.y" { (yyval.inst) = asm_instruction_ctor(OPCODE_KIL_NV, NULL, NULL, NULL, NULL); (yyval.inst)->Base.DstReg.CondMask = (yyvsp[(2) - (2)].dst_reg).CondMask; @@ -2342,7 +2344,7 @@ yyreduce: case 33: /* Line 1455 of yacc.c */ -#line 469 "program_parse.y" +#line 471 "program_parse.y" { (yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (12)].temp_inst), & (yyvsp[(2) - (12)].dst_reg), & (yyvsp[(4) - (12)].src_reg), & (yyvsp[(6) - (12)].src_reg), & (yyvsp[(8) - (12)].src_reg)); if ((yyval.inst) != NULL) { @@ -2389,7 +2391,7 @@ yyreduce: case 34: /* Line 1455 of yacc.c */ -#line 513 "program_parse.y" +#line 515 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (2)].integer); ;} @@ -2398,91 +2400,91 @@ yyreduce: case 35: /* Line 1455 of yacc.c */ -#line 518 "program_parse.y" +#line 520 "program_parse.y" { (yyval.integer) = TEXTURE_1D_INDEX; ;} break; case 36: /* Line 1455 of yacc.c */ -#line 519 "program_parse.y" +#line 521 "program_parse.y" { (yyval.integer) = TEXTURE_2D_INDEX; ;} break; case 37: /* Line 1455 of yacc.c */ -#line 520 "program_parse.y" +#line 522 "program_parse.y" { (yyval.integer) = TEXTURE_3D_INDEX; ;} break; case 38: /* Line 1455 of yacc.c */ -#line 521 "program_parse.y" +#line 523 "program_parse.y" { (yyval.integer) = TEXTURE_CUBE_INDEX; ;} break; case 39: /* Line 1455 of yacc.c */ -#line 522 "program_parse.y" +#line 524 "program_parse.y" { (yyval.integer) = TEXTURE_RECT_INDEX; ;} break; case 40: /* Line 1455 of yacc.c */ -#line 523 "program_parse.y" +#line 525 "program_parse.y" { (yyval.integer) = -TEXTURE_1D_INDEX; ;} break; case 41: /* Line 1455 of yacc.c */ -#line 524 "program_parse.y" +#line 526 "program_parse.y" { (yyval.integer) = -TEXTURE_2D_INDEX; ;} break; case 42: /* Line 1455 of yacc.c */ -#line 525 "program_parse.y" +#line 527 "program_parse.y" { (yyval.integer) = -TEXTURE_RECT_INDEX; ;} break; case 43: /* Line 1455 of yacc.c */ -#line 526 "program_parse.y" +#line 528 "program_parse.y" { (yyval.integer) = TEXTURE_1D_ARRAY_INDEX; ;} break; case 44: /* Line 1455 of yacc.c */ -#line 527 "program_parse.y" +#line 529 "program_parse.y" { (yyval.integer) = TEXTURE_2D_ARRAY_INDEX; ;} break; case 45: /* Line 1455 of yacc.c */ -#line 528 "program_parse.y" +#line 530 "program_parse.y" { (yyval.integer) = -TEXTURE_1D_ARRAY_INDEX; ;} break; case 46: /* Line 1455 of yacc.c */ -#line 529 "program_parse.y" +#line 531 "program_parse.y" { (yyval.integer) = -TEXTURE_2D_ARRAY_INDEX; ;} break; case 47: /* Line 1455 of yacc.c */ -#line 533 "program_parse.y" +#line 535 "program_parse.y" { /* FIXME: Is this correct? Should the extenedSwizzle be applied * FIXME: to the existing swizzle? @@ -2497,7 +2499,7 @@ yyreduce: case 48: /* Line 1455 of yacc.c */ -#line 545 "program_parse.y" +#line 547 "program_parse.y" { (yyval.src_reg) = (yyvsp[(2) - (2)].src_reg); @@ -2510,7 +2512,7 @@ yyreduce: case 49: /* Line 1455 of yacc.c */ -#line 553 "program_parse.y" +#line 555 "program_parse.y" { (yyval.src_reg) = (yyvsp[(3) - (4)].src_reg); @@ -2530,7 +2532,7 @@ yyreduce: case 50: /* Line 1455 of yacc.c */ -#line 570 "program_parse.y" +#line 572 "program_parse.y" { (yyval.src_reg) = (yyvsp[(1) - (2)].src_reg); @@ -2542,7 +2544,7 @@ yyreduce: case 51: /* Line 1455 of yacc.c */ -#line 577 "program_parse.y" +#line 579 "program_parse.y" { struct asm_symbol temp_sym; @@ -2562,7 +2564,7 @@ yyreduce: case 52: /* Line 1455 of yacc.c */ -#line 594 "program_parse.y" +#line 596 "program_parse.y" { (yyval.src_reg) = (yyvsp[(2) - (3)].src_reg); @@ -2578,7 +2580,7 @@ yyreduce: case 53: /* Line 1455 of yacc.c */ -#line 605 "program_parse.y" +#line 607 "program_parse.y" { (yyval.src_reg) = (yyvsp[(3) - (5)].src_reg); @@ -2600,7 +2602,7 @@ yyreduce: case 54: /* Line 1455 of yacc.c */ -#line 625 "program_parse.y" +#line 627 "program_parse.y" { (yyval.dst_reg) = (yyvsp[(1) - (3)].dst_reg); (yyval.dst_reg).WriteMask = (yyvsp[(2) - (3)].swiz_mask).mask; @@ -2628,7 +2630,7 @@ yyreduce: case 55: /* Line 1455 of yacc.c */ -#line 650 "program_parse.y" +#line 652 "program_parse.y" { set_dst_reg(& (yyval.dst_reg), PROGRAM_ADDRESS, 0); (yyval.dst_reg).WriteMask = (yyvsp[(2) - (2)].swiz_mask).mask; @@ -2638,7 +2640,7 @@ yyreduce: case 56: /* Line 1455 of yacc.c */ -#line 657 "program_parse.y" +#line 659 "program_parse.y" { const unsigned xyzw_valid = ((yyvsp[(1) - (7)].ext_swizzle).xyzw_valid << 0) @@ -2674,7 +2676,7 @@ yyreduce: case 57: /* Line 1455 of yacc.c */ -#line 690 "program_parse.y" +#line 692 "program_parse.y" { (yyval.ext_swizzle) = (yyvsp[(2) - (2)].ext_swizzle); (yyval.ext_swizzle).negate = ((yyvsp[(1) - (2)].negate)) ? 1 : 0; @@ -2684,7 +2686,7 @@ yyreduce: case 58: /* Line 1455 of yacc.c */ -#line 697 "program_parse.y" +#line 699 "program_parse.y" { if (((yyvsp[(1) - (1)].integer) != 0) && ((yyvsp[(1) - (1)].integer) != 1)) { yyerror(& (yylsp[(1) - (1)]), state, "invalid extended swizzle selector"); @@ -2704,14 +2706,19 @@ yyreduce: case 59: /* Line 1455 of yacc.c */ -#line 712 "program_parse.y" +#line 714 "program_parse.y" { + char s; + if (strlen((yyvsp[(1) - (1)].string)) > 1) { yyerror(& (yylsp[(1) - (1)]), state, "invalid extended swizzle selector"); YYERROR; } - switch ((yyvsp[(1) - (1)].string)[0]) { + s = (yyvsp[(1) - (1)].string)[0]; + free((yyvsp[(1) - (1)].string)); + + switch (s) { case 'x': (yyval.ext_swizzle).swz = SWIZZLE_X; (yyval.ext_swizzle).xyzw_valid = 1; @@ -2757,11 +2764,13 @@ yyreduce: case 60: /* Line 1455 of yacc.c */ -#line 762 "program_parse.y" +#line 769 "program_parse.y" { struct asm_symbol *const s = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(1) - (1)].string)); + free((yyvsp[(1) - (1)].string)); + if (s == NULL) { yyerror(& (yylsp[(1) - (1)]), state, "invalid operand variable"); YYERROR; @@ -2801,7 +2810,7 @@ yyreduce: case 61: /* Line 1455 of yacc.c */ -#line 801 "program_parse.y" +#line 810 "program_parse.y" { set_src_reg(& (yyval.src_reg), PROGRAM_INPUT, (yyvsp[(1) - (1)].attrib)); state->prog->InputsRead |= (1U << (yyval.src_reg).Base.Index); @@ -2815,7 +2824,7 @@ yyreduce: case 62: /* Line 1455 of yacc.c */ -#line 810 "program_parse.y" +#line 819 "program_parse.y" { if (! (yyvsp[(3) - (4)].src_reg).Base.RelAddr && ((unsigned) (yyvsp[(3) - (4)].src_reg).Base.Index >= (yyvsp[(1) - (4)].sym)->param_binding_length)) { @@ -2841,7 +2850,7 @@ yyreduce: case 63: /* Line 1455 of yacc.c */ -#line 831 "program_parse.y" +#line 840 "program_parse.y" { gl_register_file file = ((yyvsp[(1) - (1)].temp_sym).name != NULL) ? (yyvsp[(1) - (1)].temp_sym).param_binding_type @@ -2853,7 +2862,7 @@ yyreduce: case 64: /* Line 1455 of yacc.c */ -#line 840 "program_parse.y" +#line 849 "program_parse.y" { set_dst_reg(& (yyval.dst_reg), PROGRAM_OUTPUT, (yyvsp[(1) - (1)].result)); ;} @@ -2862,11 +2871,13 @@ yyreduce: case 65: /* Line 1455 of yacc.c */ -#line 844 "program_parse.y" +#line 853 "program_parse.y" { struct asm_symbol *const s = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(1) - (1)].string)); + free((yyvsp[(1) - (1)].string)); + if (s == NULL) { yyerror(& (yylsp[(1) - (1)]), state, "invalid operand variable"); YYERROR; @@ -2892,11 +2903,13 @@ yyreduce: case 66: /* Line 1455 of yacc.c */ -#line 871 "program_parse.y" +#line 882 "program_parse.y" { struct asm_symbol *const s = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(1) - (1)].string)); + free((yyvsp[(1) - (1)].string)); + if (s == NULL) { yyerror(& (yylsp[(1) - (1)]), state, "invalid operand variable"); YYERROR; @@ -2912,7 +2925,7 @@ yyreduce: case 69: /* Line 1455 of yacc.c */ -#line 890 "program_parse.y" +#line 903 "program_parse.y" { init_src_reg(& (yyval.src_reg)); (yyval.src_reg).Base.Index = (yyvsp[(1) - (1)].integer); @@ -2922,7 +2935,7 @@ yyreduce: case 70: /* Line 1455 of yacc.c */ -#line 897 "program_parse.y" +#line 910 "program_parse.y" { /* FINISHME: Add support for multiple address registers. */ @@ -2937,28 +2950,28 @@ yyreduce: case 71: /* Line 1455 of yacc.c */ -#line 908 "program_parse.y" +#line 921 "program_parse.y" { (yyval.integer) = 0; ;} break; case 72: /* Line 1455 of yacc.c */ -#line 909 "program_parse.y" +#line 922 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (2)].integer); ;} break; case 73: /* Line 1455 of yacc.c */ -#line 910 "program_parse.y" +#line 923 "program_parse.y" { (yyval.integer) = -(yyvsp[(2) - (2)].integer); ;} break; case 74: /* Line 1455 of yacc.c */ -#line 914 "program_parse.y" +#line 927 "program_parse.y" { if (((yyvsp[(1) - (1)].integer) < 0) || ((yyvsp[(1) - (1)].integer) > 63)) { char s[100]; @@ -2975,7 +2988,7 @@ yyreduce: case 75: /* Line 1455 of yacc.c */ -#line 928 "program_parse.y" +#line 941 "program_parse.y" { if (((yyvsp[(1) - (1)].integer) < 0) || ((yyvsp[(1) - (1)].integer) > 64)) { char s[100]; @@ -2992,11 +3005,13 @@ yyreduce: case 76: /* Line 1455 of yacc.c */ -#line 942 "program_parse.y" +#line 955 "program_parse.y" { struct asm_symbol *const s = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(1) - (1)].string)); + free((yyvsp[(1) - (1)].string)); + if (s == NULL) { yyerror(& (yylsp[(1) - (1)]), state, "invalid array member"); YYERROR; @@ -3013,7 +3028,7 @@ yyreduce: case 77: /* Line 1455 of yacc.c */ -#line 960 "program_parse.y" +#line 975 "program_parse.y" { if ((yyvsp[(1) - (1)].swiz_mask).mask != WRITEMASK_X) { yyerror(& (yylsp[(1) - (1)]), state, "invalid address component selector"); @@ -3027,7 +3042,7 @@ yyreduce: case 78: /* Line 1455 of yacc.c */ -#line 971 "program_parse.y" +#line 986 "program_parse.y" { if ((yyvsp[(1) - (1)].swiz_mask).mask != WRITEMASK_X) { yyerror(& (yylsp[(1) - (1)]), state, @@ -3042,21 +3057,21 @@ yyreduce: case 83: /* Line 1455 of yacc.c */ -#line 987 "program_parse.y" +#line 1002 "program_parse.y" { (yyval.swiz_mask).swizzle = SWIZZLE_NOOP; (yyval.swiz_mask).mask = WRITEMASK_XYZW; ;} break; case 88: /* Line 1455 of yacc.c */ -#line 991 "program_parse.y" +#line 1006 "program_parse.y" { (yyval.swiz_mask).swizzle = SWIZZLE_NOOP; (yyval.swiz_mask).mask = WRITEMASK_XYZW; ;} break; case 89: /* Line 1455 of yacc.c */ -#line 995 "program_parse.y" +#line 1010 "program_parse.y" { (yyval.dst_reg) = (yyvsp[(2) - (3)].dst_reg); ;} @@ -3065,7 +3080,7 @@ yyreduce: case 90: /* Line 1455 of yacc.c */ -#line 999 "program_parse.y" +#line 1014 "program_parse.y" { (yyval.dst_reg) = (yyvsp[(2) - (3)].dst_reg); ;} @@ -3074,7 +3089,7 @@ yyreduce: case 91: /* Line 1455 of yacc.c */ -#line 1003 "program_parse.y" +#line 1018 "program_parse.y" { (yyval.dst_reg).CondMask = COND_TR; (yyval.dst_reg).CondSwizzle = SWIZZLE_NOOP; @@ -3085,7 +3100,7 @@ yyreduce: case 92: /* Line 1455 of yacc.c */ -#line 1011 "program_parse.y" +#line 1026 "program_parse.y" { (yyval.dst_reg) = (yyvsp[(1) - (2)].dst_reg); (yyval.dst_reg).CondSwizzle = (yyvsp[(2) - (2)].swiz_mask).swizzle; @@ -3095,7 +3110,7 @@ yyreduce: case 93: /* Line 1455 of yacc.c */ -#line 1018 "program_parse.y" +#line 1033 "program_parse.y" { (yyval.dst_reg) = (yyvsp[(1) - (2)].dst_reg); (yyval.dst_reg).CondSwizzle = (yyvsp[(2) - (2)].swiz_mask).swizzle; @@ -3105,7 +3120,7 @@ yyreduce: case 94: /* Line 1455 of yacc.c */ -#line 1025 "program_parse.y" +#line 1040 "program_parse.y" { const int cond = _mesa_parse_cc((yyvsp[(1) - (1)].string)); if ((cond == 0) || ((yyvsp[(1) - (1)].string)[2] != '\0')) { @@ -3131,7 +3146,7 @@ yyreduce: case 95: /* Line 1455 of yacc.c */ -#line 1048 "program_parse.y" +#line 1063 "program_parse.y" { const int cond = _mesa_parse_cc((yyvsp[(1) - (1)].string)); if ((cond == 0) || ((yyvsp[(1) - (1)].string)[2] != '\0')) { @@ -3157,12 +3172,13 @@ yyreduce: case 102: /* Line 1455 of yacc.c */ -#line 1079 "program_parse.y" +#line 1094 "program_parse.y" { struct asm_symbol *const s = declare_variable(state, (yyvsp[(2) - (4)].string), at_attrib, & (yylsp[(2) - (4)])); if (s == NULL) { + free((yyvsp[(2) - (4)].string)); YYERROR; } else { s->attrib_binding = (yyvsp[(4) - (4)].attrib); @@ -3178,7 +3194,7 @@ yyreduce: case 103: /* Line 1455 of yacc.c */ -#line 1097 "program_parse.y" +#line 1113 "program_parse.y" { (yyval.attrib) = (yyvsp[(2) - (2)].attrib); ;} @@ -3187,7 +3203,7 @@ yyreduce: case 104: /* Line 1455 of yacc.c */ -#line 1101 "program_parse.y" +#line 1117 "program_parse.y" { (yyval.attrib) = (yyvsp[(2) - (2)].attrib); ;} @@ -3196,7 +3212,7 @@ yyreduce: case 105: /* Line 1455 of yacc.c */ -#line 1107 "program_parse.y" +#line 1123 "program_parse.y" { (yyval.attrib) = VERT_ATTRIB_POS; ;} @@ -3205,7 +3221,7 @@ yyreduce: case 106: /* Line 1455 of yacc.c */ -#line 1111 "program_parse.y" +#line 1127 "program_parse.y" { (yyval.attrib) = VERT_ATTRIB_WEIGHT; ;} @@ -3214,7 +3230,7 @@ yyreduce: case 107: /* Line 1455 of yacc.c */ -#line 1115 "program_parse.y" +#line 1131 "program_parse.y" { (yyval.attrib) = VERT_ATTRIB_NORMAL; ;} @@ -3223,7 +3239,7 @@ yyreduce: case 108: /* Line 1455 of yacc.c */ -#line 1119 "program_parse.y" +#line 1135 "program_parse.y" { if (!state->ctx->Extensions.EXT_secondary_color) { yyerror(& (yylsp[(2) - (2)]), state, "GL_EXT_secondary_color not supported"); @@ -3237,7 +3253,7 @@ yyreduce: case 109: /* Line 1455 of yacc.c */ -#line 1128 "program_parse.y" +#line 1144 "program_parse.y" { if (!state->ctx->Extensions.EXT_fog_coord) { yyerror(& (yylsp[(1) - (1)]), state, "GL_EXT_fog_coord not supported"); @@ -3251,7 +3267,7 @@ yyreduce: case 110: /* Line 1455 of yacc.c */ -#line 1137 "program_parse.y" +#line 1153 "program_parse.y" { (yyval.attrib) = VERT_ATTRIB_TEX0 + (yyvsp[(2) - (2)].integer); ;} @@ -3260,7 +3276,7 @@ yyreduce: case 111: /* Line 1455 of yacc.c */ -#line 1141 "program_parse.y" +#line 1157 "program_parse.y" { yyerror(& (yylsp[(1) - (4)]), state, "GL_ARB_matrix_palette not supported"); YYERROR; @@ -3270,7 +3286,7 @@ yyreduce: case 112: /* Line 1455 of yacc.c */ -#line 1146 "program_parse.y" +#line 1162 "program_parse.y" { (yyval.attrib) = VERT_ATTRIB_GENERIC0 + (yyvsp[(3) - (4)].integer); ;} @@ -3279,7 +3295,7 @@ yyreduce: case 113: /* Line 1455 of yacc.c */ -#line 1152 "program_parse.y" +#line 1168 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->limits->MaxAttribs) { yyerror(& (yylsp[(1) - (1)]), state, "invalid vertex attribute reference"); @@ -3293,7 +3309,7 @@ yyreduce: case 117: /* Line 1455 of yacc.c */ -#line 1166 "program_parse.y" +#line 1182 "program_parse.y" { (yyval.attrib) = FRAG_ATTRIB_WPOS; ;} @@ -3302,7 +3318,7 @@ yyreduce: case 118: /* Line 1455 of yacc.c */ -#line 1170 "program_parse.y" +#line 1186 "program_parse.y" { (yyval.attrib) = FRAG_ATTRIB_COL0 + (yyvsp[(2) - (2)].integer); ;} @@ -3311,7 +3327,7 @@ yyreduce: case 119: /* Line 1455 of yacc.c */ -#line 1174 "program_parse.y" +#line 1190 "program_parse.y" { (yyval.attrib) = FRAG_ATTRIB_FOGC; ;} @@ -3320,7 +3336,7 @@ yyreduce: case 120: /* Line 1455 of yacc.c */ -#line 1178 "program_parse.y" +#line 1194 "program_parse.y" { (yyval.attrib) = FRAG_ATTRIB_TEX0 + (yyvsp[(2) - (2)].integer); ;} @@ -3329,12 +3345,13 @@ yyreduce: case 123: /* Line 1455 of yacc.c */ -#line 1186 "program_parse.y" +#line 1202 "program_parse.y" { struct asm_symbol *const s = declare_variable(state, (yyvsp[(2) - (3)].string), at_param, & (yylsp[(2) - (3)])); if (s == NULL) { + free((yyvsp[(2) - (3)].string)); YYERROR; } else { s->param_binding_type = (yyvsp[(3) - (3)].temp_sym).param_binding_type; @@ -3348,9 +3365,10 @@ yyreduce: case 124: /* Line 1455 of yacc.c */ -#line 1202 "program_parse.y" +#line 1219 "program_parse.y" { if (((yyvsp[(4) - (6)].integer) != 0) && ((unsigned) (yyvsp[(4) - (6)].integer) != (yyvsp[(6) - (6)].temp_sym).param_binding_length)) { + free((yyvsp[(2) - (6)].string)); yyerror(& (yylsp[(4) - (6)]), state, "parameter array size and number of bindings must match"); YYERROR; @@ -3359,6 +3377,7 @@ yyreduce: declare_variable(state, (yyvsp[(2) - (6)].string), (yyvsp[(6) - (6)].temp_sym).type, & (yylsp[(2) - (6)])); if (s == NULL) { + free((yyvsp[(2) - (6)].string)); YYERROR; } else { s->param_binding_type = (yyvsp[(6) - (6)].temp_sym).param_binding_type; @@ -3373,7 +3392,7 @@ yyreduce: case 125: /* Line 1455 of yacc.c */ -#line 1224 "program_parse.y" +#line 1243 "program_parse.y" { (yyval.integer) = 0; ;} @@ -3382,7 +3401,7 @@ yyreduce: case 126: /* Line 1455 of yacc.c */ -#line 1228 "program_parse.y" +#line 1247 "program_parse.y" { if (((yyvsp[(1) - (1)].integer) < 1) || ((unsigned) (yyvsp[(1) - (1)].integer) > state->limits->MaxParameters)) { yyerror(& (yylsp[(1) - (1)]), state, "invalid parameter array size"); @@ -3396,7 +3415,7 @@ yyreduce: case 127: /* Line 1455 of yacc.c */ -#line 1239 "program_parse.y" +#line 1258 "program_parse.y" { (yyval.temp_sym) = (yyvsp[(2) - (2)].temp_sym); ;} @@ -3405,7 +3424,7 @@ yyreduce: case 128: /* Line 1455 of yacc.c */ -#line 1245 "program_parse.y" +#line 1264 "program_parse.y" { (yyval.temp_sym) = (yyvsp[(3) - (4)].temp_sym); ;} @@ -3414,7 +3433,7 @@ yyreduce: case 130: /* Line 1455 of yacc.c */ -#line 1252 "program_parse.y" +#line 1271 "program_parse.y" { (yyvsp[(1) - (3)].temp_sym).param_binding_length += (yyvsp[(3) - (3)].temp_sym).param_binding_length; (yyval.temp_sym) = (yyvsp[(1) - (3)].temp_sym); @@ -3424,7 +3443,7 @@ yyreduce: case 131: /* Line 1455 of yacc.c */ -#line 1259 "program_parse.y" +#line 1278 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3435,7 +3454,7 @@ yyreduce: case 132: /* Line 1455 of yacc.c */ -#line 1265 "program_parse.y" +#line 1284 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3446,7 +3465,7 @@ yyreduce: case 133: /* Line 1455 of yacc.c */ -#line 1271 "program_parse.y" +#line 1290 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3457,7 +3476,7 @@ yyreduce: case 134: /* Line 1455 of yacc.c */ -#line 1279 "program_parse.y" +#line 1298 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3468,7 +3487,7 @@ yyreduce: case 135: /* Line 1455 of yacc.c */ -#line 1285 "program_parse.y" +#line 1304 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3479,7 +3498,7 @@ yyreduce: case 136: /* Line 1455 of yacc.c */ -#line 1291 "program_parse.y" +#line 1310 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3490,7 +3509,7 @@ yyreduce: case 137: /* Line 1455 of yacc.c */ -#line 1299 "program_parse.y" +#line 1318 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3501,7 +3520,7 @@ yyreduce: case 138: /* Line 1455 of yacc.c */ -#line 1305 "program_parse.y" +#line 1324 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3512,7 +3531,7 @@ yyreduce: case 139: /* Line 1455 of yacc.c */ -#line 1311 "program_parse.y" +#line 1330 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3523,98 +3542,98 @@ yyreduce: case 140: /* Line 1455 of yacc.c */ -#line 1318 "program_parse.y" +#line 1337 "program_parse.y" { memcpy((yyval.state), (yyvsp[(1) - (1)].state), sizeof((yyval.state))); ;} break; case 141: /* Line 1455 of yacc.c */ -#line 1319 "program_parse.y" +#line 1338 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 142: /* Line 1455 of yacc.c */ -#line 1322 "program_parse.y" +#line 1341 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 143: /* Line 1455 of yacc.c */ -#line 1323 "program_parse.y" +#line 1342 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 144: /* Line 1455 of yacc.c */ -#line 1324 "program_parse.y" +#line 1343 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 145: /* Line 1455 of yacc.c */ -#line 1325 "program_parse.y" +#line 1344 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 146: /* Line 1455 of yacc.c */ -#line 1326 "program_parse.y" +#line 1345 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 147: /* Line 1455 of yacc.c */ -#line 1327 "program_parse.y" +#line 1346 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 148: /* Line 1455 of yacc.c */ -#line 1328 "program_parse.y" +#line 1347 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 149: /* Line 1455 of yacc.c */ -#line 1329 "program_parse.y" +#line 1348 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 150: /* Line 1455 of yacc.c */ -#line 1330 "program_parse.y" +#line 1349 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 151: /* Line 1455 of yacc.c */ -#line 1331 "program_parse.y" +#line 1350 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 152: /* Line 1455 of yacc.c */ -#line 1332 "program_parse.y" +#line 1351 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 153: /* Line 1455 of yacc.c */ -#line 1336 "program_parse.y" +#line 1355 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_MATERIAL; @@ -3626,7 +3645,7 @@ yyreduce: case 154: /* Line 1455 of yacc.c */ -#line 1345 "program_parse.y" +#line 1364 "program_parse.y" { (yyval.integer) = (yyvsp[(1) - (1)].integer); ;} @@ -3635,7 +3654,7 @@ yyreduce: case 155: /* Line 1455 of yacc.c */ -#line 1349 "program_parse.y" +#line 1368 "program_parse.y" { (yyval.integer) = STATE_EMISSION; ;} @@ -3644,7 +3663,7 @@ yyreduce: case 156: /* Line 1455 of yacc.c */ -#line 1353 "program_parse.y" +#line 1372 "program_parse.y" { (yyval.integer) = STATE_SHININESS; ;} @@ -3653,7 +3672,7 @@ yyreduce: case 157: /* Line 1455 of yacc.c */ -#line 1359 "program_parse.y" +#line 1378 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_LIGHT; @@ -3665,7 +3684,7 @@ yyreduce: case 158: /* Line 1455 of yacc.c */ -#line 1368 "program_parse.y" +#line 1387 "program_parse.y" { (yyval.integer) = (yyvsp[(1) - (1)].integer); ;} @@ -3674,7 +3693,7 @@ yyreduce: case 159: /* Line 1455 of yacc.c */ -#line 1372 "program_parse.y" +#line 1391 "program_parse.y" { (yyval.integer) = STATE_POSITION; ;} @@ -3683,7 +3702,7 @@ yyreduce: case 160: /* Line 1455 of yacc.c */ -#line 1376 "program_parse.y" +#line 1395 "program_parse.y" { if (!state->ctx->Extensions.EXT_point_parameters) { yyerror(& (yylsp[(1) - (1)]), state, "GL_ARB_point_parameters not supported"); @@ -3697,7 +3716,7 @@ yyreduce: case 161: /* Line 1455 of yacc.c */ -#line 1385 "program_parse.y" +#line 1404 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (2)].integer); ;} @@ -3706,7 +3725,7 @@ yyreduce: case 162: /* Line 1455 of yacc.c */ -#line 1389 "program_parse.y" +#line 1408 "program_parse.y" { (yyval.integer) = STATE_HALF_VECTOR; ;} @@ -3715,7 +3734,7 @@ yyreduce: case 163: /* Line 1455 of yacc.c */ -#line 1395 "program_parse.y" +#line 1414 "program_parse.y" { (yyval.integer) = STATE_SPOT_DIRECTION; ;} @@ -3724,7 +3743,7 @@ yyreduce: case 164: /* Line 1455 of yacc.c */ -#line 1401 "program_parse.y" +#line 1420 "program_parse.y" { (yyval.state)[0] = (yyvsp[(2) - (2)].state)[0]; (yyval.state)[1] = (yyvsp[(2) - (2)].state)[1]; @@ -3734,7 +3753,7 @@ yyreduce: case 165: /* Line 1455 of yacc.c */ -#line 1408 "program_parse.y" +#line 1427 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_LIGHTMODEL_AMBIENT; @@ -3744,7 +3763,7 @@ yyreduce: case 166: /* Line 1455 of yacc.c */ -#line 1413 "program_parse.y" +#line 1432 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_LIGHTMODEL_SCENECOLOR; @@ -3755,7 +3774,7 @@ yyreduce: case 167: /* Line 1455 of yacc.c */ -#line 1421 "program_parse.y" +#line 1440 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_LIGHTPROD; @@ -3768,7 +3787,7 @@ yyreduce: case 169: /* Line 1455 of yacc.c */ -#line 1433 "program_parse.y" +#line 1452 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = (yyvsp[(3) - (3)].integer); @@ -3779,7 +3798,7 @@ yyreduce: case 170: /* Line 1455 of yacc.c */ -#line 1441 "program_parse.y" +#line 1460 "program_parse.y" { (yyval.integer) = STATE_TEXENV_COLOR; ;} @@ -3788,7 +3807,7 @@ yyreduce: case 171: /* Line 1455 of yacc.c */ -#line 1447 "program_parse.y" +#line 1466 "program_parse.y" { (yyval.integer) = STATE_AMBIENT; ;} @@ -3797,7 +3816,7 @@ yyreduce: case 172: /* Line 1455 of yacc.c */ -#line 1451 "program_parse.y" +#line 1470 "program_parse.y" { (yyval.integer) = STATE_DIFFUSE; ;} @@ -3806,7 +3825,7 @@ yyreduce: case 173: /* Line 1455 of yacc.c */ -#line 1455 "program_parse.y" +#line 1474 "program_parse.y" { (yyval.integer) = STATE_SPECULAR; ;} @@ -3815,7 +3834,7 @@ yyreduce: case 174: /* Line 1455 of yacc.c */ -#line 1461 "program_parse.y" +#line 1480 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxLights) { yyerror(& (yylsp[(1) - (1)]), state, "invalid light selector"); @@ -3829,7 +3848,7 @@ yyreduce: case 175: /* Line 1455 of yacc.c */ -#line 1472 "program_parse.y" +#line 1491 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_TEXGEN; @@ -3841,7 +3860,7 @@ yyreduce: case 176: /* Line 1455 of yacc.c */ -#line 1481 "program_parse.y" +#line 1500 "program_parse.y" { (yyval.integer) = STATE_TEXGEN_EYE_S; ;} @@ -3850,7 +3869,7 @@ yyreduce: case 177: /* Line 1455 of yacc.c */ -#line 1485 "program_parse.y" +#line 1504 "program_parse.y" { (yyval.integer) = STATE_TEXGEN_OBJECT_S; ;} @@ -3859,7 +3878,7 @@ yyreduce: case 178: /* Line 1455 of yacc.c */ -#line 1490 "program_parse.y" +#line 1509 "program_parse.y" { (yyval.integer) = STATE_TEXGEN_EYE_S - STATE_TEXGEN_EYE_S; ;} @@ -3868,7 +3887,7 @@ yyreduce: case 179: /* Line 1455 of yacc.c */ -#line 1494 "program_parse.y" +#line 1513 "program_parse.y" { (yyval.integer) = STATE_TEXGEN_EYE_T - STATE_TEXGEN_EYE_S; ;} @@ -3877,7 +3896,7 @@ yyreduce: case 180: /* Line 1455 of yacc.c */ -#line 1498 "program_parse.y" +#line 1517 "program_parse.y" { (yyval.integer) = STATE_TEXGEN_EYE_R - STATE_TEXGEN_EYE_S; ;} @@ -3886,7 +3905,7 @@ yyreduce: case 181: /* Line 1455 of yacc.c */ -#line 1502 "program_parse.y" +#line 1521 "program_parse.y" { (yyval.integer) = STATE_TEXGEN_EYE_Q - STATE_TEXGEN_EYE_S; ;} @@ -3895,7 +3914,7 @@ yyreduce: case 182: /* Line 1455 of yacc.c */ -#line 1508 "program_parse.y" +#line 1527 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = (yyvsp[(2) - (2)].integer); @@ -3905,7 +3924,7 @@ yyreduce: case 183: /* Line 1455 of yacc.c */ -#line 1515 "program_parse.y" +#line 1534 "program_parse.y" { (yyval.integer) = STATE_FOG_COLOR; ;} @@ -3914,7 +3933,7 @@ yyreduce: case 184: /* Line 1455 of yacc.c */ -#line 1519 "program_parse.y" +#line 1538 "program_parse.y" { (yyval.integer) = STATE_FOG_PARAMS; ;} @@ -3923,7 +3942,7 @@ yyreduce: case 185: /* Line 1455 of yacc.c */ -#line 1525 "program_parse.y" +#line 1544 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_CLIPPLANE; @@ -3934,7 +3953,7 @@ yyreduce: case 186: /* Line 1455 of yacc.c */ -#line 1533 "program_parse.y" +#line 1552 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxClipPlanes) { yyerror(& (yylsp[(1) - (1)]), state, "invalid clip plane selector"); @@ -3948,7 +3967,7 @@ yyreduce: case 187: /* Line 1455 of yacc.c */ -#line 1544 "program_parse.y" +#line 1563 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = (yyvsp[(2) - (2)].integer); @@ -3958,7 +3977,7 @@ yyreduce: case 188: /* Line 1455 of yacc.c */ -#line 1551 "program_parse.y" +#line 1570 "program_parse.y" { (yyval.integer) = STATE_POINT_SIZE; ;} @@ -3967,7 +3986,7 @@ yyreduce: case 189: /* Line 1455 of yacc.c */ -#line 1555 "program_parse.y" +#line 1574 "program_parse.y" { (yyval.integer) = STATE_POINT_ATTENUATION; ;} @@ -3976,7 +3995,7 @@ yyreduce: case 190: /* Line 1455 of yacc.c */ -#line 1561 "program_parse.y" +#line 1580 "program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (5)].state)[0]; (yyval.state)[1] = (yyvsp[(1) - (5)].state)[1]; @@ -3989,7 +4008,7 @@ yyreduce: case 191: /* Line 1455 of yacc.c */ -#line 1571 "program_parse.y" +#line 1590 "program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (2)].state)[0]; (yyval.state)[1] = (yyvsp[(1) - (2)].state)[1]; @@ -4002,7 +4021,7 @@ yyreduce: case 192: /* Line 1455 of yacc.c */ -#line 1581 "program_parse.y" +#line 1600 "program_parse.y" { (yyval.state)[2] = 0; (yyval.state)[3] = 3; @@ -4012,7 +4031,7 @@ yyreduce: case 193: /* Line 1455 of yacc.c */ -#line 1586 "program_parse.y" +#line 1605 "program_parse.y" { /* It seems logical that the matrix row range specifier would have * to specify a range or more than one row (i.e., $5 > $3). @@ -4033,7 +4052,7 @@ yyreduce: case 194: /* Line 1455 of yacc.c */ -#line 1604 "program_parse.y" +#line 1623 "program_parse.y" { (yyval.state)[0] = (yyvsp[(2) - (3)].state)[0]; (yyval.state)[1] = (yyvsp[(2) - (3)].state)[1]; @@ -4044,7 +4063,7 @@ yyreduce: case 195: /* Line 1455 of yacc.c */ -#line 1612 "program_parse.y" +#line 1631 "program_parse.y" { (yyval.integer) = 0; ;} @@ -4053,7 +4072,7 @@ yyreduce: case 196: /* Line 1455 of yacc.c */ -#line 1616 "program_parse.y" +#line 1635 "program_parse.y" { (yyval.integer) = (yyvsp[(1) - (1)].integer); ;} @@ -4062,7 +4081,7 @@ yyreduce: case 197: /* Line 1455 of yacc.c */ -#line 1622 "program_parse.y" +#line 1641 "program_parse.y" { (yyval.integer) = STATE_MATRIX_INVERSE; ;} @@ -4071,7 +4090,7 @@ yyreduce: case 198: /* Line 1455 of yacc.c */ -#line 1626 "program_parse.y" +#line 1645 "program_parse.y" { (yyval.integer) = STATE_MATRIX_TRANSPOSE; ;} @@ -4080,7 +4099,7 @@ yyreduce: case 199: /* Line 1455 of yacc.c */ -#line 1630 "program_parse.y" +#line 1649 "program_parse.y" { (yyval.integer) = STATE_MATRIX_INVTRANS; ;} @@ -4089,7 +4108,7 @@ yyreduce: case 200: /* Line 1455 of yacc.c */ -#line 1636 "program_parse.y" +#line 1655 "program_parse.y" { if ((yyvsp[(1) - (1)].integer) > 3) { yyerror(& (yylsp[(1) - (1)]), state, "invalid matrix row reference"); @@ -4103,7 +4122,7 @@ yyreduce: case 201: /* Line 1455 of yacc.c */ -#line 1647 "program_parse.y" +#line 1666 "program_parse.y" { (yyval.state)[0] = STATE_MODELVIEW_MATRIX; (yyval.state)[1] = (yyvsp[(2) - (2)].integer); @@ -4113,7 +4132,7 @@ yyreduce: case 202: /* Line 1455 of yacc.c */ -#line 1652 "program_parse.y" +#line 1671 "program_parse.y" { (yyval.state)[0] = STATE_PROJECTION_MATRIX; (yyval.state)[1] = 0; @@ -4123,7 +4142,7 @@ yyreduce: case 203: /* Line 1455 of yacc.c */ -#line 1657 "program_parse.y" +#line 1676 "program_parse.y" { (yyval.state)[0] = STATE_MVP_MATRIX; (yyval.state)[1] = 0; @@ -4133,7 +4152,7 @@ yyreduce: case 204: /* Line 1455 of yacc.c */ -#line 1662 "program_parse.y" +#line 1681 "program_parse.y" { (yyval.state)[0] = STATE_TEXTURE_MATRIX; (yyval.state)[1] = (yyvsp[(2) - (2)].integer); @@ -4143,7 +4162,7 @@ yyreduce: case 205: /* Line 1455 of yacc.c */ -#line 1667 "program_parse.y" +#line 1686 "program_parse.y" { yyerror(& (yylsp[(1) - (4)]), state, "GL_ARB_matrix_palette not supported"); YYERROR; @@ -4153,7 +4172,7 @@ yyreduce: case 206: /* Line 1455 of yacc.c */ -#line 1672 "program_parse.y" +#line 1691 "program_parse.y" { (yyval.state)[0] = STATE_PROGRAM_MATRIX; (yyval.state)[1] = (yyvsp[(3) - (4)].integer); @@ -4163,7 +4182,7 @@ yyreduce: case 207: /* Line 1455 of yacc.c */ -#line 1679 "program_parse.y" +#line 1698 "program_parse.y" { (yyval.integer) = 0; ;} @@ -4172,7 +4191,7 @@ yyreduce: case 208: /* Line 1455 of yacc.c */ -#line 1683 "program_parse.y" +#line 1702 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (3)].integer); ;} @@ -4181,7 +4200,7 @@ yyreduce: case 209: /* Line 1455 of yacc.c */ -#line 1688 "program_parse.y" +#line 1707 "program_parse.y" { /* Since GL_ARB_vertex_blend isn't supported, only modelview matrix * zero is valid. @@ -4198,7 +4217,7 @@ yyreduce: case 210: /* Line 1455 of yacc.c */ -#line 1701 "program_parse.y" +#line 1720 "program_parse.y" { /* Since GL_ARB_matrix_palette isn't supported, just let any value * through here. The error will be generated later. @@ -4210,7 +4229,7 @@ yyreduce: case 211: /* Line 1455 of yacc.c */ -#line 1709 "program_parse.y" +#line 1728 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxProgramMatrices) { yyerror(& (yylsp[(1) - (1)]), state, "invalid program matrix selector"); @@ -4224,7 +4243,7 @@ yyreduce: case 212: /* Line 1455 of yacc.c */ -#line 1720 "program_parse.y" +#line 1739 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_DEPTH_RANGE; @@ -4234,7 +4253,7 @@ yyreduce: case 217: /* Line 1455 of yacc.c */ -#line 1732 "program_parse.y" +#line 1751 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = state->state_param_enum; @@ -4247,7 +4266,7 @@ yyreduce: case 218: /* Line 1455 of yacc.c */ -#line 1742 "program_parse.y" +#line 1761 "program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (1)].integer); (yyval.state)[1] = (yyvsp[(1) - (1)].integer); @@ -4257,7 +4276,7 @@ yyreduce: case 219: /* Line 1455 of yacc.c */ -#line 1747 "program_parse.y" +#line 1766 "program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (3)].integer); (yyval.state)[1] = (yyvsp[(3) - (3)].integer); @@ -4267,7 +4286,7 @@ yyreduce: case 220: /* Line 1455 of yacc.c */ -#line 1754 "program_parse.y" +#line 1773 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = state->state_param_enum; @@ -4280,7 +4299,7 @@ yyreduce: case 221: /* Line 1455 of yacc.c */ -#line 1764 "program_parse.y" +#line 1783 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = state->state_param_enum; @@ -4293,7 +4312,7 @@ yyreduce: case 222: /* Line 1455 of yacc.c */ -#line 1773 "program_parse.y" +#line 1792 "program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (1)].integer); (yyval.state)[1] = (yyvsp[(1) - (1)].integer); @@ -4303,7 +4322,7 @@ yyreduce: case 223: /* Line 1455 of yacc.c */ -#line 1778 "program_parse.y" +#line 1797 "program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (3)].integer); (yyval.state)[1] = (yyvsp[(3) - (3)].integer); @@ -4313,7 +4332,7 @@ yyreduce: case 224: /* Line 1455 of yacc.c */ -#line 1785 "program_parse.y" +#line 1804 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = state->state_param_enum; @@ -4326,7 +4345,7 @@ yyreduce: case 225: /* Line 1455 of yacc.c */ -#line 1795 "program_parse.y" +#line 1814 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->limits->MaxEnvParams) { yyerror(& (yylsp[(1) - (1)]), state, "invalid environment parameter reference"); @@ -4339,7 +4358,7 @@ yyreduce: case 226: /* Line 1455 of yacc.c */ -#line 1805 "program_parse.y" +#line 1824 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->limits->MaxLocalParams) { yyerror(& (yylsp[(1) - (1)]), state, "invalid local parameter reference"); @@ -4352,7 +4371,7 @@ yyreduce: case 231: /* Line 1455 of yacc.c */ -#line 1820 "program_parse.y" +#line 1839 "program_parse.y" { (yyval.vector).count = 4; (yyval.vector).data[0] = (yyvsp[(1) - (1)].real); @@ -4365,7 +4384,7 @@ yyreduce: case 232: /* Line 1455 of yacc.c */ -#line 1830 "program_parse.y" +#line 1849 "program_parse.y" { (yyval.vector).count = 1; (yyval.vector).data[0] = (yyvsp[(1) - (1)].real); @@ -4378,7 +4397,7 @@ yyreduce: case 233: /* Line 1455 of yacc.c */ -#line 1838 "program_parse.y" +#line 1857 "program_parse.y" { (yyval.vector).count = 1; (yyval.vector).data[0] = (float) (yyvsp[(1) - (1)].integer); @@ -4391,7 +4410,7 @@ yyreduce: case 234: /* Line 1455 of yacc.c */ -#line 1848 "program_parse.y" +#line 1867 "program_parse.y" { (yyval.vector).count = 4; (yyval.vector).data[0] = (yyvsp[(2) - (3)].real); @@ -4404,7 +4423,7 @@ yyreduce: case 235: /* Line 1455 of yacc.c */ -#line 1856 "program_parse.y" +#line 1875 "program_parse.y" { (yyval.vector).count = 4; (yyval.vector).data[0] = (yyvsp[(2) - (5)].real); @@ -4417,7 +4436,7 @@ yyreduce: case 236: /* Line 1455 of yacc.c */ -#line 1865 "program_parse.y" +#line 1884 "program_parse.y" { (yyval.vector).count = 4; (yyval.vector).data[0] = (yyvsp[(2) - (7)].real); @@ -4430,7 +4449,7 @@ yyreduce: case 237: /* Line 1455 of yacc.c */ -#line 1874 "program_parse.y" +#line 1893 "program_parse.y" { (yyval.vector).count = 4; (yyval.vector).data[0] = (yyvsp[(2) - (9)].real); @@ -4443,7 +4462,7 @@ yyreduce: case 238: /* Line 1455 of yacc.c */ -#line 1884 "program_parse.y" +#line 1903 "program_parse.y" { (yyval.real) = ((yyvsp[(1) - (2)].negate)) ? -(yyvsp[(2) - (2)].real) : (yyvsp[(2) - (2)].real); ;} @@ -4452,7 +4471,7 @@ yyreduce: case 239: /* Line 1455 of yacc.c */ -#line 1888 "program_parse.y" +#line 1907 "program_parse.y" { (yyval.real) = (float)(((yyvsp[(1) - (2)].negate)) ? -(yyvsp[(2) - (2)].integer) : (yyvsp[(2) - (2)].integer)); ;} @@ -4461,35 +4480,35 @@ yyreduce: case 240: /* Line 1455 of yacc.c */ -#line 1893 "program_parse.y" +#line 1912 "program_parse.y" { (yyval.negate) = FALSE; ;} break; case 241: /* Line 1455 of yacc.c */ -#line 1894 "program_parse.y" +#line 1913 "program_parse.y" { (yyval.negate) = TRUE; ;} break; case 242: /* Line 1455 of yacc.c */ -#line 1895 "program_parse.y" +#line 1914 "program_parse.y" { (yyval.negate) = FALSE; ;} break; case 243: /* Line 1455 of yacc.c */ -#line 1898 "program_parse.y" +#line 1917 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (2)].integer); ;} break; case 245: /* Line 1455 of yacc.c */ -#line 1902 "program_parse.y" +#line 1921 "program_parse.y" { /* NV_fragment_program_option defines the size qualifiers in a * fairly broken way. "SHORT" or "LONG" can optionally be used @@ -4528,7 +4547,7 @@ yyreduce: case 246: /* Line 1455 of yacc.c */ -#line 1936 "program_parse.y" +#line 1955 "program_parse.y" { ;} break; @@ -4536,16 +4555,17 @@ yyreduce: case 247: /* Line 1455 of yacc.c */ -#line 1940 "program_parse.y" +#line 1959 "program_parse.y" { (yyval.integer) = (yyvsp[(1) - (1)].integer); ;} break; case 249: /* Line 1455 of yacc.c */ -#line 1944 "program_parse.y" +#line 1963 "program_parse.y" { if (!declare_variable(state, (yyvsp[(3) - (3)].string), (yyvsp[(0) - (3)].integer), & (yylsp[(3) - (3)]))) { + free((yyvsp[(3) - (3)].string)); YYERROR; } ;} @@ -4554,9 +4574,10 @@ yyreduce: case 250: /* Line 1455 of yacc.c */ -#line 1950 "program_parse.y" +#line 1970 "program_parse.y" { if (!declare_variable(state, (yyvsp[(1) - (1)].string), (yyvsp[(0) - (1)].integer), & (yylsp[(1) - (1)]))) { + free((yyvsp[(1) - (1)].string)); YYERROR; } ;} @@ -4565,12 +4586,13 @@ yyreduce: case 251: /* Line 1455 of yacc.c */ -#line 1958 "program_parse.y" +#line 1979 "program_parse.y" { struct asm_symbol *const s = declare_variable(state, (yyvsp[(3) - (5)].string), at_output, & (yylsp[(3) - (5)])); if (s == NULL) { + free((yyvsp[(3) - (5)].string)); YYERROR; } else { s->output_binding = (yyvsp[(5) - (5)].result); @@ -4581,7 +4603,7 @@ yyreduce: case 252: /* Line 1455 of yacc.c */ -#line 1971 "program_parse.y" +#line 1993 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.result) = VERT_RESULT_HPOS; @@ -4595,7 +4617,7 @@ yyreduce: case 253: /* Line 1455 of yacc.c */ -#line 1980 "program_parse.y" +#line 2002 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.result) = VERT_RESULT_FOGC; @@ -4609,7 +4631,7 @@ yyreduce: case 254: /* Line 1455 of yacc.c */ -#line 1989 "program_parse.y" +#line 2011 "program_parse.y" { (yyval.result) = (yyvsp[(2) - (2)].result); ;} @@ -4618,7 +4640,7 @@ yyreduce: case 255: /* Line 1455 of yacc.c */ -#line 1993 "program_parse.y" +#line 2015 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.result) = VERT_RESULT_PSIZ; @@ -4632,7 +4654,7 @@ yyreduce: case 256: /* Line 1455 of yacc.c */ -#line 2002 "program_parse.y" +#line 2024 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.result) = VERT_RESULT_TEX0 + (yyvsp[(3) - (3)].integer); @@ -4646,7 +4668,7 @@ yyreduce: case 257: /* Line 1455 of yacc.c */ -#line 2011 "program_parse.y" +#line 2033 "program_parse.y" { if (state->mode == ARB_fragment) { (yyval.result) = FRAG_RESULT_DEPTH; @@ -4660,7 +4682,7 @@ yyreduce: case 258: /* Line 1455 of yacc.c */ -#line 2022 "program_parse.y" +#line 2044 "program_parse.y" { (yyval.result) = (yyvsp[(2) - (3)].integer) + (yyvsp[(3) - (3)].integer); ;} @@ -4669,7 +4691,7 @@ yyreduce: case 259: /* Line 1455 of yacc.c */ -#line 2028 "program_parse.y" +#line 2050 "program_parse.y" { (yyval.integer) = (state->mode == ARB_vertex) ? VERT_RESULT_COL0 @@ -4680,7 +4702,7 @@ yyreduce: case 260: /* Line 1455 of yacc.c */ -#line 2034 "program_parse.y" +#line 2056 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.integer) = VERT_RESULT_COL0; @@ -4694,7 +4716,7 @@ yyreduce: case 261: /* Line 1455 of yacc.c */ -#line 2043 "program_parse.y" +#line 2065 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.integer) = VERT_RESULT_BFC0; @@ -4708,7 +4730,7 @@ yyreduce: case 262: /* Line 1455 of yacc.c */ -#line 2054 "program_parse.y" +#line 2076 "program_parse.y" { (yyval.integer) = 0; ;} @@ -4717,7 +4739,7 @@ yyreduce: case 263: /* Line 1455 of yacc.c */ -#line 2058 "program_parse.y" +#line 2080 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.integer) = 0; @@ -4731,7 +4753,7 @@ yyreduce: case 264: /* Line 1455 of yacc.c */ -#line 2067 "program_parse.y" +#line 2089 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.integer) = 1; @@ -4745,91 +4767,91 @@ yyreduce: case 265: /* Line 1455 of yacc.c */ -#line 2077 "program_parse.y" +#line 2099 "program_parse.y" { (yyval.integer) = 0; ;} break; case 266: /* Line 1455 of yacc.c */ -#line 2078 "program_parse.y" +#line 2100 "program_parse.y" { (yyval.integer) = 0; ;} break; case 267: /* Line 1455 of yacc.c */ -#line 2079 "program_parse.y" +#line 2101 "program_parse.y" { (yyval.integer) = 1; ;} break; case 268: /* Line 1455 of yacc.c */ -#line 2082 "program_parse.y" +#line 2104 "program_parse.y" { (yyval.integer) = 0; ;} break; case 269: /* Line 1455 of yacc.c */ -#line 2083 "program_parse.y" +#line 2105 "program_parse.y" { (yyval.integer) = 0; ;} break; case 270: /* Line 1455 of yacc.c */ -#line 2084 "program_parse.y" +#line 2106 "program_parse.y" { (yyval.integer) = 1; ;} break; case 271: /* Line 1455 of yacc.c */ -#line 2087 "program_parse.y" +#line 2109 "program_parse.y" { (yyval.integer) = 0; ;} break; case 272: /* Line 1455 of yacc.c */ -#line 2088 "program_parse.y" +#line 2110 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (3)].integer); ;} break; case 273: /* Line 1455 of yacc.c */ -#line 2091 "program_parse.y" +#line 2113 "program_parse.y" { (yyval.integer) = 0; ;} break; case 274: /* Line 1455 of yacc.c */ -#line 2092 "program_parse.y" +#line 2114 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (3)].integer); ;} break; case 275: /* Line 1455 of yacc.c */ -#line 2095 "program_parse.y" +#line 2117 "program_parse.y" { (yyval.integer) = 0; ;} break; case 276: /* Line 1455 of yacc.c */ -#line 2096 "program_parse.y" +#line 2118 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (3)].integer); ;} break; case 277: /* Line 1455 of yacc.c */ -#line 2100 "program_parse.y" +#line 2122 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxTextureCoordUnits) { yyerror(& (yylsp[(1) - (1)]), state, "invalid texture coordinate unit selector"); @@ -4843,7 +4865,7 @@ yyreduce: case 278: /* Line 1455 of yacc.c */ -#line 2111 "program_parse.y" +#line 2133 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxTextureImageUnits) { yyerror(& (yylsp[(1) - (1)]), state, "invalid texture image unit selector"); @@ -4857,7 +4879,7 @@ yyreduce: case 279: /* Line 1455 of yacc.c */ -#line 2122 "program_parse.y" +#line 2144 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxTextureUnits) { yyerror(& (yylsp[(1) - (1)]), state, "invalid texture unit selector"); @@ -4871,24 +4893,28 @@ yyreduce: case 280: /* Line 1455 of yacc.c */ -#line 2133 "program_parse.y" +#line 2155 "program_parse.y" { struct asm_symbol *exist = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(2) - (4)].string)); struct asm_symbol *target = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(4) - (4)].string)); + free((yyvsp[(4) - (4)].string)); + if (exist != NULL) { char m[1000]; _mesa_snprintf(m, sizeof(m), "redeclared identifier: %s", (yyvsp[(2) - (4)].string)); + free((yyvsp[(2) - (4)].string)); yyerror(& (yylsp[(2) - (4)]), state, m); YYERROR; } else if (target == NULL) { + free((yyvsp[(2) - (4)].string)); yyerror(& (yylsp[(4) - (4)]), state, "undefined variable binding in ALIAS statement"); YYERROR; } else { - _mesa_symbol_table_add_symbol(state->st, 0, strdup((yyvsp[(2) - (4)].string)), target); + _mesa_symbol_table_add_symbol(state->st, 0, (yyvsp[(2) - (4)].string), target); } ;} break; @@ -4896,7 +4922,7 @@ yyreduce: /* Line 1455 of yacc.c */ -#line 4900 "program_parse.tab.c" +#line 4926 "program_parse.tab.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -5115,7 +5141,7 @@ yyreturn: /* Line 1675 of yacc.c */ -#line 2158 "program_parse.y" +#line 2184 "program_parse.y" void @@ -5298,14 +5324,10 @@ declare_variable(struct asm_parser_state *state, char *name, enum asm_type t, if (exist != NULL) { yyerror(locp, state, "redeclared identifier"); } else { - const size_t name_len = strlen(name); - - s = calloc(1, sizeof(struct asm_symbol) + name_len + 1); - s->name = (char *)(s + 1); + s = calloc(1, sizeof(struct asm_symbol)); + s->name = name; s->type = t; - memcpy((char *) s->name, name, name_len + 1); - switch (t) { case at_temp: if (state->prog->NumTemporaries >= state->limits->MaxTemps) { @@ -5553,11 +5575,6 @@ _mesa_parse_arb_program(GLcontext *ctx, GLenum target, const GLubyte *str, _mesa_memcpy (strz, str, len); strz[len] = '\0'; - if (state->prog->String != NULL) { - _mesa_free(state->prog->String); - state->prog->String = NULL; - } - state->prog->String = strz; state->st = _mesa_symbol_table_ctor(); @@ -5647,6 +5664,7 @@ error: for (sym = state->sym; sym != NULL; sym = temp) { temp = sym->next; + _mesa_free((void *) sym->name); _mesa_free(sym); } state->sym = NULL; @@ -5654,11 +5672,6 @@ error: _mesa_symbol_table_dtor(state->st); state->st = NULL; - if (state->string_dumpster != NULL) { - _mesa_free(state->string_dumpster); - state->dumpster_size = 0; - } - return result; } diff --git a/src/mesa/shader/program_parse.y b/src/mesa/shader/program_parse.y index 5767c517599..d07bf85b362 100644 --- a/src/mesa/shader/program_parse.y +++ b/src/mesa/shader/program_parse.y @@ -309,6 +309,8 @@ option: OPTION string ';' } + free($2); + if (!valid) { const char *const err_str = (state->mode == ARB_vertex) ? "invalid ARB vertex program option" @@ -710,12 +712,17 @@ extSwizSel: INTEGER } | string { + char s; + if (strlen($1) > 1) { yyerror(& @1, state, "invalid extended swizzle selector"); YYERROR; } - switch ($1[0]) { + s = $1[0]; + free($1); + + switch (s) { case 'x': $$.swz = SWIZZLE_X; $$.xyzw_valid = 1; @@ -763,6 +770,8 @@ srcReg: USED_IDENTIFIER /* temporaryReg | progParamSingle */ struct asm_symbol *const s = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, $1); + free($1); + if (s == NULL) { yyerror(& @1, state, "invalid operand variable"); YYERROR; @@ -845,6 +854,8 @@ dstReg: resultBinding struct asm_symbol *const s = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, $1); + free($1); + if (s == NULL) { yyerror(& @1, state, "invalid operand variable"); YYERROR; @@ -872,6 +883,8 @@ progParamArray: USED_IDENTIFIER struct asm_symbol *const s = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, $1); + free($1); + if (s == NULL) { yyerror(& @1, state, "invalid operand variable"); YYERROR; @@ -943,6 +956,8 @@ addrReg: USED_IDENTIFIER struct asm_symbol *const s = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, $1); + free($1); + if (s == NULL) { yyerror(& @1, state, "invalid array member"); YYERROR; @@ -1081,6 +1096,7 @@ ATTRIB_statement: ATTRIB IDENTIFIER '=' attribBinding declare_variable(state, $2, at_attrib, & @2); if (s == NULL) { + free($2); YYERROR; } else { s->attrib_binding = $4; @@ -1188,6 +1204,7 @@ PARAM_singleStmt: PARAM IDENTIFIER paramSingleInit declare_variable(state, $2, at_param, & @2); if (s == NULL) { + free($2); YYERROR; } else { s->param_binding_type = $3.param_binding_type; @@ -1201,6 +1218,7 @@ PARAM_singleStmt: PARAM IDENTIFIER paramSingleInit PARAM_multipleStmt: PARAM IDENTIFIER '[' optArraySize ']' paramMultipleInit { if (($4 != 0) && ((unsigned) $4 != $6.param_binding_length)) { + free($2); yyerror(& @4, state, "parameter array size and number of bindings must match"); YYERROR; @@ -1209,6 +1227,7 @@ PARAM_multipleStmt: PARAM IDENTIFIER '[' optArraySize ']' paramMultipleInit declare_variable(state, $2, $6.type, & @2); if (s == NULL) { + free($2); YYERROR; } else { s->param_binding_type = $6.param_binding_type; @@ -1943,12 +1962,14 @@ ADDRESS_statement: ADDRESS { $<integer>$ = $1; } varNameList varNameList: varNameList ',' IDENTIFIER { if (!declare_variable(state, $3, $<integer>0, & @3)) { + free($3); YYERROR; } } | IDENTIFIER { if (!declare_variable(state, $1, $<integer>0, & @1)) { + free($1); YYERROR; } } @@ -1960,6 +1981,7 @@ OUTPUT_statement: optVarSize OUTPUT IDENTIFIER '=' resultBinding declare_variable(state, $3, at_output, & @3); if (s == NULL) { + free($3); YYERROR; } else { s->output_binding = $5; @@ -2136,17 +2158,21 @@ ALIAS_statement: ALIAS IDENTIFIER '=' USED_IDENTIFIER struct asm_symbol *target = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, $4); + free($4); + if (exist != NULL) { char m[1000]; _mesa_snprintf(m, sizeof(m), "redeclared identifier: %s", $2); + free($2); yyerror(& @2, state, m); YYERROR; } else if (target == NULL) { + free($2); yyerror(& @4, state, "undefined variable binding in ALIAS statement"); YYERROR; } else { - _mesa_symbol_table_add_symbol(state->st, 0, strdup($2), target); + _mesa_symbol_table_add_symbol(state->st, 0, $2, target); } } ; @@ -2337,14 +2363,10 @@ declare_variable(struct asm_parser_state *state, char *name, enum asm_type t, if (exist != NULL) { yyerror(locp, state, "redeclared identifier"); } else { - const size_t name_len = strlen(name); - - s = calloc(1, sizeof(struct asm_symbol) + name_len + 1); - s->name = (char *)(s + 1); + s = calloc(1, sizeof(struct asm_symbol)); + s->name = name; s->type = t; - memcpy((char *) s->name, name, name_len + 1); - switch (t) { case at_temp: if (state->prog->NumTemporaries >= state->limits->MaxTemps) { @@ -2592,11 +2614,6 @@ _mesa_parse_arb_program(GLcontext *ctx, GLenum target, const GLubyte *str, _mesa_memcpy (strz, str, len); strz[len] = '\0'; - if (state->prog->String != NULL) { - _mesa_free(state->prog->String); - state->prog->String = NULL; - } - state->prog->String = strz; state->st = _mesa_symbol_table_ctor(); @@ -2686,6 +2703,7 @@ error: for (sym = state->sym; sym != NULL; sym = temp) { temp = sym->next; + _mesa_free((void *) sym->name); _mesa_free(sym); } state->sym = NULL; @@ -2693,10 +2711,5 @@ error: _mesa_symbol_table_dtor(state->st); state->st = NULL; - if (state->string_dumpster != NULL) { - _mesa_free(state->string_dumpster); - state->dumpster_size = 0; - } - return result; } diff --git a/src/mesa/shader/program_parser.h b/src/mesa/shader/program_parser.h index 25b413918aa..bce6041381f 100644 --- a/src/mesa/shader/program_parser.h +++ b/src/mesa/shader/program_parser.h @@ -38,13 +38,6 @@ enum asm_type { at_output, }; -/** - * \note - * Objects of this type are allocated as the object plus the name of the - * symbol. That is, malloc(sizeof(struct asm_symbol) + strlen(name) + 1). - * Alternately, asm_symbol::name could be moved to the bottom of the structure - * and declared as 'char name[0];'. - */ struct asm_symbol { struct asm_symbol *next; /**< List linkage for freeing. */ const char *name; @@ -165,15 +158,6 @@ struct asm_parser_state { /** - * Buffer to hold strings transfered from the lexer to the parser - */ - /*@{*/ - char *string_dumpster; /**< String data transfered. */ - size_t dumpster_size; /**< Total size, in bytes, of the buffer. */ - /*@}*/ - - - /** * Selected limits copied from gl_constants * * These are limits from the GL context, but various bits in the program |