diff options
Diffstat (limited to 'src/mesa/program')
-rw-r--r-- | src/mesa/program/.gitignore | 3 | ||||
-rw-r--r-- | src/mesa/program/Makefile | 7 | ||||
-rw-r--r-- | src/mesa/program/arbprogparse.h | 6 | ||||
-rw-r--r-- | src/mesa/program/ir_to_mesa.cpp | 384 | ||||
-rw-r--r-- | src/mesa/program/ir_to_mesa.h | 7 | ||||
-rw-r--r-- | src/mesa/program/lex.yy.c | 422 | ||||
-rw-r--r-- | src/mesa/program/nvfragparse.h | 5 | ||||
-rw-r--r-- | src/mesa/program/nvvertparse.h | 5 | ||||
-rw-r--r-- | src/mesa/program/prog_cache.c | 53 | ||||
-rw-r--r-- | src/mesa/program/prog_cache.h | 12 | ||||
-rw-r--r-- | src/mesa/program/prog_execute.c | 16 | ||||
-rw-r--r-- | src/mesa/program/prog_execute.h | 1 | ||||
-rw-r--r-- | src/mesa/program/prog_instruction.h | 2 | ||||
-rw-r--r-- | src/mesa/program/prog_optimize.h | 3 | ||||
-rw-r--r-- | src/mesa/program/prog_print.c | 5 | ||||
-rw-r--r-- | src/mesa/program/prog_statevars.h | 4 | ||||
-rw-r--r-- | src/mesa/program/program.c | 8 | ||||
-rw-r--r-- | src/mesa/program/program_parse.tab.c | 1528 | ||||
-rw-r--r-- | src/mesa/program/program_parse.tab.h | 151 | ||||
-rw-r--r-- | src/mesa/program/program_parse.y | 4 | ||||
-rw-r--r-- | src/mesa/program/register_allocate.c | 122 | ||||
-rw-r--r-- | src/mesa/program/sampler.cpp | 21 |
22 files changed, 1440 insertions, 1329 deletions
diff --git a/src/mesa/program/.gitignore b/src/mesa/program/.gitignore index 086fd9a705..4c20872e14 100644 --- a/src/mesa/program/.gitignore +++ b/src/mesa/program/.gitignore @@ -1 +1,4 @@ program_parse.output +lex.yy.c +program_parse.tab.c +program_parse.tab.h diff --git a/src/mesa/program/Makefile b/src/mesa/program/Makefile deleted file mode 100644 index 400a543bda..0000000000 --- a/src/mesa/program/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -all: program_parse.tab.c lex.yy.c - -program_parse.tab.c program_parse.tab.h: program_parse.y - bison -v -d $< - -lex.yy.c: program_lexer.l - flex --never-interactive $< diff --git a/src/mesa/program/arbprogparse.h b/src/mesa/program/arbprogparse.h index 08e25a1c16..4c0c300720 100644 --- a/src/mesa/program/arbprogparse.h +++ b/src/mesa/program/arbprogparse.h @@ -26,7 +26,11 @@ #ifndef ARBPROGPARSE_H #define ARBPROGPARSE_H -#include "main/mtypes.h" +#include "main/glheader.h" + +struct gl_context; +struct gl_fragment_program; +struct gl_vertex_program; extern void _mesa_parse_arb_vertex_program(struct gl_context *ctx, GLenum target, diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index b274a961b2..9578f42f14 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -105,13 +105,13 @@ extern ir_to_mesa_src_reg ir_to_mesa_undef; class ir_to_mesa_instruction : public exec_node { public: - /* Callers of this talloc-based new need not call delete. It's - * easier to just talloc_free 'ctx' (or any of its ancestors). */ + /* Callers of this ralloc-based new need not call delete. It's + * easier to just ralloc_free 'ctx' (or any of its ancestors). */ static void* operator new(size_t size, void *ctx) { void *node; - node = talloc_zero_size(ctx, size); + node = rzalloc_size(ctx, size); assert(node != NULL); return node; @@ -295,6 +295,8 @@ public: bool process_move_condition(ir_rvalue *ir); + void copy_propagate(void); + void *mem_ctx; }; @@ -316,7 +318,7 @@ fail_link(struct gl_shader_program *prog, const char *fmt, ...) { va_list args; va_start(args, fmt); - prog->InfoLog = talloc_vasprintf_append(prog->InfoLog, fmt, args); + ralloc_vasprintf_append(&prog->InfoLog, fmt, args); va_end(args); prog->LinkStatus = GL_FALSE; @@ -649,6 +651,7 @@ type_size(const struct glsl_type *type) return 1; } case GLSL_TYPE_ARRAY: + assert(type->length > 0); return type_size(type->fields.array) * type->length; case GLSL_TYPE_STRUCT: size = 0; @@ -724,6 +727,29 @@ ir_to_mesa_visitor::visit(ir_variable *ir) fp->OriginUpperLeft = ir->origin_upper_left; fp->PixelCenterInteger = ir->pixel_center_integer; + + } else if (strcmp(ir->name, "gl_FragDepth") == 0) { + struct gl_fragment_program *fp = (struct gl_fragment_program *)this->prog; + switch (ir->depth_layout) { + case ir_depth_layout_none: + fp->FragDepthLayout = FRAG_DEPTH_LAYOUT_NONE; + break; + case ir_depth_layout_any: + fp->FragDepthLayout = FRAG_DEPTH_LAYOUT_ANY; + break; + case ir_depth_layout_greater: + fp->FragDepthLayout = FRAG_DEPTH_LAYOUT_GREATER; + break; + case ir_depth_layout_less: + fp->FragDepthLayout = FRAG_DEPTH_LAYOUT_LESS; + break; + case ir_depth_layout_unchanged: + fp->FragDepthLayout = FRAG_DEPTH_LAYOUT_UNCHANGED; + break; + default: + assert(0); + break; + } } if (ir->mode == ir_var_uniform && strncmp(ir->name, "gl_", 3) == 0) { @@ -1449,16 +1475,16 @@ void ir_to_mesa_visitor::visit(ir_dereference_variable *ir) { variable_storage *entry = find_variable_storage(ir->var); + ir_variable *var = ir->var; if (!entry) { - switch (ir->var->mode) { + switch (var->mode) { case ir_var_uniform: - entry = new(mem_ctx) variable_storage(ir->var, PROGRAM_UNIFORM, - ir->var->location); + entry = new(mem_ctx) variable_storage(var, PROGRAM_UNIFORM, + var->location); this->variables.push_tail(entry); break; case ir_var_in: - case ir_var_out: case ir_var_inout: /* The linker assigns locations for varyings and attributes, * including deprecated builtins (like gl_Color), user-assign @@ -1467,45 +1493,47 @@ ir_to_mesa_visitor::visit(ir_dereference_variable *ir) * * FINISHME: We would hit this path for function arguments. Fix! */ - assert(ir->var->location != -1); - if (ir->var->mode == ir_var_in || - ir->var->mode == ir_var_inout) { - entry = new(mem_ctx) variable_storage(ir->var, - PROGRAM_INPUT, - ir->var->location); - - if (this->prog->Target == GL_VERTEX_PROGRAM_ARB && - ir->var->location >= VERT_ATTRIB_GENERIC0) { - _mesa_add_attribute(prog->Attributes, - ir->var->name, - _mesa_sizeof_glsl_type(ir->var->type->gl_type), - ir->var->type->gl_type, - ir->var->location - VERT_ATTRIB_GENERIC0); - } - } else { - entry = new(mem_ctx) variable_storage(ir->var, - PROGRAM_OUTPUT, - ir->var->location); - } - + assert(var->location != -1); + entry = new(mem_ctx) variable_storage(var, + PROGRAM_INPUT, + var->location); + if (this->prog->Target == GL_VERTEX_PROGRAM_ARB && + var->location >= VERT_ATTRIB_GENERIC0) { + _mesa_add_attribute(this->prog->Attributes, + var->name, + _mesa_sizeof_glsl_type(var->type->gl_type), + var->type->gl_type, + var->location - VERT_ATTRIB_GENERIC0); + } + break; + case ir_var_out: + assert(var->location != -1); + entry = new(mem_ctx) variable_storage(var, + PROGRAM_OUTPUT, + var->location); break; + case ir_var_system_value: + entry = new(mem_ctx) variable_storage(var, + PROGRAM_SYSTEM_VALUE, + var->location); + break; case ir_var_auto: case ir_var_temporary: - entry = new(mem_ctx) variable_storage(ir->var, PROGRAM_TEMPORARY, + entry = new(mem_ctx) variable_storage(var, PROGRAM_TEMPORARY, this->next_temp); this->variables.push_tail(entry); - next_temp += type_size(ir->var->type); + next_temp += type_size(var->type); break; } if (!entry) { - printf("Failed to make storage for %s\n", ir->var->name); + printf("Failed to make storage for %s\n", var->name); exit(1); } } - this->result = ir_to_mesa_src_reg(entry->file, entry->index, ir->var->type); + this->result = ir_to_mesa_src_reg(entry->file, entry->index, var->type); } void @@ -1542,7 +1570,7 @@ ir_to_mesa_visitor::visit(ir_dereference_array *ir) this->result, src_reg_for_float(element_size)); } - src_reg.reladdr = talloc(mem_ctx, ir_to_mesa_src_reg); + src_reg.reladdr = ralloc(mem_ctx, ir_to_mesa_src_reg); memcpy(src_reg.reladdr, &index_reg, sizeof(index_reg)); } @@ -1569,7 +1597,13 @@ ir_to_mesa_visitor::visit(ir_dereference_record *ir) break; offset += type_size(struct_type->fields.structure[i].type); } - this->result.swizzle = swizzle_for_size(ir->type->vector_elements); + + /* If the type is smaller than a vec4, replicate the last channel out. */ + if (ir->type->is_scalar() || ir->type->is_vector()) + this->result.swizzle = swizzle_for_size(ir->type->vector_elements); + else + this->result.swizzle = SWIZZLE_NOOP; + this->result.index += offset; } @@ -1893,7 +1927,7 @@ ir_to_mesa_visitor::get_function_signature(ir_function_signature *sig) return entry; } - entry = talloc(mem_ctx, function_entry); + entry = ralloc(mem_ctx, function_entry); entry->sig = sig; entry->sig_id = this->next_signature_id++; entry->bgn_inst = NULL; @@ -2230,12 +2264,12 @@ ir_to_mesa_visitor::ir_to_mesa_visitor() next_temp = 1; next_signature_id = 1; current_function = NULL; - mem_ctx = talloc_new(NULL); + mem_ctx = ralloc_context(NULL); } ir_to_mesa_visitor::~ir_to_mesa_visitor() { - talloc_free(mem_ctx); + ralloc_free(mem_ctx); } static struct prog_src_register @@ -2284,8 +2318,8 @@ set_branchtargets(ir_to_mesa_visitor *v, } } - if_stack = talloc_zero_array(v->mem_ctx, int, if_count); - loop_stack = talloc_zero_array(v->mem_ctx, int, loop_count); + if_stack = rzalloc_array(v->mem_ctx, int, if_count); + loop_stack = rzalloc_array(v->mem_ctx, int, loop_count); for (i = 0; i < num_instructions; i++) { switch (mesa_instructions[i].Opcode) { @@ -2372,6 +2406,11 @@ print_program(struct prog_instruction *mesa_instructions, } } + +/** + * Count resources used by the given gpu program (number of texture + * samplers, etc). + */ static void count_resources(struct gl_program *prog) { @@ -2395,6 +2434,55 @@ count_resources(struct gl_program *prog) _mesa_update_shader_textures_used(prog); } + +/** + * Check if the given vertex/fragment/shader program is within the + * resource limits of the context (number of texture units, etc). + * If any of those checks fail, record a linker error. + * + * XXX more checks are needed... + */ +static void +check_resources(const struct gl_context *ctx, + struct gl_shader_program *shader_program, + struct gl_program *prog) +{ + switch (prog->Target) { + case GL_VERTEX_PROGRAM_ARB: + if (_mesa_bitcount(prog->SamplersUsed) > + ctx->Const.MaxVertexTextureImageUnits) { + fail_link(shader_program, "Too many vertex shader texture samplers"); + } + if (prog->Parameters->NumParameters > MAX_UNIFORMS) { + fail_link(shader_program, "Too many vertex shader constants"); + } + break; + case MESA_GEOMETRY_PROGRAM: + if (_mesa_bitcount(prog->SamplersUsed) > + ctx->Const.MaxGeometryTextureImageUnits) { + fail_link(shader_program, "Too many geometry shader texture samplers"); + } + if (prog->Parameters->NumParameters > + MAX_GEOMETRY_UNIFORM_COMPONENTS / 4) { + fail_link(shader_program, "Too many geometry shader constants"); + } + break; + case GL_FRAGMENT_PROGRAM_ARB: + if (_mesa_bitcount(prog->SamplersUsed) > + ctx->Const.MaxTextureImageUnits) { + fail_link(shader_program, "Too many fragment shader texture samplers"); + } + if (prog->Parameters->NumParameters > MAX_UNIFORMS) { + fail_link(shader_program, "Too many fragment shader constants"); + } + break; + default: + _mesa_problem(ctx, "unexpected program type in check_resources()"); + } +} + + + struct uniform_sort { struct gl_uniform *u; int pos; @@ -2428,7 +2516,7 @@ add_uniforms_to_parameters_list(struct gl_shader_program *shader_program, unsigned int next_sampler = 0, num_uniforms = 0; struct uniform_sort *sorted_uniforms; - sorted_uniforms = talloc_array(NULL, struct uniform_sort, + sorted_uniforms = ralloc_array(NULL, struct uniform_sort, shader_program->Uniforms->NumUniforms); for (i = 0; i < shader_program->Uniforms->NumUniforms; i++) { @@ -2507,7 +2595,7 @@ add_uniforms_to_parameters_list(struct gl_shader_program *shader_program, } } - talloc_free(sorted_uniforms); + ralloc_free(sorted_uniforms); } static void @@ -2523,7 +2611,7 @@ set_uniform_initializer(struct gl_context *ctx, void *mem_ctx, for (unsigned int i = 0; i < type->length; i++) { const glsl_type *field_type = type->fields.structure[i].type; - const char *field_name = talloc_asprintf(mem_ctx, "%s.%s", name, + const char *field_name = ralloc_asprintf(mem_ctx, "%s.%s", name, type->fields.structure[i].name); set_uniform_initializer(ctx, mem_ctx, shader_program, field_name, field_type, field_constant); @@ -2554,7 +2642,7 @@ set_uniform_initializer(struct gl_context *ctx, void *mem_ctx, void *values; if (element_type->base_type == GLSL_TYPE_BOOL) { - int *conv = talloc_array(mem_ctx, int, element_type->components()); + int *conv = ralloc_array(mem_ctx, int, element_type->components()); for (unsigned int j = 0; j < element_type->components(); j++) { conv[j] = element->value.b[j]; } @@ -2600,14 +2688,206 @@ set_uniform_initializers(struct gl_context *ctx, continue; if (!mem_ctx) - mem_ctx = talloc_new(NULL); + mem_ctx = ralloc_context(NULL); set_uniform_initializer(ctx, mem_ctx, shader_program, var->name, var->type, var->constant_value); } } - talloc_free(mem_ctx); + ralloc_free(mem_ctx); +} + +/* + * On a basic block basis, tracks available PROGRAM_TEMPORARY register + * channels for copy propagation and updates following instructions to + * use the original versions. + * + * The ir_to_mesa_visitor lazily produces code assuming that this pass + * will occur. As an example, a TXP production before this pass: + * + * 0: MOV TEMP[1], INPUT[4].xyyy; + * 1: MOV TEMP[1].w, INPUT[4].wwww; + * 2: TXP TEMP[2], TEMP[1], texture[0], 2D; + * + * and after: + * + * 0: MOV TEMP[1], INPUT[4].xyyy; + * 1: MOV TEMP[1].w, INPUT[4].wwww; + * 2: TXP TEMP[2], INPUT[4].xyyw, texture[0], 2D; + * + * which allows for dead code elimination on TEMP[1]'s writes. + */ +void +ir_to_mesa_visitor::copy_propagate(void) +{ + ir_to_mesa_instruction **acp = rzalloc_array(mem_ctx, + ir_to_mesa_instruction *, + this->next_temp * 4); + int *acp_level = rzalloc_array(mem_ctx, int, this->next_temp * 4); + int level = 0; + + foreach_iter(exec_list_iterator, iter, this->instructions) { + ir_to_mesa_instruction *inst = (ir_to_mesa_instruction *)iter.get(); + + assert(inst->dst_reg.file != PROGRAM_TEMPORARY + || inst->dst_reg.index < this->next_temp); + + /* First, do any copy propagation possible into the src regs. */ + for (int r = 0; r < 3; r++) { + ir_to_mesa_instruction *first = NULL; + bool good = true; + int acp_base = inst->src_reg[r].index * 4; + + if (inst->src_reg[r].file != PROGRAM_TEMPORARY || + inst->src_reg[r].reladdr) + continue; + + /* See if we can find entries in the ACP consisting of MOVs + * from the same src register for all the swizzled channels + * of this src register reference. + */ + for (int i = 0; i < 4; i++) { + int src_chan = GET_SWZ(inst->src_reg[r].swizzle, i); + ir_to_mesa_instruction *copy_chan = acp[acp_base + src_chan]; + + if (!copy_chan) { + good = false; + break; + } + + assert(acp_level[acp_base + src_chan] <= level); + + if (!first) { + first = copy_chan; + } else { + if (first->src_reg[0].file != copy_chan->src_reg[0].file || + first->src_reg[0].index != copy_chan->src_reg[0].index) { + good = false; + break; + } + } + } + + if (good) { + /* We've now validated that we can copy-propagate to + * replace this src register reference. Do it. + */ + inst->src_reg[r].file = first->src_reg[0].file; + inst->src_reg[r].index = first->src_reg[0].index; + + int swizzle = 0; + for (int i = 0; i < 4; i++) { + int src_chan = GET_SWZ(inst->src_reg[r].swizzle, i); + ir_to_mesa_instruction *copy_inst = acp[acp_base + src_chan]; + swizzle |= (GET_SWZ(copy_inst->src_reg[0].swizzle, src_chan) << + (3 * i)); + } + inst->src_reg[r].swizzle = swizzle; + } + } + + switch (inst->op) { + case OPCODE_BGNLOOP: + case OPCODE_ENDLOOP: + /* End of a basic block, clear the ACP entirely. */ + memset(acp, 0, sizeof(*acp) * this->next_temp * 4); + break; + + case OPCODE_IF: + ++level; + break; + + case OPCODE_ENDIF: + case OPCODE_ELSE: + /* Clear all channels written inside the block from the ACP, but + * leaving those that were not touched. + */ + for (int r = 0; r < this->next_temp; r++) { + for (int c = 0; c < 4; c++) { + if (!acp[4 * r + c]) + continue; + + if (acp_level[4 * r + c] >= level) + acp[4 * r + c] = NULL; + } + } + if (inst->op == OPCODE_ENDIF) + --level; + break; + + default: + /* Continuing the block, clear any written channels from + * the ACP. + */ + if (inst->dst_reg.file == PROGRAM_TEMPORARY && inst->dst_reg.reladdr) { + /* Any temporary might be written, so no copy propagation + * across this instruction. + */ + memset(acp, 0, sizeof(*acp) * this->next_temp * 4); + } else if (inst->dst_reg.file == PROGRAM_OUTPUT && + inst->dst_reg.reladdr) { + /* Any output might be written, so no copy propagation + * from outputs across this instruction. + */ + for (int r = 0; r < this->next_temp; r++) { + for (int c = 0; c < 4; c++) { + if (!acp[4 * r + c]) + continue; + + if (acp[4 * r + c]->src_reg[0].file == PROGRAM_OUTPUT) + acp[4 * r + c] = NULL; + } + } + } else if (inst->dst_reg.file == PROGRAM_TEMPORARY || + inst->dst_reg.file == PROGRAM_OUTPUT) { + /* Clear where it's used as dst. */ + if (inst->dst_reg.file == PROGRAM_TEMPORARY) { + for (int c = 0; c < 4; c++) { + if (inst->dst_reg.writemask & (1 << c)) { + acp[4 * inst->dst_reg.index + c] = NULL; + } + } + } + + /* Clear where it's used as src. */ + for (int r = 0; r < this->next_temp; r++) { + for (int c = 0; c < 4; c++) { + if (!acp[4 * r + c]) + continue; + + int src_chan = GET_SWZ(acp[4 * r + c]->src_reg[0].swizzle, c); + + if (acp[4 * r + c]->src_reg[0].file == inst->dst_reg.file && + acp[4 * r + c]->src_reg[0].index == inst->dst_reg.index && + inst->dst_reg.writemask & (1 << src_chan)) + { + acp[4 * r + c] = NULL; + } + } + } + } + break; + } + + /* If this is a copy, add it to the ACP. */ + if (inst->op == OPCODE_MOV && + inst->dst_reg.file == PROGRAM_TEMPORARY && + !inst->dst_reg.reladdr && + !inst->saturate && + !inst->src_reg[0].reladdr && + !inst->src_reg[0].negate) { + for (int i = 0; i < 4; i++) { + if (inst->dst_reg.writemask & (1 << i)) { + acp[4 * inst->dst_reg.index + i] = inst; + acp_level[4 * inst->dst_reg.index + i] = level; + } + } + } + } + + ralloc_free(acp_level); + ralloc_free(acp); } @@ -2706,9 +2986,11 @@ get_mesa_program(struct gl_context *ctx, mesa_instructions = (struct prog_instruction *)calloc(num_instructions, sizeof(*mesa_instructions)); - mesa_instruction_annotation = talloc_array(v.mem_ctx, ir_instruction *, + mesa_instruction_annotation = ralloc_array(v.mem_ctx, ir_instruction *, num_instructions); + v.copy_propagate(); + /* Convert ir_mesa_instructions into prog_instructions. */ mesa_inst = mesa_instructions; @@ -2798,6 +3080,8 @@ get_mesa_program(struct gl_context *ctx, do_set_program_inouts(shader->ir, prog); count_resources(prog); + check_resources(ctx, shader_program, prog); + _mesa_reference_program(ctx, &shader->Program, prog); if ((ctx->Shader.Flags & GLSL_NO_OPT) == 0) { @@ -2861,7 +3145,7 @@ _mesa_ir_link_shader(struct gl_context *ctx, struct gl_shader_program *prog) if (options->EmitNoIfs) { progress = lower_discard(ir) || progress; - progress = do_if_to_cond_assign(ir) || progress; + progress = lower_if_to_cond_assign(ir) || progress; } if (options->EmitNoNoise) @@ -2961,7 +3245,7 @@ _mesa_glsl_compile_shader(struct gl_context *ctx, struct gl_shader *shader) _mesa_glsl_lexer_dtor(state); } - talloc_free(shader->ir); + ralloc_free(shader->ir); shader->ir = new(shader) exec_list; if (!state->error && !state->translation_unit.is_empty()) _mesa_ast_to_hir(shader->ir, state); @@ -3008,7 +3292,7 @@ _mesa_glsl_compile_shader(struct gl_context *ctx, struct gl_shader *shader) /* Retain any live IR, but trash the rest. */ reparent_ir(shader->ir, shader->ir); - talloc_free(state); + ralloc_free(state); if (shader->CompileStatus) { if (!ctx->Driver.CompileShader(ctx, shader)) diff --git a/src/mesa/program/ir_to_mesa.h b/src/mesa/program/ir_to_mesa.h index 7197615f94..7410e14973 100644 --- a/src/mesa/program/ir_to_mesa.h +++ b/src/mesa/program/ir_to_mesa.h @@ -25,8 +25,11 @@ extern "C" { #endif -#include "main/config.h" -#include "main/mtypes.h" +#include "main/glheader.h" + +struct gl_context; +struct gl_shader; +struct gl_shader_program; void _mesa_glsl_compile_shader(struct gl_context *ctx, struct gl_shader *sh); void _mesa_glsl_link_shader(struct gl_context *ctx, struct gl_shader_program *prog); diff --git a/src/mesa/program/lex.yy.c b/src/mesa/program/lex.yy.c index 135eca6fd8..33e1a11018 100644 --- a/src/mesa/program/lex.yy.c +++ b/src/mesa/program/lex.yy.c @@ -1,5 +1,6 @@ +#line 2 "program/lex.yy.c" -#line 3 "lex.yy.c" +#line 4 "program/lex.yy.c" #define YY_INT_ALIGNED short int @@ -53,6 +54,7 @@ typedef int flex_int32_t; typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; +#endif /* ! C99 */ /* Limits of integral types. */ #ifndef INT8_MIN @@ -83,8 +85,6 @@ typedef unsigned int flex_uint32_t; #define UINT32_MAX (4294967295U) #endif -#endif /* ! C99 */ - #endif /* ! FLEXINT_H */ #ifdef __cplusplus @@ -158,15 +158,7 @@ typedef void* yyscan_t; /* Size of default input buffer. */ #ifndef YY_BUF_SIZE -#ifdef __ia64__ -/* On IA-64, the buffer size is 16k, not 8k. - * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. - * Ditto for the __ia64__ case accordingly. - */ -#define YY_BUF_SIZE 32768 -#else #define YY_BUF_SIZE 16384 -#endif /* __ia64__ */ #endif /* The state buf must be large enough to hold one state per character in the main buffer. @@ -178,6 +170,11 @@ typedef void* yyscan_t; typedef struct yy_buffer_state *YY_BUFFER_STATE; #endif +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif + #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 @@ -200,11 +197,6 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE; #define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner ) -#ifndef YY_TYPEDEF_YY_SIZE_T -#define YY_TYPEDEF_YY_SIZE_T -typedef size_t yy_size_t; -#endif - #ifndef YY_STRUCT_YY_BUFFER_STATE #define YY_STRUCT_YY_BUFFER_STATE struct yy_buffer_state @@ -222,7 +214,7 @@ struct yy_buffer_state /* Number of characters read into yy_ch_buf, not including EOB * characters. */ - int yy_n_chars; + yy_size_t yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to @@ -301,7 +293,7 @@ static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner ); YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner ); YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ,yyscan_t yyscanner ); -YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner ); +YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,yy_size_t len ,yyscan_t yyscanner ); void *yyalloc (yy_size_t ,yyscan_t yyscanner ); void *yyrealloc (void *,yy_size_t ,yyscan_t yyscanner ); @@ -1017,8 +1009,8 @@ static yyconst flex_int16_t yy_chk[1368] = #define yymore() yymore_used_but_not_detected #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET -#line 1 "program_lexer.l" -#line 2 "program_lexer.l" +#line 1 "program/program_lexer.l" +#line 2 "program/program_lexer.l" /* * Copyright © 2009 Intel Corporation * @@ -1173,7 +1165,7 @@ static keyword. Declare them here to avoid a compiler warning. */ int yyget_column (yyscan_t yyscanner); void yyset_column (int column_no , yyscan_t yyscanner); -#line 1177 "lex.yy.c" +#line 1169 "program/lex.yy.c" #define INITIAL 0 @@ -1202,8 +1194,8 @@ struct yyguts_t size_t yy_buffer_stack_max; /**< capacity of stack. */ YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */ char yy_hold_char; - int yy_n_chars; - int yyleng_r; + yy_size_t yy_n_chars; + yy_size_t yyleng_r; char *yy_c_buf_p; int yy_init; int yy_start; @@ -1260,7 +1252,7 @@ FILE *yyget_out (yyscan_t yyscanner ); void yyset_out (FILE * out_str ,yyscan_t yyscanner ); -int yyget_leng (yyscan_t yyscanner ); +yy_size_t yyget_leng (yyscan_t yyscanner ); char *yyget_text (yyscan_t yyscanner ); @@ -1310,12 +1302,7 @@ static int input (yyscan_t yyscanner ); /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE -#ifdef __ia64__ -/* On IA-64, the buffer size is 16k, not 8k */ -#define YY_READ_BUF_SIZE 16384 -#else #define YY_READ_BUF_SIZE 8192 -#endif /* __ia64__ */ #endif /* Copy whatever the last rule matched to the standard output. */ @@ -1323,7 +1310,7 @@ static int input (yyscan_t yyscanner ); /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) +#define ECHO fwrite( yytext, yyleng, 1, yyout ) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -1334,7 +1321,7 @@ static int input (yyscan_t yyscanner ); if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ - size_t n; \ + yy_size_t n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ @@ -1419,10 +1406,10 @@ YY_DECL register int yy_act; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; -#line 169 "program_lexer.l" +#line 169 "program/program_lexer.l" -#line 1426 "lex.yy.c" +#line 1413 "program/lex.yy.c" yylval = yylval_param; @@ -1511,17 +1498,17 @@ do_action: /* This label is used only to access EOF actions. */ case 1: YY_RULE_SETUP -#line 171 "program_lexer.l" +#line 171 "program/program_lexer.l" { return ARBvp_10; } YY_BREAK case 2: YY_RULE_SETUP -#line 172 "program_lexer.l" +#line 172 "program/program_lexer.l" { return ARBfp_10; } YY_BREAK case 3: YY_RULE_SETUP -#line 173 "program_lexer.l" +#line 173 "program/program_lexer.l" { yylval->integer = at_address; return_token_or_IDENTIFIER(require_ARB_vp, ADDRESS); @@ -1529,692 +1516,692 @@ YY_RULE_SETUP YY_BREAK case 4: YY_RULE_SETUP -#line 177 "program_lexer.l" +#line 177 "program/program_lexer.l" { return ALIAS; } YY_BREAK case 5: YY_RULE_SETUP -#line 178 "program_lexer.l" +#line 178 "program/program_lexer.l" { return ATTRIB; } YY_BREAK case 6: YY_RULE_SETUP -#line 179 "program_lexer.l" +#line 179 "program/program_lexer.l" { return END; } YY_BREAK case 7: YY_RULE_SETUP -#line 180 "program_lexer.l" +#line 180 "program/program_lexer.l" { return OPTION; } YY_BREAK case 8: YY_RULE_SETUP -#line 181 "program_lexer.l" +#line 181 "program/program_lexer.l" { return OUTPUT; } YY_BREAK case 9: YY_RULE_SETUP -#line 182 "program_lexer.l" +#line 182 "program/program_lexer.l" { return PARAM; } YY_BREAK case 10: YY_RULE_SETUP -#line 183 "program_lexer.l" +#line 183 "program/program_lexer.l" { yylval->integer = at_temp; return TEMP; } YY_BREAK case 11: YY_RULE_SETUP -#line 185 "program_lexer.l" +#line 185 "program/program_lexer.l" { return_opcode( 1, VECTOR_OP, ABS, 3); } YY_BREAK case 12: YY_RULE_SETUP -#line 186 "program_lexer.l" +#line 186 "program/program_lexer.l" { return_opcode( 1, BIN_OP, ADD, 3); } YY_BREAK case 13: YY_RULE_SETUP -#line 187 "program_lexer.l" +#line 187 "program/program_lexer.l" { return_opcode(require_ARB_vp, ARL, ARL, 3); } YY_BREAK case 14: YY_RULE_SETUP -#line 189 "program_lexer.l" +#line 189 "program/program_lexer.l" { return_opcode(require_ARB_fp, TRI_OP, CMP, 3); } YY_BREAK case 15: YY_RULE_SETUP -#line 190 "program_lexer.l" +#line 190 "program/program_lexer.l" { return_opcode(require_ARB_fp, SCALAR_OP, COS, 3); } YY_BREAK case 16: YY_RULE_SETUP -#line 192 "program_lexer.l" +#line 192 "program/program_lexer.l" { return_opcode(require_NV_fp, VECTOR_OP, DDX, 3); } YY_BREAK case 17: YY_RULE_SETUP -#line 193 "program_lexer.l" +#line 193 "program/program_lexer.l" { return_opcode(require_NV_fp, VECTOR_OP, DDY, 3); } YY_BREAK case 18: YY_RULE_SETUP -#line 194 "program_lexer.l" +#line 194 "program/program_lexer.l" { return_opcode( 1, BIN_OP, DP3, 3); } YY_BREAK case 19: YY_RULE_SETUP -#line 195 "program_lexer.l" +#line 195 "program/program_lexer.l" { return_opcode( 1, BIN_OP, DP4, 3); } YY_BREAK case 20: YY_RULE_SETUP -#line 196 "program_lexer.l" +#line 196 "program/program_lexer.l" { return_opcode( 1, BIN_OP, DPH, 3); } YY_BREAK case 21: YY_RULE_SETUP -#line 197 "program_lexer.l" +#line 197 "program/program_lexer.l" { return_opcode( 1, BIN_OP, DST, 3); } YY_BREAK case 22: YY_RULE_SETUP -#line 199 "program_lexer.l" +#line 199 "program/program_lexer.l" { return_opcode( 1, SCALAR_OP, EX2, 3); } YY_BREAK case 23: YY_RULE_SETUP -#line 200 "program_lexer.l" +#line 200 "program/program_lexer.l" { return_opcode(require_ARB_vp, SCALAR_OP, EXP, 3); } YY_BREAK case 24: YY_RULE_SETUP -#line 202 "program_lexer.l" +#line 202 "program/program_lexer.l" { return_opcode( 1, VECTOR_OP, FLR, 3); } YY_BREAK case 25: YY_RULE_SETUP -#line 203 "program_lexer.l" +#line 203 "program/program_lexer.l" { return_opcode( 1, VECTOR_OP, FRC, 3); } YY_BREAK case 26: YY_RULE_SETUP -#line 205 "program_lexer.l" +#line 205 "program/program_lexer.l" { return_opcode(require_ARB_fp, KIL, KIL, 3); } YY_BREAK case 27: YY_RULE_SETUP -#line 207 "program_lexer.l" +#line 207 "program/program_lexer.l" { return_opcode( 1, VECTOR_OP, LIT, 3); } YY_BREAK case 28: YY_RULE_SETUP -#line 208 "program_lexer.l" +#line 208 "program/program_lexer.l" { return_opcode( 1, SCALAR_OP, LG2, 3); } YY_BREAK case 29: YY_RULE_SETUP -#line 209 "program_lexer.l" +#line 209 "program/program_lexer.l" { return_opcode(require_ARB_vp, SCALAR_OP, LOG, 3); } YY_BREAK case 30: YY_RULE_SETUP -#line 210 "program_lexer.l" +#line 210 "program/program_lexer.l" { return_opcode(require_ARB_fp, TRI_OP, LRP, 3); } YY_BREAK case 31: YY_RULE_SETUP -#line 212 "program_lexer.l" +#line 212 "program/program_lexer.l" { return_opcode( 1, TRI_OP, MAD, 3); } YY_BREAK case 32: YY_RULE_SETUP -#line 213 "program_lexer.l" +#line 213 "program/program_lexer.l" { return_opcode( 1, BIN_OP, MAX, 3); } YY_BREAK case 33: YY_RULE_SETUP -#line 214 "program_lexer.l" +#line 214 "program/program_lexer.l" { return_opcode( 1, BIN_OP, MIN, 3); } YY_BREAK case 34: YY_RULE_SETUP -#line 215 "program_lexer.l" +#line 215 "program/program_lexer.l" { return_opcode( 1, VECTOR_OP, MOV, 3); } YY_BREAK case 35: YY_RULE_SETUP -#line 216 "program_lexer.l" +#line 216 "program/program_lexer.l" { return_opcode( 1, BIN_OP, MUL, 3); } YY_BREAK case 36: YY_RULE_SETUP -#line 218 "program_lexer.l" +#line 218 "program/program_lexer.l" { return_opcode(require_NV_fp, VECTOR_OP, PK2H, 4); } YY_BREAK case 37: YY_RULE_SETUP -#line 219 "program_lexer.l" +#line 219 "program/program_lexer.l" { return_opcode(require_NV_fp, VECTOR_OP, PK2US, 5); } YY_BREAK case 38: YY_RULE_SETUP -#line 220 "program_lexer.l" +#line 220 "program/program_lexer.l" { return_opcode(require_NV_fp, VECTOR_OP, PK4B, 4); } YY_BREAK case 39: YY_RULE_SETUP -#line 221 "program_lexer.l" +#line 221 "program/program_lexer.l" { return_opcode(require_NV_fp, VECTOR_OP, PK4UB, 5); } YY_BREAK case 40: YY_RULE_SETUP -#line 222 "program_lexer.l" +#line 222 "program/program_lexer.l" { return_opcode( 1, BINSC_OP, POW, 3); } YY_BREAK case 41: YY_RULE_SETUP -#line 224 "program_lexer.l" +#line 224 "program/program_lexer.l" { return_opcode( 1, SCALAR_OP, RCP, 3); } YY_BREAK case 42: YY_RULE_SETUP -#line 225 "program_lexer.l" +#line 225 "program/program_lexer.l" { return_opcode(require_NV_fp, BIN_OP, RFL, 3); } YY_BREAK case 43: YY_RULE_SETUP -#line 226 "program_lexer.l" +#line 226 "program/program_lexer.l" { return_opcode( 1, SCALAR_OP, RSQ, 3); } YY_BREAK case 44: YY_RULE_SETUP -#line 228 "program_lexer.l" +#line 228 "program/program_lexer.l" { return_opcode(require_ARB_fp, SCALAR_OP, SCS, 3); } YY_BREAK case 45: YY_RULE_SETUP -#line 229 "program_lexer.l" +#line 229 "program/program_lexer.l" { return_opcode(require_NV_fp, BIN_OP, SEQ, 3); } YY_BREAK case 46: YY_RULE_SETUP -#line 230 "program_lexer.l" +#line 230 "program/program_lexer.l" { return_opcode(require_NV_fp, BIN_OP, SFL, 3); } YY_BREAK case 47: YY_RULE_SETUP -#line 231 "program_lexer.l" +#line 231 "program/program_lexer.l" { return_opcode( 1, BIN_OP, SGE, 3); } YY_BREAK case 48: YY_RULE_SETUP -#line 232 "program_lexer.l" +#line 232 "program/program_lexer.l" { return_opcode(require_NV_fp, BIN_OP, SGT, 3); } YY_BREAK case 49: YY_RULE_SETUP -#line 233 "program_lexer.l" +#line 233 "program/program_lexer.l" { return_opcode(require_ARB_fp, SCALAR_OP, SIN, 3); } YY_BREAK case 50: YY_RULE_SETUP -#line 234 "program_lexer.l" +#line 234 "program/program_lexer.l" { return_opcode(require_NV_fp, BIN_OP, SLE, 3); } YY_BREAK case 51: YY_RULE_SETUP -#line 235 "program_lexer.l" +#line 235 "program/program_lexer.l" { return_opcode( 1, BIN_OP, SLT, 3); } YY_BREAK case 52: YY_RULE_SETUP -#line 236 "program_lexer.l" +#line 236 "program/program_lexer.l" { return_opcode(require_NV_fp, BIN_OP, SNE, 3); } YY_BREAK case 53: YY_RULE_SETUP -#line 237 "program_lexer.l" +#line 237 "program/program_lexer.l" { return_opcode(require_NV_fp, BIN_OP, STR, 3); } YY_BREAK case 54: YY_RULE_SETUP -#line 238 "program_lexer.l" +#line 238 "program/program_lexer.l" { return_opcode( 1, BIN_OP, SUB, 3); } YY_BREAK case 55: YY_RULE_SETUP -#line 239 "program_lexer.l" +#line 239 "program/program_lexer.l" { return_opcode( 1, SWZ, SWZ, 3); } YY_BREAK case 56: YY_RULE_SETUP -#line 241 "program_lexer.l" +#line 241 "program/program_lexer.l" { return_opcode(require_ARB_fp, SAMPLE_OP, TEX, 3); } YY_BREAK case 57: YY_RULE_SETUP -#line 242 "program_lexer.l" +#line 242 "program/program_lexer.l" { return_opcode(require_ARB_fp, SAMPLE_OP, TXB, 3); } YY_BREAK case 58: YY_RULE_SETUP -#line 243 "program_lexer.l" +#line 243 "program/program_lexer.l" { return_opcode(require_NV_fp, TXD_OP, TXD, 3); } YY_BREAK case 59: YY_RULE_SETUP -#line 244 "program_lexer.l" +#line 244 "program/program_lexer.l" { return_opcode(require_ARB_fp, SAMPLE_OP, TXP, 3); } YY_BREAK case 60: YY_RULE_SETUP -#line 246 "program_lexer.l" +#line 246 "program/program_lexer.l" { return_opcode(require_NV_fp, SCALAR_OP, UP2H, 4); } YY_BREAK case 61: YY_RULE_SETUP -#line 247 "program_lexer.l" +#line 247 "program/program_lexer.l" { return_opcode(require_NV_fp, SCALAR_OP, UP2US, 5); } YY_BREAK case 62: YY_RULE_SETUP -#line 248 "program_lexer.l" +#line 248 "program/program_lexer.l" { return_opcode(require_NV_fp, SCALAR_OP, UP4B, 4); } YY_BREAK case 63: YY_RULE_SETUP -#line 249 "program_lexer.l" +#line 249 "program/program_lexer.l" { return_opcode(require_NV_fp, SCALAR_OP, UP4UB, 5); } YY_BREAK case 64: YY_RULE_SETUP -#line 251 "program_lexer.l" +#line 251 "program/program_lexer.l" { return_opcode(require_NV_fp, TRI_OP, X2D, 3); } YY_BREAK case 65: YY_RULE_SETUP -#line 252 "program_lexer.l" +#line 252 "program/program_lexer.l" { return_opcode( 1, BIN_OP, XPD, 3); } YY_BREAK case 66: YY_RULE_SETUP -#line 254 "program_lexer.l" +#line 254 "program/program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_vp, VERTEX); } YY_BREAK case 67: YY_RULE_SETUP -#line 255 "program_lexer.l" +#line 255 "program/program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp, FRAGMENT); } YY_BREAK case 68: YY_RULE_SETUP -#line 256 "program_lexer.l" +#line 256 "program/program_lexer.l" { return PROGRAM; } YY_BREAK case 69: YY_RULE_SETUP -#line 257 "program_lexer.l" +#line 257 "program/program_lexer.l" { return STATE; } YY_BREAK case 70: YY_RULE_SETUP -#line 258 "program_lexer.l" +#line 258 "program/program_lexer.l" { return RESULT; } YY_BREAK case 71: YY_RULE_SETUP -#line 260 "program_lexer.l" +#line 260 "program/program_lexer.l" { return AMBIENT; } YY_BREAK case 72: YY_RULE_SETUP -#line 261 "program_lexer.l" +#line 261 "program/program_lexer.l" { return ATTENUATION; } YY_BREAK case 73: YY_RULE_SETUP -#line 262 "program_lexer.l" +#line 262 "program/program_lexer.l" { return BACK; } YY_BREAK case 74: YY_RULE_SETUP -#line 263 "program_lexer.l" +#line 263 "program/program_lexer.l" { return_token_or_DOT(require_ARB_vp, CLIP); } YY_BREAK case 75: YY_RULE_SETUP -#line 264 "program_lexer.l" +#line 264 "program/program_lexer.l" { return COLOR; } YY_BREAK case 76: YY_RULE_SETUP -#line 265 "program_lexer.l" +#line 265 "program/program_lexer.l" { return_token_or_DOT(require_ARB_fp, DEPTH); } YY_BREAK case 77: YY_RULE_SETUP -#line 266 "program_lexer.l" +#line 266 "program/program_lexer.l" { return DIFFUSE; } YY_BREAK case 78: YY_RULE_SETUP -#line 267 "program_lexer.l" +#line 267 "program/program_lexer.l" { return DIRECTION; } YY_BREAK case 79: YY_RULE_SETUP -#line 268 "program_lexer.l" +#line 268 "program/program_lexer.l" { return EMISSION; } YY_BREAK case 80: YY_RULE_SETUP -#line 269 "program_lexer.l" +#line 269 "program/program_lexer.l" { return ENV; } YY_BREAK case 81: YY_RULE_SETUP -#line 270 "program_lexer.l" +#line 270 "program/program_lexer.l" { return EYE; } YY_BREAK case 82: YY_RULE_SETUP -#line 271 "program_lexer.l" +#line 271 "program/program_lexer.l" { return FOGCOORD; } YY_BREAK case 83: YY_RULE_SETUP -#line 272 "program_lexer.l" +#line 272 "program/program_lexer.l" { return FOG; } YY_BREAK case 84: YY_RULE_SETUP -#line 273 "program_lexer.l" +#line 273 "program/program_lexer.l" { return FRONT; } YY_BREAK case 85: YY_RULE_SETUP -#line 274 "program_lexer.l" +#line 274 "program/program_lexer.l" { return HALF; } YY_BREAK case 86: YY_RULE_SETUP -#line 275 "program_lexer.l" +#line 275 "program/program_lexer.l" { return INVERSE; } YY_BREAK case 87: YY_RULE_SETUP -#line 276 "program_lexer.l" +#line 276 "program/program_lexer.l" { return INVTRANS; } YY_BREAK case 88: YY_RULE_SETUP -#line 277 "program_lexer.l" +#line 277 "program/program_lexer.l" { return LIGHT; } YY_BREAK case 89: YY_RULE_SETUP -#line 278 "program_lexer.l" +#line 278 "program/program_lexer.l" { return LIGHTMODEL; } YY_BREAK case 90: YY_RULE_SETUP -#line 279 "program_lexer.l" +#line 279 "program/program_lexer.l" { return LIGHTPROD; } YY_BREAK case 91: YY_RULE_SETUP -#line 280 "program_lexer.l" +#line 280 "program/program_lexer.l" { return LOCAL; } YY_BREAK case 92: YY_RULE_SETUP -#line 281 "program_lexer.l" +#line 281 "program/program_lexer.l" { return MATERIAL; } YY_BREAK case 93: YY_RULE_SETUP -#line 282 "program_lexer.l" +#line 282 "program/program_lexer.l" { return MAT_PROGRAM; } YY_BREAK case 94: YY_RULE_SETUP -#line 283 "program_lexer.l" +#line 283 "program/program_lexer.l" { return MATRIX; } YY_BREAK case 95: YY_RULE_SETUP -#line 284 "program_lexer.l" +#line 284 "program/program_lexer.l" { return_token_or_DOT(require_ARB_vp, MATRIXINDEX); } YY_BREAK case 96: YY_RULE_SETUP -#line 285 "program_lexer.l" +#line 285 "program/program_lexer.l" { return MODELVIEW; } YY_BREAK case 97: YY_RULE_SETUP -#line 286 "program_lexer.l" +#line 286 "program/program_lexer.l" { return MVP; } YY_BREAK case 98: YY_RULE_SETUP -#line 287 "program_lexer.l" +#line 287 "program/program_lexer.l" { return_token_or_DOT(require_ARB_vp, NORMAL); } YY_BREAK case 99: YY_RULE_SETUP -#line 288 "program_lexer.l" +#line 288 "program/program_lexer.l" { return OBJECT; } YY_BREAK case 100: YY_RULE_SETUP -#line 289 "program_lexer.l" +#line 289 "program/program_lexer.l" { return PALETTE; } YY_BREAK case 101: YY_RULE_SETUP -#line 290 "program_lexer.l" +#line 290 "program/program_lexer.l" { return PARAMS; } YY_BREAK case 102: YY_RULE_SETUP -#line 291 "program_lexer.l" +#line 291 "program/program_lexer.l" { return PLANE; } YY_BREAK case 103: YY_RULE_SETUP -#line 292 "program_lexer.l" +#line 292 "program/program_lexer.l" { return_token_or_DOT(require_ARB_vp, POINT_TOK); } YY_BREAK case 104: YY_RULE_SETUP -#line 293 "program_lexer.l" +#line 293 "program/program_lexer.l" { return_token_or_DOT(require_ARB_vp, POINTSIZE); } YY_BREAK case 105: YY_RULE_SETUP -#line 294 "program_lexer.l" +#line 294 "program/program_lexer.l" { return POSITION; } YY_BREAK case 106: YY_RULE_SETUP -#line 295 "program_lexer.l" +#line 295 "program/program_lexer.l" { return PRIMARY; } YY_BREAK case 107: YY_RULE_SETUP -#line 296 "program_lexer.l" +#line 296 "program/program_lexer.l" { return PROJECTION; } YY_BREAK case 108: YY_RULE_SETUP -#line 297 "program_lexer.l" +#line 297 "program/program_lexer.l" { return_token_or_DOT(require_ARB_fp, RANGE); } YY_BREAK case 109: YY_RULE_SETUP -#line 298 "program_lexer.l" +#line 298 "program/program_lexer.l" { return ROW; } YY_BREAK case 110: YY_RULE_SETUP -#line 299 "program_lexer.l" +#line 299 "program/program_lexer.l" { return SCENECOLOR; } YY_BREAK case 111: YY_RULE_SETUP -#line 300 "program_lexer.l" +#line 300 "program/program_lexer.l" { return SECONDARY; } YY_BREAK case 112: YY_RULE_SETUP -#line 301 "program_lexer.l" +#line 301 "program/program_lexer.l" { return SHININESS; } YY_BREAK case 113: YY_RULE_SETUP -#line 302 "program_lexer.l" +#line 302 "program/program_lexer.l" { return_token_or_DOT(require_ARB_vp, SIZE_TOK); } YY_BREAK case 114: YY_RULE_SETUP -#line 303 "program_lexer.l" +#line 303 "program/program_lexer.l" { return SPECULAR; } YY_BREAK case 115: YY_RULE_SETUP -#line 304 "program_lexer.l" +#line 304 "program/program_lexer.l" { return SPOT; } YY_BREAK case 116: YY_RULE_SETUP -#line 305 "program_lexer.l" +#line 305 "program/program_lexer.l" { return TEXCOORD; } YY_BREAK case 117: YY_RULE_SETUP -#line 306 "program_lexer.l" +#line 306 "program/program_lexer.l" { return_token_or_DOT(require_ARB_fp, TEXENV); } YY_BREAK case 118: YY_RULE_SETUP -#line 307 "program_lexer.l" +#line 307 "program/program_lexer.l" { return_token_or_DOT(require_ARB_vp, TEXGEN); } YY_BREAK case 119: YY_RULE_SETUP -#line 308 "program_lexer.l" +#line 308 "program/program_lexer.l" { return_token_or_DOT(require_ARB_vp, TEXGEN_Q); } YY_BREAK case 120: YY_RULE_SETUP -#line 309 "program_lexer.l" +#line 309 "program/program_lexer.l" { return_token_or_DOT(require_ARB_vp, TEXGEN_S); } YY_BREAK case 121: YY_RULE_SETUP -#line 310 "program_lexer.l" +#line 310 "program/program_lexer.l" { return_token_or_DOT(require_ARB_vp, TEXGEN_T); } YY_BREAK case 122: YY_RULE_SETUP -#line 311 "program_lexer.l" +#line 311 "program/program_lexer.l" { return TEXTURE; } YY_BREAK case 123: YY_RULE_SETUP -#line 312 "program_lexer.l" +#line 312 "program/program_lexer.l" { return TRANSPOSE; } YY_BREAK case 124: YY_RULE_SETUP -#line 313 "program_lexer.l" +#line 313 "program/program_lexer.l" { return_token_or_DOT(require_ARB_vp, VTXATTRIB); } YY_BREAK case 125: YY_RULE_SETUP -#line 314 "program_lexer.l" +#line 314 "program/program_lexer.l" { return_token_or_DOT(require_ARB_vp, WEIGHT); } YY_BREAK case 126: YY_RULE_SETUP -#line 316 "program_lexer.l" +#line 316 "program/program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp, TEXTURE_UNIT); } YY_BREAK case 127: YY_RULE_SETUP -#line 317 "program_lexer.l" +#line 317 "program/program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp, TEX_1D); } YY_BREAK case 128: YY_RULE_SETUP -#line 318 "program_lexer.l" +#line 318 "program/program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp, TEX_2D); } YY_BREAK case 129: YY_RULE_SETUP -#line 319 "program_lexer.l" +#line 319 "program/program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp, TEX_3D); } YY_BREAK case 130: YY_RULE_SETUP -#line 320 "program_lexer.l" +#line 320 "program/program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp, TEX_CUBE); } YY_BREAK case 131: YY_RULE_SETUP -#line 321 "program_lexer.l" +#line 321 "program/program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_rect, TEX_RECT); } YY_BREAK case 132: YY_RULE_SETUP -#line 322 "program_lexer.l" +#line 322 "program/program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_shadow, TEX_SHADOW1D); } YY_BREAK case 133: YY_RULE_SETUP -#line 323 "program_lexer.l" +#line 323 "program/program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_shadow, TEX_SHADOW2D); } YY_BREAK case 134: YY_RULE_SETUP -#line 324 "program_lexer.l" +#line 324 "program/program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_shadow && require_rect, TEX_SHADOWRECT); } YY_BREAK case 135: YY_RULE_SETUP -#line 325 "program_lexer.l" +#line 325 "program/program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_texarray, TEX_ARRAY1D); } YY_BREAK case 136: YY_RULE_SETUP -#line 326 "program_lexer.l" +#line 326 "program/program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_texarray, TEX_ARRAY2D); } YY_BREAK case 137: YY_RULE_SETUP -#line 327 "program_lexer.l" +#line 327 "program/program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_shadow && require_texarray, TEX_ARRAYSHADOW1D); } YY_BREAK case 138: YY_RULE_SETUP -#line 328 "program_lexer.l" +#line 328 "program/program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_shadow && require_texarray, TEX_ARRAYSHADOW2D); } YY_BREAK case 139: YY_RULE_SETUP -#line 330 "program_lexer.l" +#line 330 "program/program_lexer.l" { return handle_ident(yyextra, yytext, yylval); } YY_BREAK case 140: YY_RULE_SETUP -#line 332 "program_lexer.l" +#line 332 "program/program_lexer.l" { return DOT_DOT; } YY_BREAK case 141: YY_RULE_SETUP -#line 334 "program_lexer.l" +#line 334 "program/program_lexer.l" { yylval->integer = strtol(yytext, NULL, 10); return INTEGER; @@ -2222,7 +2209,7 @@ YY_RULE_SETUP YY_BREAK case 142: YY_RULE_SETUP -#line 338 "program_lexer.l" +#line 338 "program/program_lexer.l" { yylval->real = _mesa_strtof(yytext, NULL); return REAL; @@ -2234,7 +2221,7 @@ case 143: yyg->yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 342 "program_lexer.l" +#line 342 "program/program_lexer.l" { yylval->real = _mesa_strtof(yytext, NULL); return REAL; @@ -2242,7 +2229,7 @@ YY_RULE_SETUP YY_BREAK case 144: YY_RULE_SETUP -#line 346 "program_lexer.l" +#line 346 "program/program_lexer.l" { yylval->real = _mesa_strtof(yytext, NULL); return REAL; @@ -2250,7 +2237,7 @@ YY_RULE_SETUP YY_BREAK case 145: YY_RULE_SETUP -#line 350 "program_lexer.l" +#line 350 "program/program_lexer.l" { yylval->real = _mesa_strtof(yytext, NULL); return REAL; @@ -2258,7 +2245,7 @@ YY_RULE_SETUP YY_BREAK case 146: YY_RULE_SETUP -#line 355 "program_lexer.l" +#line 355 "program/program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_NOOP; yylval->swiz_mask.mask = WRITEMASK_XYZW; @@ -2267,7 +2254,7 @@ YY_RULE_SETUP YY_BREAK case 147: YY_RULE_SETUP -#line 361 "program_lexer.l" +#line 361 "program/program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_XY @@ -2277,7 +2264,7 @@ YY_RULE_SETUP YY_BREAK case 148: YY_RULE_SETUP -#line 367 "program_lexer.l" +#line 367 "program/program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_XZW; @@ -2286,7 +2273,7 @@ YY_RULE_SETUP YY_BREAK case 149: YY_RULE_SETUP -#line 372 "program_lexer.l" +#line 372 "program/program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_YZW; @@ -2295,7 +2282,7 @@ YY_RULE_SETUP YY_BREAK case 150: YY_RULE_SETUP -#line 378 "program_lexer.l" +#line 378 "program/program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_X @@ -2305,7 +2292,7 @@ YY_RULE_SETUP YY_BREAK case 151: YY_RULE_SETUP -#line 384 "program_lexer.l" +#line 384 "program/program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_Y @@ -2315,7 +2302,7 @@ YY_RULE_SETUP YY_BREAK case 152: YY_RULE_SETUP -#line 390 "program_lexer.l" +#line 390 "program/program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_ZW; @@ -2324,7 +2311,7 @@ YY_RULE_SETUP YY_BREAK case 153: YY_RULE_SETUP -#line 396 "program_lexer.l" +#line 396 "program/program_lexer.l" { const unsigned s = swiz_from_char(yytext[1]); yylval->swiz_mask.swizzle = MAKE_SWIZZLE4(s, s, s, s); @@ -2334,7 +2321,7 @@ YY_RULE_SETUP YY_BREAK case 154: YY_RULE_SETUP -#line 403 "program_lexer.l" +#line 403 "program/program_lexer.l" { yylval->swiz_mask.swizzle = MAKE_SWIZZLE4(swiz_from_char(yytext[1]), swiz_from_char(yytext[2]), @@ -2346,7 +2333,7 @@ YY_RULE_SETUP YY_BREAK case 155: YY_RULE_SETUP -#line 412 "program_lexer.l" +#line 412 "program/program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_NOOP; yylval->swiz_mask.mask = WRITEMASK_XYZW; @@ -2355,7 +2342,7 @@ YY_RULE_SETUP YY_BREAK case 156: YY_RULE_SETUP -#line 418 "program_lexer.l" +#line 418 "program/program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_XY @@ -2365,7 +2352,7 @@ YY_RULE_SETUP YY_BREAK case 157: YY_RULE_SETUP -#line 424 "program_lexer.l" +#line 424 "program/program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_XZW; @@ -2374,7 +2361,7 @@ YY_RULE_SETUP YY_BREAK case 158: YY_RULE_SETUP -#line 429 "program_lexer.l" +#line 429 "program/program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_YZW; @@ -2383,7 +2370,7 @@ YY_RULE_SETUP YY_BREAK case 159: YY_RULE_SETUP -#line 435 "program_lexer.l" +#line 435 "program/program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_X @@ -2393,7 +2380,7 @@ YY_RULE_SETUP YY_BREAK case 160: YY_RULE_SETUP -#line 441 "program_lexer.l" +#line 441 "program/program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_Y @@ -2403,7 +2390,7 @@ YY_RULE_SETUP YY_BREAK case 161: YY_RULE_SETUP -#line 447 "program_lexer.l" +#line 447 "program/program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_ZW; @@ -2412,7 +2399,7 @@ YY_RULE_SETUP YY_BREAK case 162: YY_RULE_SETUP -#line 453 "program_lexer.l" +#line 453 "program/program_lexer.l" { const unsigned s = swiz_from_char(yytext[1]); yylval->swiz_mask.swizzle = MAKE_SWIZZLE4(s, s, s, s); @@ -2422,7 +2409,7 @@ YY_RULE_SETUP YY_BREAK case 163: YY_RULE_SETUP -#line 461 "program_lexer.l" +#line 461 "program/program_lexer.l" { if (require_ARB_vp) { return TEXGEN_R; @@ -2436,7 +2423,7 @@ YY_RULE_SETUP YY_BREAK case 164: YY_RULE_SETUP -#line 472 "program_lexer.l" +#line 472 "program/program_lexer.l" { yylval->swiz_mask.swizzle = MAKE_SWIZZLE4(swiz_from_char(yytext[1]), swiz_from_char(yytext[2]), @@ -2448,13 +2435,13 @@ YY_RULE_SETUP YY_BREAK case 165: YY_RULE_SETUP -#line 481 "program_lexer.l" +#line 481 "program/program_lexer.l" { return DOT; } YY_BREAK case 166: /* rule 166 can match eol */ YY_RULE_SETUP -#line 483 "program_lexer.l" +#line 483 "program/program_lexer.l" { yylloc->first_line++; yylloc->first_column = 1; @@ -2465,7 +2452,7 @@ YY_RULE_SETUP YY_BREAK case 167: YY_RULE_SETUP -#line 490 "program_lexer.l" +#line 490 "program/program_lexer.l" /* eat whitespace */ ; YY_BREAK case 168: @@ -2473,20 +2460,20 @@ case 168: yyg->yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 491 "program_lexer.l" +#line 491 "program/program_lexer.l" /* eat comments */ ; YY_BREAK case 169: YY_RULE_SETUP -#line 492 "program_lexer.l" +#line 492 "program/program_lexer.l" { return yytext[0]; } YY_BREAK case 170: YY_RULE_SETUP -#line 493 "program_lexer.l" +#line 493 "program/program_lexer.l" ECHO; YY_BREAK -#line 2490 "lex.yy.c" +#line 2477 "program/lex.yy.c" case YY_STATE_EOF(INITIAL): yyterminate(); @@ -2673,7 +2660,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) else { - int num_to_read = + yy_size_t num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) @@ -2687,7 +2674,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) if ( b->yy_is_our_buffer ) { - int new_size = b->yy_buf_size * 2; + yy_size_t new_size = b->yy_buf_size * 2; if ( new_size <= 0 ) b->yy_buf_size += b->yy_buf_size / 8; @@ -2718,7 +2705,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) /* Read in more data. */ YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), - yyg->yy_n_chars, (size_t) num_to_read ); + yyg->yy_n_chars, num_to_read ); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; } @@ -2831,7 +2818,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) { /* need to shift things up to make room */ /* +2 for EOB chars. */ - register int number_to_move = yyg->yy_n_chars + 2; + register yy_size_t number_to_move = yyg->yy_n_chars + 2; register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; register char *source = @@ -2881,7 +2868,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) else { /* need more input */ - int offset = yyg->yy_c_buf_p - yyg->yytext_ptr; + yy_size_t offset = yyg->yy_c_buf_p - yyg->yytext_ptr; ++yyg->yy_c_buf_p; switch ( yy_get_next_buffer( yyscanner ) ) @@ -2905,7 +2892,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) case EOB_ACT_END_OF_FILE: { if ( yywrap(yyscanner ) ) - return EOF; + return 0; if ( ! yyg->yy_did_buffer_switch_on_eof ) YY_NEW_FILE; @@ -3161,7 +3148,7 @@ void yypop_buffer_state (yyscan_t yyscanner) */ static void yyensure_buffer_stack (yyscan_t yyscanner) { - int num_to_alloc; + yy_size_t num_to_alloc; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; if (!yyg->yy_buffer_stack) { @@ -3254,17 +3241,16 @@ YY_BUFFER_STATE yy_scan_string (yyconst char * yystr , yyscan_t yyscanner) /** Setup the input buffer state to scan the given bytes. The next call to yylex() will * scan from a @e copy of @a bytes. - * @param yybytes the byte buffer to scan - * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. + * @param bytes the byte buffer to scan + * @param len the number of bytes in the buffer pointed to by @a bytes. * @param yyscanner The scanner object. * @return the newly allocated buffer state object. */ -YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len , yyscan_t yyscanner) +YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len , yyscan_t yyscanner) { YY_BUFFER_STATE b; char *buf; - yy_size_t n; - int i; + yy_size_t n, i; /* Get memory for full buffer, including space for trailing EOB's. */ n = _yybytes_len + 2; @@ -3374,7 +3360,7 @@ FILE *yyget_out (yyscan_t yyscanner) /** Get the length of the current token. * @param yyscanner The scanner object. */ -int yyget_leng (yyscan_t yyscanner) +yy_size_t yyget_leng (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return yyleng; @@ -3661,7 +3647,7 @@ void yyfree (void * ptr , yyscan_t yyscanner) #define YYTABLES_NAME "yytables" -#line 493 "program_lexer.l" +#line 493 "program/program_lexer.l" diff --git a/src/mesa/program/nvfragparse.h b/src/mesa/program/nvfragparse.h index 3e85dd2c30..088e7527d5 100644 --- a/src/mesa/program/nvfragparse.h +++ b/src/mesa/program/nvfragparse.h @@ -30,7 +30,10 @@ #ifndef NVFRAGPARSE_H #define NVFRAGPARSE_H -#include "main/mtypes.h" +#include "main/glheader.h" + +struct gl_context; +struct gl_fragment_program; extern void _mesa_parse_nv_fragment_program(struct gl_context *ctx, GLenum target, diff --git a/src/mesa/program/nvvertparse.h b/src/mesa/program/nvvertparse.h index e98e867320..7318e14941 100644 --- a/src/mesa/program/nvvertparse.h +++ b/src/mesa/program/nvvertparse.h @@ -29,7 +29,10 @@ #ifndef NVVERTPARSE_H #define NVVERTPARSE_H -#include "main/mtypes.h" +#include "main/glheader.h" + +struct gl_context; +struct gl_vertex_program; extern void _mesa_parse_nv_vertex_program(struct gl_context *ctx, GLenum target, diff --git a/src/mesa/program/prog_cache.c b/src/mesa/program/prog_cache.c index 56ca59890d..2ccedb5d7d 100644 --- a/src/mesa/program/prog_cache.c +++ b/src/mesa/program/prog_cache.c @@ -29,6 +29,7 @@ #include "main/glheader.h" #include "main/mtypes.h" #include "main/imports.h" +#include "main/shaderobj.h" #include "program/prog_cache.h" #include "program/program.h" @@ -104,7 +105,8 @@ rehash(struct gl_program_cache *cache) static void -clear_cache(struct gl_context *ctx, struct gl_program_cache *cache) +clear_cache(struct gl_context *ctx, struct gl_program_cache *cache, + GLboolean shader) { struct cache_item *c, *next; GLuint i; @@ -115,7 +117,13 @@ clear_cache(struct gl_context *ctx, struct gl_program_cache *cache) for (c = cache->items[i]; c; c = next) { next = c->next; free(c->key); - _mesa_reference_program(ctx, &c->program, NULL); + if (shader) { + _mesa_reference_shader_program(ctx, + (struct gl_shader_program **)&c->program, + NULL); + } else { + _mesa_reference_program(ctx, &c->program, NULL); + } free(c); } cache->items[i] = NULL; @@ -147,7 +155,16 @@ _mesa_new_program_cache(void) void _mesa_delete_program_cache(struct gl_context *ctx, struct gl_program_cache *cache) { - clear_cache(ctx, cache); + clear_cache(ctx, cache, GL_FALSE); + free(cache->items); + free(cache); +} + +void +_mesa_delete_shader_cache(struct gl_context *ctx, + struct gl_program_cache *cache) +{ + clear_cache(ctx, cache, GL_TRUE); free(cache->items); free(cache); } @@ -197,7 +214,35 @@ _mesa_program_cache_insert(struct gl_context *ctx, if (cache->size < 1000) rehash(cache); else - clear_cache(ctx, cache); + clear_cache(ctx, cache, GL_FALSE); + } + + cache->n_items++; + c->next = cache->items[hash % cache->size]; + cache->items[hash % cache->size] = c; +} + +void +_mesa_shader_cache_insert(struct gl_context *ctx, + struct gl_program_cache *cache, + const void *key, GLuint keysize, + struct gl_shader_program *program) +{ + const GLuint hash = hash_key(key, keysize); + struct cache_item *c = CALLOC_STRUCT(cache_item); + + c->hash = hash; + + c->key = malloc(keysize); + memcpy(c->key, key, keysize); + + c->program = (struct gl_program *)program; /* no refcount change */ + + if (cache->n_items > cache->size * 1.5) { + if (cache->size < 1000) + rehash(cache); + else + clear_cache(ctx, cache, GL_TRUE); } cache->n_items++; diff --git a/src/mesa/program/prog_cache.h b/src/mesa/program/prog_cache.h index 4907ae3030..5d46bfc5cc 100644 --- a/src/mesa/program/prog_cache.h +++ b/src/mesa/program/prog_cache.h @@ -30,8 +30,9 @@ #define PROG_CACHE_H -#include "main/mtypes.h" +#include "main/glheader.h" +struct gl_context; /** Opaque type */ struct gl_program_cache; @@ -43,6 +44,9 @@ _mesa_new_program_cache(void); extern void _mesa_delete_program_cache(struct gl_context *ctx, struct gl_program_cache *pc); +extern void +_mesa_delete_shader_cache(struct gl_context *ctx, + struct gl_program_cache *cache); extern struct gl_program * _mesa_search_program_cache(struct gl_program_cache *cache, @@ -54,5 +58,11 @@ _mesa_program_cache_insert(struct gl_context *ctx, const void *key, GLuint keysize, struct gl_program *program); +void +_mesa_shader_cache_insert(struct gl_context *ctx, + struct gl_program_cache *cache, + const void *key, GLuint keysize, + struct gl_shader_program *program); + #endif /* PROG_CACHE_H */ diff --git a/src/mesa/program/prog_execute.c b/src/mesa/program/prog_execute.c index 1d97a077f5..e7553c69db 100644 --- a/src/mesa/program/prog_execute.c +++ b/src/mesa/program/prog_execute.c @@ -159,6 +159,10 @@ get_src_register_pointer(const struct prog_src_register *source, return ZeroVec; return prog->Parameters->ParameterValues[reg]; + case PROGRAM_SYSTEM_VALUE: + assert(reg < Elements(machine->SystemValues)); + return machine->SystemValues[reg]; + default: _mesa_problem(NULL, "Invalid src register file %d in get_src_register_pointer()", @@ -1670,6 +1674,18 @@ _mesa_execute_program(struct gl_context * ctx, fetch_texel(ctx, machine, inst, texcoord, lodBias, color); + if (DEBUG_PROG) { + printf("TXB (%g, %g, %g, %g) = texture[%d][%g %g %g %g]" + " bias %g\n", + color[0], color[1], color[2], color[3], + inst->TexSrcUnit, + texcoord[0], + texcoord[1], + texcoord[2], + texcoord[3], + lodBias); + } + store_vector4(inst, machine, color); } break; diff --git a/src/mesa/program/prog_execute.h b/src/mesa/program/prog_execute.h index cefd468c36..cdf37082a0 100644 --- a/src/mesa/program/prog_execute.h +++ b/src/mesa/program/prog_execute.h @@ -61,6 +61,7 @@ struct gl_program_machine GLfloat (*EnvParams)[4]; /**< Vertex or Fragment env parameters */ GLuint CondCodes[4]; /**< COND_* value for x/y/z/w */ GLint AddressReg[MAX_PROGRAM_ADDRESS_REGS][4]; + GLfloat SystemValues[SYSTEM_VALUE_MAX][4]; const GLubyte *Samplers; /** Array mapping sampler var to tex unit */ diff --git a/src/mesa/program/prog_instruction.h b/src/mesa/program/prog_instruction.h index a383828e34..669d710298 100644 --- a/src/mesa/program/prog_instruction.h +++ b/src/mesa/program/prog_instruction.h @@ -247,7 +247,7 @@ typedef enum prog_opcode { * Number of bits for the src/dst register Index field. * This limits the size of temp/uniform register files. */ -#define INST_INDEX_BITS 11 +#define INST_INDEX_BITS 12 /** diff --git a/src/mesa/program/prog_optimize.h b/src/mesa/program/prog_optimize.h index 00f1080449..463f5fc51c 100644 --- a/src/mesa/program/prog_optimize.h +++ b/src/mesa/program/prog_optimize.h @@ -27,9 +27,10 @@ #include "main/config.h" -#include "main/mtypes.h" +#include "main/glheader.h" +struct gl_context; struct gl_program; struct prog_instruction; diff --git a/src/mesa/program/prog_print.c b/src/mesa/program/prog_print.c index abebf392c0..484596af76 100644 --- a/src/mesa/program/prog_print.c +++ b/src/mesa/program/prog_print.c @@ -72,6 +72,8 @@ _mesa_register_file_name(gl_register_file f) return "ADDR"; case PROGRAM_SAMPLER: return "SAMPLER"; + case PROGRAM_SYSTEM_VALUE: + return "SYSVAL"; case PROGRAM_UNDEFINED: return "UNDEFINED"; default: @@ -310,6 +312,9 @@ reg_string(gl_register_file f, GLint index, gl_prog_print_mode mode, case PROGRAM_UNIFORM: /* extension */ sprintf(str, "uniform[%s%d]", addr, index); break; + case PROGRAM_SYSTEM_VALUE: + sprintf(str, "sysvalue[%s%d]", addr, index); + break; case PROGRAM_STATE_VAR: { struct gl_program_parameter *param diff --git a/src/mesa/program/prog_statevars.h b/src/mesa/program/prog_statevars.h index 009ebde001..f2407af9c8 100644 --- a/src/mesa/program/prog_statevars.h +++ b/src/mesa/program/prog_statevars.h @@ -25,8 +25,10 @@ #ifndef PROG_STATEVARS_H #define PROG_STATEVARS_H -#include "main/mtypes.h" +#include "main/glheader.h" +struct gl_context; +struct gl_program_parameter_list; /** * Number of STATE_* values we need to address any GL state. diff --git a/src/mesa/program/program.c b/src/mesa/program/program.c index 9ffa49bb01..79034ab26f 100644 --- a/src/mesa/program/program.c +++ b/src/mesa/program/program.c @@ -32,6 +32,7 @@ #include "main/glheader.h" #include "main/context.h" #include "main/hash.h" +#include "main/mfeatures.h" #include "program.h" #include "prog_cache.h" #include "prog_parameter.h" @@ -70,6 +71,9 @@ _mesa_init_program(struct gl_context *ctx) ASSERT(ctx->Const.VertexProgram.MaxUniformComponents <= 4 * MAX_UNIFORMS); ASSERT(ctx->Const.FragmentProgram.MaxUniformComponents <= 4 * MAX_UNIFORMS); + ASSERT(ctx->Const.VertexProgram.MaxAddressOffset <= (1 << INST_INDEX_BITS)); + ASSERT(ctx->Const.FragmentProgram.MaxAddressOffset <= (1 << INST_INDEX_BITS)); + /* If this fails, increase prog_instruction::TexSrcUnit size */ ASSERT(MAX_TEXTURE_UNITS < (1 << 5)); @@ -807,7 +811,7 @@ _mesa_combine_programs(struct gl_context *ctx, /* Connect color outputs of fprogA to color inputs of fprogB, via a * new temporary register. */ - if ((progA->OutputsWritten & (1 << FRAG_RESULT_COLOR)) && + if ((progA->OutputsWritten & BITFIELD64_BIT(FRAG_RESULT_COLOR)) && (progB_inputsRead & FRAG_BIT_COL0)) { GLint tempReg = _mesa_find_free_register(usedTemps, MAX_PROGRAM_TEMPS, firstTemp); @@ -830,7 +834,7 @@ _mesa_combine_programs(struct gl_context *ctx, /* compute combined program's InputsRead */ inputsB = progB_inputsRead; - if (progA->OutputsWritten & (1 << FRAG_RESULT_COLOR)) { + if (progA->OutputsWritten & BITFIELD64_BIT(FRAG_RESULT_COLOR)) { inputsB &= ~(1 << FRAG_ATTRIB_COL0); } newProg->InputsRead = progA->InputsRead | inputsB; diff --git a/src/mesa/program/program_parse.tab.c b/src/mesa/program/program_parse.tab.c index baef311d0c..63a635dfda 100644 --- a/src/mesa/program/program_parse.tab.c +++ b/src/mesa/program/program_parse.tab.c @@ -1,23 +1,24 @@ - -/* A Bison parser, made by GNU Bison 2.4.1. */ +/* A Bison parser, made by GNU Bison 2.3. */ /* Skeleton implementation for Bison's Yacc-like parsers in C - - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify + + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - + the Free Software Foundation; either version 2, or (at your option) + any later version. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -28,7 +29,7 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ @@ -46,7 +47,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.4.1" +#define YYBISON_VERSION "2.3" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -54,21 +55,236 @@ /* Pure parsers. */ #define YYPURE 1 -/* Push parsers. */ -#define YYPUSH 0 - -/* Pull parsers. */ -#define YYPULL 1 - /* Using locations. */ #define YYLSP_NEEDED 1 -/* Copy the first part of user declarations. */ +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + ARBvp_10 = 258, + ARBfp_10 = 259, + ADDRESS = 260, + ALIAS = 261, + ATTRIB = 262, + OPTION = 263, + OUTPUT = 264, + PARAM = 265, + TEMP = 266, + END = 267, + BIN_OP = 268, + BINSC_OP = 269, + SAMPLE_OP = 270, + SCALAR_OP = 271, + TRI_OP = 272, + VECTOR_OP = 273, + ARL = 274, + KIL = 275, + SWZ = 276, + TXD_OP = 277, + INTEGER = 278, + REAL = 279, + AMBIENT = 280, + ATTENUATION = 281, + BACK = 282, + CLIP = 283, + COLOR = 284, + DEPTH = 285, + DIFFUSE = 286, + DIRECTION = 287, + EMISSION = 288, + ENV = 289, + EYE = 290, + FOG = 291, + FOGCOORD = 292, + FRAGMENT = 293, + FRONT = 294, + HALF = 295, + INVERSE = 296, + INVTRANS = 297, + LIGHT = 298, + LIGHTMODEL = 299, + LIGHTPROD = 300, + LOCAL = 301, + MATERIAL = 302, + MAT_PROGRAM = 303, + MATRIX = 304, + MATRIXINDEX = 305, + MODELVIEW = 306, + MVP = 307, + NORMAL = 308, + OBJECT = 309, + PALETTE = 310, + PARAMS = 311, + PLANE = 312, + POINT_TOK = 313, + POINTSIZE = 314, + POSITION = 315, + PRIMARY = 316, + PROGRAM = 317, + PROJECTION = 318, + RANGE = 319, + RESULT = 320, + ROW = 321, + SCENECOLOR = 322, + SECONDARY = 323, + SHININESS = 324, + SIZE_TOK = 325, + SPECULAR = 326, + SPOT = 327, + STATE = 328, + TEXCOORD = 329, + TEXENV = 330, + TEXGEN = 331, + TEXGEN_Q = 332, + TEXGEN_R = 333, + TEXGEN_S = 334, + TEXGEN_T = 335, + TEXTURE = 336, + TRANSPOSE = 337, + TEXTURE_UNIT = 338, + TEX_1D = 339, + TEX_2D = 340, + TEX_3D = 341, + TEX_CUBE = 342, + TEX_RECT = 343, + TEX_SHADOW1D = 344, + TEX_SHADOW2D = 345, + TEX_SHADOWRECT = 346, + TEX_ARRAY1D = 347, + TEX_ARRAY2D = 348, + TEX_ARRAYSHADOW1D = 349, + TEX_ARRAYSHADOW2D = 350, + VERTEX = 351, + VTXATTRIB = 352, + WEIGHT = 353, + IDENTIFIER = 354, + USED_IDENTIFIER = 355, + MASK4 = 356, + MASK3 = 357, + MASK2 = 358, + MASK1 = 359, + SWIZZLE = 360, + DOT_DOT = 361, + DOT = 362 + }; +#endif +/* Tokens. */ +#define ARBvp_10 258 +#define ARBfp_10 259 +#define ADDRESS 260 +#define ALIAS 261 +#define ATTRIB 262 +#define OPTION 263 +#define OUTPUT 264 +#define PARAM 265 +#define TEMP 266 +#define END 267 +#define BIN_OP 268 +#define BINSC_OP 269 +#define SAMPLE_OP 270 +#define SCALAR_OP 271 +#define TRI_OP 272 +#define VECTOR_OP 273 +#define ARL 274 +#define KIL 275 +#define SWZ 276 +#define TXD_OP 277 +#define INTEGER 278 +#define REAL 279 +#define AMBIENT 280 +#define ATTENUATION 281 +#define BACK 282 +#define CLIP 283 +#define COLOR 284 +#define DEPTH 285 +#define DIFFUSE 286 +#define DIRECTION 287 +#define EMISSION 288 +#define ENV 289 +#define EYE 290 +#define FOG 291 +#define FOGCOORD 292 +#define FRAGMENT 293 +#define FRONT 294 +#define HALF 295 +#define INVERSE 296 +#define INVTRANS 297 +#define LIGHT 298 +#define LIGHTMODEL 299 +#define LIGHTPROD 300 +#define LOCAL 301 +#define MATERIAL 302 +#define MAT_PROGRAM 303 +#define MATRIX 304 +#define MATRIXINDEX 305 +#define MODELVIEW 306 +#define MVP 307 +#define NORMAL 308 +#define OBJECT 309 +#define PALETTE 310 +#define PARAMS 311 +#define PLANE 312 +#define POINT_TOK 313 +#define POINTSIZE 314 +#define POSITION 315 +#define PRIMARY 316 +#define PROGRAM 317 +#define PROJECTION 318 +#define RANGE 319 +#define RESULT 320 +#define ROW 321 +#define SCENECOLOR 322 +#define SECONDARY 323 +#define SHININESS 324 +#define SIZE_TOK 325 +#define SPECULAR 326 +#define SPOT 327 +#define STATE 328 +#define TEXCOORD 329 +#define TEXENV 330 +#define TEXGEN 331 +#define TEXGEN_Q 332 +#define TEXGEN_R 333 +#define TEXGEN_S 334 +#define TEXGEN_T 335 +#define TEXTURE 336 +#define TRANSPOSE 337 +#define TEXTURE_UNIT 338 +#define TEX_1D 339 +#define TEX_2D 340 +#define TEX_3D 341 +#define TEX_CUBE 342 +#define TEX_RECT 343 +#define TEX_SHADOW1D 344 +#define TEX_SHADOW2D 345 +#define TEX_SHADOWRECT 346 +#define TEX_ARRAY1D 347 +#define TEX_ARRAY2D 348 +#define TEX_ARRAYSHADOW1D 349 +#define TEX_ARRAYSHADOW2D 350 +#define VERTEX 351 +#define VTXATTRIB 352 +#define WEIGHT 353 +#define IDENTIFIER 354 +#define USED_IDENTIFIER 355 +#define MASK4 356 +#define MASK3 357 +#define MASK2 358 +#define MASK1 359 +#define SWIZZLE 360 +#define DOT_DOT 361 +#define DOT 362 + -/* Line 189 of yacc.c */ -#line 1 "program_parse.y" + + +/* Copy the first part of user declarations. */ +#line 1 "program/program_parse.y" /* * Copyright © 2009 Intel Corporation @@ -188,9 +404,6 @@ static struct asm_instruction *asm_instruction_copy_ctor( #define YYLEX_PARAM state->scanner -/* Line 189 of yacc.c */ -#line 193 "program_parse.tab.c" - /* Enabling traces. */ #ifndef YYDEBUG # define YYDEBUG 0 @@ -209,130 +422,10 @@ static struct asm_instruction *asm_instruction_copy_ctor( # define YYTOKEN_TABLE 0 #endif - -/* Tokens. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - ARBvp_10 = 258, - ARBfp_10 = 259, - ADDRESS = 260, - ALIAS = 261, - ATTRIB = 262, - OPTION = 263, - OUTPUT = 264, - PARAM = 265, - TEMP = 266, - END = 267, - BIN_OP = 268, - BINSC_OP = 269, - SAMPLE_OP = 270, - SCALAR_OP = 271, - TRI_OP = 272, - VECTOR_OP = 273, - ARL = 274, - KIL = 275, - SWZ = 276, - TXD_OP = 277, - INTEGER = 278, - REAL = 279, - AMBIENT = 280, - ATTENUATION = 281, - BACK = 282, - CLIP = 283, - COLOR = 284, - DEPTH = 285, - DIFFUSE = 286, - DIRECTION = 287, - EMISSION = 288, - ENV = 289, - EYE = 290, - FOG = 291, - FOGCOORD = 292, - FRAGMENT = 293, - FRONT = 294, - HALF = 295, - INVERSE = 296, - INVTRANS = 297, - LIGHT = 298, - LIGHTMODEL = 299, - LIGHTPROD = 300, - LOCAL = 301, - MATERIAL = 302, - MAT_PROGRAM = 303, - MATRIX = 304, - MATRIXINDEX = 305, - MODELVIEW = 306, - MVP = 307, - NORMAL = 308, - OBJECT = 309, - PALETTE = 310, - PARAMS = 311, - PLANE = 312, - POINT_TOK = 313, - POINTSIZE = 314, - POSITION = 315, - PRIMARY = 316, - PROGRAM = 317, - PROJECTION = 318, - RANGE = 319, - RESULT = 320, - ROW = 321, - SCENECOLOR = 322, - SECONDARY = 323, - SHININESS = 324, - SIZE_TOK = 325, - SPECULAR = 326, - SPOT = 327, - STATE = 328, - TEXCOORD = 329, - TEXENV = 330, - TEXGEN = 331, - TEXGEN_Q = 332, - TEXGEN_R = 333, - TEXGEN_S = 334, - TEXGEN_T = 335, - TEXTURE = 336, - TRANSPOSE = 337, - TEXTURE_UNIT = 338, - TEX_1D = 339, - TEX_2D = 340, - TEX_3D = 341, - TEX_CUBE = 342, - TEX_RECT = 343, - TEX_SHADOW1D = 344, - TEX_SHADOW2D = 345, - TEX_SHADOWRECT = 346, - TEX_ARRAY1D = 347, - TEX_ARRAY2D = 348, - TEX_ARRAYSHADOW1D = 349, - TEX_ARRAYSHADOW2D = 350, - VERTEX = 351, - VTXATTRIB = 352, - WEIGHT = 353, - IDENTIFIER = 354, - USED_IDENTIFIER = 355, - MASK4 = 356, - MASK3 = 357, - MASK2 = 358, - MASK1 = 359, - SWIZZLE = 360, - DOT_DOT = 361, - DOT = 362 - }; -#endif - - - #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE +#line 126 "program/program_parse.y" { - -/* Line 214 of yacc.c */ -#line 126 "program_parse.y" - struct asm_instruction *inst; struct asm_symbol *sym; struct asm_symbol temp_sym; @@ -356,15 +449,13 @@ typedef union YYSTYPE unsigned xyzw_valid:1; unsigned negate:1; } ext_swizzle; - - - -/* Line 214 of yacc.c */ -#line 364 "program_parse.tab.c" -} YYSTYPE; -# define YYSTYPE_IS_TRIVIAL 1 +} +/* Line 193 of yacc.c. */ +#line 455 "program/program_parse.tab.c" + YYSTYPE; # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 +# define YYSTYPE_IS_TRIVIAL 1 #endif #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED @@ -382,16 +473,14 @@ typedef struct YYLTYPE /* Copy the second part of user declarations. */ - -/* Line 264 of yacc.c */ -#line 271 "program_parse.y" +#line 271 "program/program_parse.y" extern int yylex(YYSTYPE *yylval_param, YYLTYPE *yylloc_param, void *yyscanner); -/* Line 264 of yacc.c */ -#line 395 "program_parse.tab.c" +/* Line 216 of yacc.c. */ +#line 484 "program/program_parse.tab.c" #ifdef short # undef short @@ -441,7 +530,7 @@ typedef short int yytype_int16; #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) #ifndef YY_ -# if YYENABLE_NLS +# if defined YYENABLE_NLS && YYENABLE_NLS # if ENABLE_NLS # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ # define YY_(msgid) dgettext ("bison-runtime", msgid) @@ -466,14 +555,14 @@ typedef short int yytype_int16; #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static int -YYID (int yyi) +YYID (int i) #else static int -YYID (yyi) - int yyi; +YYID (i) + int i; #endif { - return yyi; + return i; } #endif @@ -555,9 +644,9 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ /* A type that is properly aligned for any stack member. */ union yyalloc { - yytype_int16 yyss_alloc; - YYSTYPE yyvs_alloc; - YYLTYPE yyls_alloc; + yytype_int16 yyss; + YYSTYPE yyvs; + YYLTYPE yyls; }; /* The size of the maximum gap between one aligned stack and the next. */ @@ -592,12 +681,12 @@ union yyalloc elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ -# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ +# define YYSTACK_RELOCATE(Stack) \ do \ { \ YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ - Stack = &yyptr->Stack_alloc; \ + YYCOPY (&yyptr->Stack, Stack, yysize); \ + Stack = &yyptr->Stack; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ @@ -1349,7 +1438,7 @@ while (YYID (0)) we won't break user code: when these are the locations we know. */ #ifndef YY_LOCATION_PRINT -# if YYLTYPE_IS_TRIVIAL +# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL # define YY_LOCATION_PRINT(File, Loc) \ fprintf (File, "%d.%d-%d.%d", \ (Loc).first_line, (Loc).first_column, \ @@ -1468,20 +1557,17 @@ yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp, state) #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void -yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) +yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) #else static void -yy_stack_print (yybottom, yytop) - yytype_int16 *yybottom; - yytype_int16 *yytop; +yy_stack_print (bottom, top) + yytype_int16 *bottom; + yytype_int16 *top; #endif { YYFPRINTF (stderr, "Stack now"); - for (; yybottom <= yytop; yybottom++) - { - int yybot = *yybottom; - YYFPRINTF (stderr, " %d", yybot); - } + for (; bottom <= top; ++bottom) + YYFPRINTF (stderr, " %d", *bottom); YYFPRINTF (stderr, "\n"); } @@ -1517,11 +1603,11 @@ yy_reduce_print (yyvsp, yylsp, yyrule, state) /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { - YYFPRINTF (stderr, " $%d = ", yyi + 1); + fprintf (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], &(yyvsp[(yyi + 1) - (yynrhs)]) , &(yylsp[(yyi + 1) - (yynrhs)]) , state); - YYFPRINTF (stderr, "\n"); + fprintf (stderr, "\n"); } } @@ -1805,8 +1891,10 @@ yydestruct (yymsg, yytype, yyvaluep, yylocationp, state) break; } } + /* Prevent warnings from -Wmissing-prototypes. */ + #ifdef YYPARSE_PARAM #if defined __STDC__ || defined __cplusplus int yyparse (void *YYPARSE_PARAM); @@ -1825,9 +1913,10 @@ int yyparse (); -/*-------------------------. -| yyparse or yypush_parse. | -`-------------------------*/ + +/*----------. +| yyparse. | +`----------*/ #ifdef YYPARSE_PARAM #if (defined __STDC__ || defined __C99__FUNC__ \ @@ -1851,97 +1940,88 @@ yyparse (state) #endif #endif { -/* The lookahead symbol. */ + /* The look-ahead symbol. */ int yychar; -/* The semantic value of the lookahead symbol. */ +/* The semantic value of the look-ahead symbol. */ YYSTYPE yylval; -/* Location data for the lookahead symbol. */ +/* Number of syntax errors so far. */ +int yynerrs; +/* Location data for the look-ahead symbol. */ YYLTYPE yylloc; - /* Number of syntax errors so far. */ - int yynerrs; - - int yystate; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; + int yystate; + int yyn; + int yyresult; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + /* Look-ahead token as an internal (translated) token number. */ + int yytoken = 0; +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; +#endif - /* The stacks and their tools: - `yyss': related to states. - `yyvs': related to semantic values. - `yyls': related to locations. + /* Three stacks and their tools: + `yyss': related to states, + `yyvs': related to semantic values, + `yyls': related to locations. - Refer to the stacks thru separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ - /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16 *yyss; - yytype_int16 *yyssp; + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss = yyssa; + yytype_int16 *yyssp; - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs; - YYSTYPE *yyvsp; + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs = yyvsa; + YYSTYPE *yyvsp; - /* The location stack. */ - YYLTYPE yylsa[YYINITDEPTH]; - YYLTYPE *yyls; - YYLTYPE *yylsp; + /* The location stack. */ + YYLTYPE yylsa[YYINITDEPTH]; + YYLTYPE *yyls = yylsa; + YYLTYPE *yylsp; + /* The locations where the error started and ended. */ + YYLTYPE yyerror_range[2]; - /* The locations where the error started and ended. */ - YYLTYPE yyerror_range[2]; +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N)) - YYSIZE_T yystacksize; + YYSIZE_T yystacksize = YYINITDEPTH; - int yyn; - int yyresult; - /* Lookahead token as an internal (translated) token number. */ - int yytoken; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; YYLTYPE yyloc; -#if YYERROR_VERBOSE - /* Buffer for error messages, and its allocated size. */ - char yymsgbuf[128]; - char *yymsg = yymsgbuf; - YYSIZE_T yymsg_alloc = sizeof yymsgbuf; -#endif - -#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N)) - /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; - yytoken = 0; - yyss = yyssa; - yyvs = yyvsa; - yyls = yylsa; - yystacksize = YYINITDEPTH; - YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ + yychar = YYEMPTY; /* Cause a token to be read. */ /* Initialize stack pointers. Waste one element of value and location stack so that they stay on the same level as the state stack. The wasted elements are never initialized. */ + yyssp = yyss; yyvsp = yyvs; yylsp = yyls; - -#if YYLTYPE_IS_TRIVIAL +#if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL /* Initialize the default location before parsing starts. */ yylloc.first_line = yylloc.last_line = 1; - yylloc.first_column = yylloc.last_column = 1; + yylloc.first_column = yylloc.last_column = 0; #endif goto yysetstate; @@ -1980,7 +2060,6 @@ YYLTYPE yylloc; &yyvs1, yysize * sizeof (*yyvsp), &yyls1, yysize * sizeof (*yylsp), &yystacksize); - yyls = yyls1; yyss = yyss1; yyvs = yyvs1; @@ -2002,9 +2081,9 @@ YYLTYPE yylloc; (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss_alloc, yyss); - YYSTACK_RELOCATE (yyvs_alloc, yyvs); - YYSTACK_RELOCATE (yyls_alloc, yyls); + YYSTACK_RELOCATE (yyss); + YYSTACK_RELOCATE (yyvs); + YYSTACK_RELOCATE (yyls); # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); @@ -2025,9 +2104,6 @@ YYLTYPE yylloc; YYDPRINTF ((stderr, "Entering state %d\n", yystate)); - if (yystate == YYFINAL) - YYACCEPT; - goto yybackup; /*-----------. @@ -2036,16 +2112,16 @@ YYLTYPE yylloc; yybackup: /* Do appropriate processing given the current state. Read a - lookahead token if we need one and don't already have one. */ + look-ahead token if we need one and don't already have one. */ - /* First try to decide what to do without reference to lookahead token. */ + /* First try to decide what to do without reference to look-ahead token. */ yyn = yypact[yystate]; if (yyn == YYPACT_NINF) goto yydefault; - /* Not known => get a lookahead token if don't already have one. */ + /* Not known => get a look-ahead token if don't already have one. */ - /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ + /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); @@ -2077,16 +2153,20 @@ yybackup: goto yyreduce; } + if (yyn == YYFINAL) + YYACCEPT; + /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; - /* Shift the lookahead token. */ + /* Shift the look-ahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - /* Discard the shifted token. */ - yychar = YYEMPTY; + /* Discard the shifted token unless it is eof. */ + if (yychar != YYEOF) + yychar = YYEMPTY; yystate = yyn; *++yyvsp = yylval; @@ -2127,9 +2207,7 @@ yyreduce: switch (yyn) { case 3: - -/* Line 1455 of yacc.c */ -#line 282 "program_parse.y" +#line 282 "program/program_parse.y" { if (state->prog->Target != GL_VERTEX_PROGRAM_ARB) { yyerror(& (yylsp[(1) - (1)]), state, "invalid fragment program header"); @@ -2140,9 +2218,7 @@ yyreduce: break; case 4: - -/* Line 1455 of yacc.c */ -#line 290 "program_parse.y" +#line 290 "program/program_parse.y" { if (state->prog->Target != GL_FRAGMENT_PROGRAM_ARB) { yyerror(& (yylsp[(1) - (1)]), state, "invalid vertex program header"); @@ -2155,9 +2231,7 @@ yyreduce: break; case 7: - -/* Line 1455 of yacc.c */ -#line 306 "program_parse.y" +#line 306 "program/program_parse.y" { int valid = 0; @@ -2182,9 +2256,7 @@ yyreduce: break; case 10: - -/* Line 1455 of yacc.c */ -#line 334 "program_parse.y" +#line 334 "program/program_parse.y" { if ((yyvsp[(1) - (2)].inst) != NULL) { if (state->inst_tail == NULL) { @@ -2202,9 +2274,7 @@ yyreduce: break; case 12: - -/* Line 1455 of yacc.c */ -#line 352 "program_parse.y" +#line 352 "program/program_parse.y" { (yyval.inst) = (yyvsp[(1) - (1)].inst); state->prog->NumAluInstructions++; @@ -2212,9 +2282,7 @@ yyreduce: break; case 13: - -/* Line 1455 of yacc.c */ -#line 357 "program_parse.y" +#line 357 "program/program_parse.y" { (yyval.inst) = (yyvsp[(1) - (1)].inst); state->prog->NumTexInstructions++; @@ -2222,63 +2290,49 @@ yyreduce: break; case 24: - -/* Line 1455 of yacc.c */ -#line 378 "program_parse.y" +#line 378 "program/program_parse.y" { (yyval.inst) = asm_instruction_ctor(OPCODE_ARL, & (yyvsp[(2) - (4)].dst_reg), & (yyvsp[(4) - (4)].src_reg), NULL, NULL); ;} break; case 25: - -/* Line 1455 of yacc.c */ -#line 384 "program_parse.y" +#line 384 "program/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); ;} break; case 26: - -/* Line 1455 of yacc.c */ -#line 390 "program_parse.y" +#line 390 "program/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); ;} break; case 27: - -/* Line 1455 of yacc.c */ -#line 396 "program_parse.y" +#line 396 "program/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); ;} break; case 28: - -/* Line 1455 of yacc.c */ -#line 403 "program_parse.y" +#line 403 "program/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); ;} break; case 29: - -/* Line 1455 of yacc.c */ -#line 410 "program_parse.y" +#line 410 "program/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)); ;} break; case 30: - -/* Line 1455 of yacc.c */ -#line 416 "program_parse.y" +#line 416 "program/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) { @@ -2323,9 +2377,7 @@ yyreduce: break; case 31: - -/* Line 1455 of yacc.c */ -#line 460 "program_parse.y" +#line 460 "program/program_parse.y" { (yyval.inst) = asm_instruction_ctor(OPCODE_KIL, NULL, & (yyvsp[(2) - (2)].src_reg), NULL, NULL); state->fragment.UsesKill = 1; @@ -2333,9 +2385,7 @@ yyreduce: break; case 32: - -/* Line 1455 of yacc.c */ -#line 465 "program_parse.y" +#line 465 "program/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; @@ -2346,9 +2396,7 @@ yyreduce: break; case 33: - -/* Line 1455 of yacc.c */ -#line 475 "program_parse.y" +#line 475 "program/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) { @@ -2393,102 +2441,74 @@ yyreduce: break; case 34: - -/* Line 1455 of yacc.c */ -#line 519 "program_parse.y" +#line 519 "program/program_parse.y" { (yyval.integer) = (yyvsp[(2) - (2)].integer); ;} break; case 35: - -/* Line 1455 of yacc.c */ -#line 524 "program_parse.y" +#line 524 "program/program_parse.y" { (yyval.integer) = TEXTURE_1D_INDEX; ;} break; case 36: - -/* Line 1455 of yacc.c */ -#line 525 "program_parse.y" +#line 525 "program/program_parse.y" { (yyval.integer) = TEXTURE_2D_INDEX; ;} break; case 37: - -/* Line 1455 of yacc.c */ -#line 526 "program_parse.y" +#line 526 "program/program_parse.y" { (yyval.integer) = TEXTURE_3D_INDEX; ;} break; case 38: - -/* Line 1455 of yacc.c */ -#line 527 "program_parse.y" +#line 527 "program/program_parse.y" { (yyval.integer) = TEXTURE_CUBE_INDEX; ;} break; case 39: - -/* Line 1455 of yacc.c */ -#line 528 "program_parse.y" +#line 528 "program/program_parse.y" { (yyval.integer) = TEXTURE_RECT_INDEX; ;} break; case 40: - -/* Line 1455 of yacc.c */ -#line 529 "program_parse.y" +#line 529 "program/program_parse.y" { (yyval.integer) = -TEXTURE_1D_INDEX; ;} break; case 41: - -/* Line 1455 of yacc.c */ -#line 530 "program_parse.y" +#line 530 "program/program_parse.y" { (yyval.integer) = -TEXTURE_2D_INDEX; ;} break; case 42: - -/* Line 1455 of yacc.c */ -#line 531 "program_parse.y" +#line 531 "program/program_parse.y" { (yyval.integer) = -TEXTURE_RECT_INDEX; ;} break; case 43: - -/* Line 1455 of yacc.c */ -#line 532 "program_parse.y" +#line 532 "program/program_parse.y" { (yyval.integer) = TEXTURE_1D_ARRAY_INDEX; ;} break; case 44: - -/* Line 1455 of yacc.c */ -#line 533 "program_parse.y" +#line 533 "program/program_parse.y" { (yyval.integer) = TEXTURE_2D_ARRAY_INDEX; ;} break; case 45: - -/* Line 1455 of yacc.c */ -#line 534 "program_parse.y" +#line 534 "program/program_parse.y" { (yyval.integer) = -TEXTURE_1D_ARRAY_INDEX; ;} break; case 46: - -/* Line 1455 of yacc.c */ -#line 535 "program_parse.y" +#line 535 "program/program_parse.y" { (yyval.integer) = -TEXTURE_2D_ARRAY_INDEX; ;} break; case 47: - -/* Line 1455 of yacc.c */ -#line 539 "program_parse.y" +#line 539 "program/program_parse.y" { /* FIXME: Is this correct? Should the extenedSwizzle be applied * FIXME: to the existing swizzle? @@ -2501,9 +2521,7 @@ yyreduce: break; case 48: - -/* Line 1455 of yacc.c */ -#line 551 "program_parse.y" +#line 551 "program/program_parse.y" { (yyval.src_reg) = (yyvsp[(2) - (2)].src_reg); @@ -2514,9 +2532,7 @@ yyreduce: break; case 49: - -/* Line 1455 of yacc.c */ -#line 559 "program_parse.y" +#line 559 "program/program_parse.y" { (yyval.src_reg) = (yyvsp[(3) - (4)].src_reg); @@ -2534,9 +2550,7 @@ yyreduce: break; case 50: - -/* Line 1455 of yacc.c */ -#line 576 "program_parse.y" +#line 576 "program/program_parse.y" { (yyval.src_reg) = (yyvsp[(1) - (2)].src_reg); @@ -2546,9 +2560,7 @@ yyreduce: break; case 51: - -/* Line 1455 of yacc.c */ -#line 583 "program_parse.y" +#line 583 "program/program_parse.y" { struct asm_symbol temp_sym; @@ -2568,9 +2580,7 @@ yyreduce: break; case 52: - -/* Line 1455 of yacc.c */ -#line 602 "program_parse.y" +#line 602 "program/program_parse.y" { (yyval.src_reg) = (yyvsp[(2) - (3)].src_reg); @@ -2584,9 +2594,7 @@ yyreduce: break; case 53: - -/* Line 1455 of yacc.c */ -#line 613 "program_parse.y" +#line 613 "program/program_parse.y" { (yyval.src_reg) = (yyvsp[(3) - (5)].src_reg); @@ -2606,9 +2614,7 @@ yyreduce: break; case 54: - -/* Line 1455 of yacc.c */ -#line 633 "program_parse.y" +#line 633 "program/program_parse.y" { (yyval.dst_reg) = (yyvsp[(1) - (3)].dst_reg); (yyval.dst_reg).WriteMask = (yyvsp[(2) - (3)].swiz_mask).mask; @@ -2634,9 +2640,7 @@ yyreduce: break; case 55: - -/* Line 1455 of yacc.c */ -#line 658 "program_parse.y" +#line 658 "program/program_parse.y" { set_dst_reg(& (yyval.dst_reg), PROGRAM_ADDRESS, 0); (yyval.dst_reg).WriteMask = (yyvsp[(2) - (2)].swiz_mask).mask; @@ -2644,9 +2648,7 @@ yyreduce: break; case 56: - -/* Line 1455 of yacc.c */ -#line 665 "program_parse.y" +#line 665 "program/program_parse.y" { const unsigned xyzw_valid = ((yyvsp[(1) - (7)].ext_swizzle).xyzw_valid << 0) @@ -2680,9 +2682,7 @@ yyreduce: break; case 57: - -/* Line 1455 of yacc.c */ -#line 698 "program_parse.y" +#line 698 "program/program_parse.y" { (yyval.ext_swizzle) = (yyvsp[(2) - (2)].ext_swizzle); (yyval.ext_swizzle).negate = ((yyvsp[(1) - (2)].negate)) ? 1 : 0; @@ -2690,9 +2690,7 @@ yyreduce: break; case 58: - -/* Line 1455 of yacc.c */ -#line 705 "program_parse.y" +#line 705 "program/program_parse.y" { if (((yyvsp[(1) - (1)].integer) != 0) && ((yyvsp[(1) - (1)].integer) != 1)) { yyerror(& (yylsp[(1) - (1)]), state, "invalid extended swizzle selector"); @@ -2710,9 +2708,7 @@ yyreduce: break; case 59: - -/* Line 1455 of yacc.c */ -#line 720 "program_parse.y" +#line 720 "program/program_parse.y" { char s; @@ -2768,9 +2764,7 @@ yyreduce: break; case 60: - -/* Line 1455 of yacc.c */ -#line 775 "program_parse.y" +#line 775 "program/program_parse.y" { struct asm_symbol *const s = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(1) - (1)].string)); @@ -2816,9 +2810,7 @@ yyreduce: break; case 61: - -/* Line 1455 of yacc.c */ -#line 818 "program_parse.y" +#line 818 "program/program_parse.y" { set_src_reg(& (yyval.src_reg), PROGRAM_INPUT, (yyvsp[(1) - (1)].attrib)); state->prog->InputsRead |= (1U << (yyval.src_reg).Base.Index); @@ -2830,9 +2822,7 @@ yyreduce: break; case 62: - -/* Line 1455 of yacc.c */ -#line 827 "program_parse.y" +#line 827 "program/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)) { @@ -2857,9 +2847,7 @@ yyreduce: break; case 63: - -/* Line 1455 of yacc.c */ -#line 849 "program_parse.y" +#line 849 "program/program_parse.y" { gl_register_file file = ((yyvsp[(1) - (1)].temp_sym).name != NULL) ? (yyvsp[(1) - (1)].temp_sym).param_binding_type @@ -2870,18 +2858,14 @@ yyreduce: break; case 64: - -/* Line 1455 of yacc.c */ -#line 859 "program_parse.y" +#line 859 "program/program_parse.y" { set_dst_reg(& (yyval.dst_reg), PROGRAM_OUTPUT, (yyvsp[(1) - (1)].result)); ;} break; case 65: - -/* Line 1455 of yacc.c */ -#line 863 "program_parse.y" +#line 863 "program/program_parse.y" { struct asm_symbol *const s = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(1) - (1)].string)); @@ -2911,9 +2895,7 @@ yyreduce: break; case 66: - -/* Line 1455 of yacc.c */ -#line 892 "program_parse.y" +#line 892 "program/program_parse.y" { struct asm_symbol *const s = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(1) - (1)].string)); @@ -2933,9 +2915,7 @@ yyreduce: break; case 69: - -/* Line 1455 of yacc.c */ -#line 913 "program_parse.y" +#line 913 "program/program_parse.y" { init_src_reg(& (yyval.src_reg)); (yyval.src_reg).Base.Index = (yyvsp[(1) - (1)].integer); @@ -2943,9 +2923,7 @@ yyreduce: break; case 70: - -/* Line 1455 of yacc.c */ -#line 920 "program_parse.y" +#line 920 "program/program_parse.y" { /* FINISHME: Add support for multiple address registers. */ @@ -2958,32 +2936,24 @@ yyreduce: break; case 71: - -/* Line 1455 of yacc.c */ -#line 931 "program_parse.y" +#line 931 "program/program_parse.y" { (yyval.integer) = 0; ;} break; case 72: - -/* Line 1455 of yacc.c */ -#line 932 "program_parse.y" +#line 932 "program/program_parse.y" { (yyval.integer) = (yyvsp[(2) - (2)].integer); ;} break; case 73: - -/* Line 1455 of yacc.c */ -#line 933 "program_parse.y" +#line 933 "program/program_parse.y" { (yyval.integer) = -(yyvsp[(2) - (2)].integer); ;} break; case 74: - -/* Line 1455 of yacc.c */ -#line 937 "program_parse.y" +#line 937 "program/program_parse.y" { - if (((yyvsp[(1) - (1)].integer) < 0) || ((yyvsp[(1) - (1)].integer) > 4095)) { + if (((yyvsp[(1) - (1)].integer) < 0) || ((yyvsp[(1) - (1)].integer) > (state->limits->MaxAddressOffset - 1))) { char s[100]; _mesa_snprintf(s, sizeof(s), "relative address offset too large (%d)", (yyvsp[(1) - (1)].integer)); @@ -2996,11 +2966,9 @@ yyreduce: break; case 75: - -/* Line 1455 of yacc.c */ -#line 951 "program_parse.y" +#line 951 "program/program_parse.y" { - if (((yyvsp[(1) - (1)].integer) < 0) || ((yyvsp[(1) - (1)].integer) > 4096)) { + if (((yyvsp[(1) - (1)].integer) < 0) || ((yyvsp[(1) - (1)].integer) > state->limits->MaxAddressOffset)) { char s[100]; _mesa_snprintf(s, sizeof(s), "relative address offset too large (%d)", (yyvsp[(1) - (1)].integer)); @@ -3013,9 +2981,7 @@ yyreduce: break; case 76: - -/* Line 1455 of yacc.c */ -#line 965 "program_parse.y" +#line 965 "program/program_parse.y" { struct asm_symbol *const s = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(1) - (1)].string)); @@ -3036,9 +3002,7 @@ yyreduce: break; case 77: - -/* Line 1455 of yacc.c */ -#line 985 "program_parse.y" +#line 985 "program/program_parse.y" { if ((yyvsp[(1) - (1)].swiz_mask).mask != WRITEMASK_X) { yyerror(& (yylsp[(1) - (1)]), state, "invalid address component selector"); @@ -3050,9 +3014,7 @@ yyreduce: break; case 78: - -/* Line 1455 of yacc.c */ -#line 996 "program_parse.y" +#line 996 "program/program_parse.y" { if ((yyvsp[(1) - (1)].swiz_mask).mask != WRITEMASK_X) { yyerror(& (yylsp[(1) - (1)]), state, @@ -3065,41 +3027,31 @@ yyreduce: break; case 83: - -/* Line 1455 of yacc.c */ -#line 1012 "program_parse.y" +#line 1012 "program/program_parse.y" { (yyval.swiz_mask).swizzle = SWIZZLE_NOOP; (yyval.swiz_mask).mask = WRITEMASK_XYZW; ;} break; case 88: - -/* Line 1455 of yacc.c */ -#line 1016 "program_parse.y" +#line 1016 "program/program_parse.y" { (yyval.swiz_mask).swizzle = SWIZZLE_NOOP; (yyval.swiz_mask).mask = WRITEMASK_XYZW; ;} break; case 89: - -/* Line 1455 of yacc.c */ -#line 1020 "program_parse.y" +#line 1020 "program/program_parse.y" { (yyval.dst_reg) = (yyvsp[(2) - (3)].dst_reg); ;} break; case 90: - -/* Line 1455 of yacc.c */ -#line 1024 "program_parse.y" +#line 1024 "program/program_parse.y" { (yyval.dst_reg) = (yyvsp[(2) - (3)].dst_reg); ;} break; case 91: - -/* Line 1455 of yacc.c */ -#line 1028 "program_parse.y" +#line 1028 "program/program_parse.y" { (yyval.dst_reg).CondMask = COND_TR; (yyval.dst_reg).CondSwizzle = SWIZZLE_NOOP; @@ -3108,9 +3060,7 @@ yyreduce: break; case 92: - -/* Line 1455 of yacc.c */ -#line 1036 "program_parse.y" +#line 1036 "program/program_parse.y" { (yyval.dst_reg) = (yyvsp[(1) - (2)].dst_reg); (yyval.dst_reg).CondSwizzle = (yyvsp[(2) - (2)].swiz_mask).swizzle; @@ -3118,9 +3068,7 @@ yyreduce: break; case 93: - -/* Line 1455 of yacc.c */ -#line 1043 "program_parse.y" +#line 1043 "program/program_parse.y" { (yyval.dst_reg) = (yyvsp[(1) - (2)].dst_reg); (yyval.dst_reg).CondSwizzle = (yyvsp[(2) - (2)].swiz_mask).swizzle; @@ -3128,9 +3076,7 @@ yyreduce: break; case 94: - -/* Line 1455 of yacc.c */ -#line 1050 "program_parse.y" +#line 1050 "program/program_parse.y" { const int cond = _mesa_parse_cc((yyvsp[(1) - (1)].string)); if ((cond == 0) || ((yyvsp[(1) - (1)].string)[2] != '\0')) { @@ -3154,9 +3100,7 @@ yyreduce: break; case 95: - -/* Line 1455 of yacc.c */ -#line 1073 "program_parse.y" +#line 1073 "program/program_parse.y" { const int cond = _mesa_parse_cc((yyvsp[(1) - (1)].string)); if ((cond == 0) || ((yyvsp[(1) - (1)].string)[2] != '\0')) { @@ -3180,9 +3124,7 @@ yyreduce: break; case 102: - -/* Line 1455 of yacc.c */ -#line 1104 "program_parse.y" +#line 1104 "program/program_parse.y" { struct asm_symbol *const s = declare_variable(state, (yyvsp[(2) - (4)].string), at_attrib, & (yylsp[(2) - (4)])); @@ -3202,54 +3144,42 @@ yyreduce: break; case 103: - -/* Line 1455 of yacc.c */ -#line 1123 "program_parse.y" +#line 1123 "program/program_parse.y" { (yyval.attrib) = (yyvsp[(2) - (2)].attrib); ;} break; case 104: - -/* Line 1455 of yacc.c */ -#line 1127 "program_parse.y" +#line 1127 "program/program_parse.y" { (yyval.attrib) = (yyvsp[(2) - (2)].attrib); ;} break; case 105: - -/* Line 1455 of yacc.c */ -#line 1133 "program_parse.y" +#line 1133 "program/program_parse.y" { (yyval.attrib) = VERT_ATTRIB_POS; ;} break; case 106: - -/* Line 1455 of yacc.c */ -#line 1137 "program_parse.y" +#line 1137 "program/program_parse.y" { (yyval.attrib) = VERT_ATTRIB_WEIGHT; ;} break; case 107: - -/* Line 1455 of yacc.c */ -#line 1141 "program_parse.y" +#line 1141 "program/program_parse.y" { (yyval.attrib) = VERT_ATTRIB_NORMAL; ;} break; case 108: - -/* Line 1455 of yacc.c */ -#line 1145 "program_parse.y" +#line 1145 "program/program_parse.y" { if (!state->ctx->Extensions.EXT_secondary_color) { yyerror(& (yylsp[(2) - (2)]), state, "GL_EXT_secondary_color not supported"); @@ -3261,9 +3191,7 @@ yyreduce: break; case 109: - -/* Line 1455 of yacc.c */ -#line 1154 "program_parse.y" +#line 1154 "program/program_parse.y" { if (!state->ctx->Extensions.EXT_fog_coord) { yyerror(& (yylsp[(1) - (1)]), state, "GL_EXT_fog_coord not supported"); @@ -3275,18 +3203,14 @@ yyreduce: break; case 110: - -/* Line 1455 of yacc.c */ -#line 1163 "program_parse.y" +#line 1163 "program/program_parse.y" { (yyval.attrib) = VERT_ATTRIB_TEX0 + (yyvsp[(2) - (2)].integer); ;} break; case 111: - -/* Line 1455 of yacc.c */ -#line 1167 "program_parse.y" +#line 1167 "program/program_parse.y" { yyerror(& (yylsp[(1) - (4)]), state, "GL_ARB_matrix_palette not supported"); YYERROR; @@ -3294,18 +3218,14 @@ yyreduce: break; case 112: - -/* Line 1455 of yacc.c */ -#line 1172 "program_parse.y" +#line 1172 "program/program_parse.y" { (yyval.attrib) = VERT_ATTRIB_GENERIC0 + (yyvsp[(3) - (4)].integer); ;} break; case 113: - -/* Line 1455 of yacc.c */ -#line 1178 "program_parse.y" +#line 1178 "program/program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->limits->MaxAttribs) { yyerror(& (yylsp[(1) - (1)]), state, "invalid vertex attribute reference"); @@ -3317,45 +3237,35 @@ yyreduce: break; case 117: - -/* Line 1455 of yacc.c */ -#line 1192 "program_parse.y" +#line 1192 "program/program_parse.y" { (yyval.attrib) = FRAG_ATTRIB_WPOS; ;} break; case 118: - -/* Line 1455 of yacc.c */ -#line 1196 "program_parse.y" +#line 1196 "program/program_parse.y" { (yyval.attrib) = FRAG_ATTRIB_COL0 + (yyvsp[(2) - (2)].integer); ;} break; case 119: - -/* Line 1455 of yacc.c */ -#line 1200 "program_parse.y" +#line 1200 "program/program_parse.y" { (yyval.attrib) = FRAG_ATTRIB_FOGC; ;} break; case 120: - -/* Line 1455 of yacc.c */ -#line 1204 "program_parse.y" +#line 1204 "program/program_parse.y" { (yyval.attrib) = FRAG_ATTRIB_TEX0 + (yyvsp[(2) - (2)].integer); ;} break; case 123: - -/* Line 1455 of yacc.c */ -#line 1212 "program_parse.y" +#line 1212 "program/program_parse.y" { struct asm_symbol *const s = declare_variable(state, (yyvsp[(2) - (3)].string), at_param, & (yylsp[(2) - (3)])); @@ -3374,9 +3284,7 @@ yyreduce: break; case 124: - -/* Line 1455 of yacc.c */ -#line 1230 "program_parse.y" +#line 1230 "program/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)); @@ -3402,18 +3310,14 @@ yyreduce: break; case 125: - -/* Line 1455 of yacc.c */ -#line 1255 "program_parse.y" +#line 1255 "program/program_parse.y" { (yyval.integer) = 0; ;} break; case 126: - -/* Line 1455 of yacc.c */ -#line 1259 "program_parse.y" +#line 1259 "program/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"); @@ -3425,27 +3329,21 @@ yyreduce: break; case 127: - -/* Line 1455 of yacc.c */ -#line 1270 "program_parse.y" +#line 1270 "program/program_parse.y" { (yyval.temp_sym) = (yyvsp[(2) - (2)].temp_sym); ;} break; case 128: - -/* Line 1455 of yacc.c */ -#line 1276 "program_parse.y" +#line 1276 "program/program_parse.y" { (yyval.temp_sym) = (yyvsp[(3) - (4)].temp_sym); ;} break; case 130: - -/* Line 1455 of yacc.c */ -#line 1283 "program_parse.y" +#line 1283 "program/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); @@ -3453,9 +3351,7 @@ yyreduce: break; case 131: - -/* Line 1455 of yacc.c */ -#line 1290 "program_parse.y" +#line 1290 "program/program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3464,9 +3360,7 @@ yyreduce: break; case 132: - -/* Line 1455 of yacc.c */ -#line 1296 "program_parse.y" +#line 1296 "program/program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3475,9 +3369,7 @@ yyreduce: break; case 133: - -/* Line 1455 of yacc.c */ -#line 1302 "program_parse.y" +#line 1302 "program/program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3486,9 +3378,7 @@ yyreduce: break; case 134: - -/* Line 1455 of yacc.c */ -#line 1310 "program_parse.y" +#line 1310 "program/program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3497,9 +3387,7 @@ yyreduce: break; case 135: - -/* Line 1455 of yacc.c */ -#line 1316 "program_parse.y" +#line 1316 "program/program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3508,9 +3396,7 @@ yyreduce: break; case 136: - -/* Line 1455 of yacc.c */ -#line 1322 "program_parse.y" +#line 1322 "program/program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3519,9 +3405,7 @@ yyreduce: break; case 137: - -/* Line 1455 of yacc.c */ -#line 1330 "program_parse.y" +#line 1330 "program/program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3530,9 +3414,7 @@ yyreduce: break; case 138: - -/* Line 1455 of yacc.c */ -#line 1336 "program_parse.y" +#line 1336 "program/program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3541,9 +3423,7 @@ yyreduce: break; case 139: - -/* Line 1455 of yacc.c */ -#line 1342 "program_parse.y" +#line 1342 "program/program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3552,100 +3432,72 @@ yyreduce: break; case 140: - -/* Line 1455 of yacc.c */ -#line 1349 "program_parse.y" +#line 1349 "program/program_parse.y" { memcpy((yyval.state), (yyvsp[(1) - (1)].state), sizeof((yyval.state))); ;} break; case 141: - -/* Line 1455 of yacc.c */ -#line 1350 "program_parse.y" +#line 1350 "program/program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 142: - -/* Line 1455 of yacc.c */ -#line 1353 "program_parse.y" +#line 1353 "program/program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 143: - -/* Line 1455 of yacc.c */ -#line 1354 "program_parse.y" +#line 1354 "program/program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 144: - -/* Line 1455 of yacc.c */ -#line 1355 "program_parse.y" +#line 1355 "program/program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 145: - -/* Line 1455 of yacc.c */ -#line 1356 "program_parse.y" +#line 1356 "program/program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 146: - -/* Line 1455 of yacc.c */ -#line 1357 "program_parse.y" +#line 1357 "program/program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 147: - -/* Line 1455 of yacc.c */ -#line 1358 "program_parse.y" +#line 1358 "program/program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 148: - -/* Line 1455 of yacc.c */ -#line 1359 "program_parse.y" +#line 1359 "program/program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 149: - -/* Line 1455 of yacc.c */ -#line 1360 "program_parse.y" +#line 1360 "program/program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 150: - -/* Line 1455 of yacc.c */ -#line 1361 "program_parse.y" +#line 1361 "program/program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 151: - -/* Line 1455 of yacc.c */ -#line 1362 "program_parse.y" +#line 1362 "program/program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 152: - -/* Line 1455 of yacc.c */ -#line 1363 "program_parse.y" +#line 1363 "program/program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 153: - -/* Line 1455 of yacc.c */ -#line 1367 "program_parse.y" +#line 1367 "program/program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_MATERIAL; @@ -3655,36 +3507,28 @@ yyreduce: break; case 154: - -/* Line 1455 of yacc.c */ -#line 1376 "program_parse.y" +#line 1376 "program/program_parse.y" { (yyval.integer) = (yyvsp[(1) - (1)].integer); ;} break; case 155: - -/* Line 1455 of yacc.c */ -#line 1380 "program_parse.y" +#line 1380 "program/program_parse.y" { (yyval.integer) = STATE_EMISSION; ;} break; case 156: - -/* Line 1455 of yacc.c */ -#line 1384 "program_parse.y" +#line 1384 "program/program_parse.y" { (yyval.integer) = STATE_SHININESS; ;} break; case 157: - -/* Line 1455 of yacc.c */ -#line 1390 "program_parse.y" +#line 1390 "program/program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_LIGHT; @@ -3694,27 +3538,21 @@ yyreduce: break; case 158: - -/* Line 1455 of yacc.c */ -#line 1399 "program_parse.y" +#line 1399 "program/program_parse.y" { (yyval.integer) = (yyvsp[(1) - (1)].integer); ;} break; case 159: - -/* Line 1455 of yacc.c */ -#line 1403 "program_parse.y" +#line 1403 "program/program_parse.y" { (yyval.integer) = STATE_POSITION; ;} break; case 160: - -/* Line 1455 of yacc.c */ -#line 1407 "program_parse.y" +#line 1407 "program/program_parse.y" { if (!state->ctx->Extensions.EXT_point_parameters) { yyerror(& (yylsp[(1) - (1)]), state, "GL_ARB_point_parameters not supported"); @@ -3726,36 +3564,28 @@ yyreduce: break; case 161: - -/* Line 1455 of yacc.c */ -#line 1416 "program_parse.y" +#line 1416 "program/program_parse.y" { (yyval.integer) = (yyvsp[(2) - (2)].integer); ;} break; case 162: - -/* Line 1455 of yacc.c */ -#line 1420 "program_parse.y" +#line 1420 "program/program_parse.y" { (yyval.integer) = STATE_HALF_VECTOR; ;} break; case 163: - -/* Line 1455 of yacc.c */ -#line 1426 "program_parse.y" +#line 1426 "program/program_parse.y" { (yyval.integer) = STATE_SPOT_DIRECTION; ;} break; case 164: - -/* Line 1455 of yacc.c */ -#line 1432 "program_parse.y" +#line 1432 "program/program_parse.y" { (yyval.state)[0] = (yyvsp[(2) - (2)].state)[0]; (yyval.state)[1] = (yyvsp[(2) - (2)].state)[1]; @@ -3763,9 +3593,7 @@ yyreduce: break; case 165: - -/* Line 1455 of yacc.c */ -#line 1439 "program_parse.y" +#line 1439 "program/program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_LIGHTMODEL_AMBIENT; @@ -3773,9 +3601,7 @@ yyreduce: break; case 166: - -/* Line 1455 of yacc.c */ -#line 1444 "program_parse.y" +#line 1444 "program/program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_LIGHTMODEL_SCENECOLOR; @@ -3784,9 +3610,7 @@ yyreduce: break; case 167: - -/* Line 1455 of yacc.c */ -#line 1452 "program_parse.y" +#line 1452 "program/program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_LIGHTPROD; @@ -3797,9 +3621,7 @@ yyreduce: break; case 169: - -/* Line 1455 of yacc.c */ -#line 1464 "program_parse.y" +#line 1464 "program/program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = (yyvsp[(3) - (3)].integer); @@ -3808,45 +3630,35 @@ yyreduce: break; case 170: - -/* Line 1455 of yacc.c */ -#line 1472 "program_parse.y" +#line 1472 "program/program_parse.y" { (yyval.integer) = STATE_TEXENV_COLOR; ;} break; case 171: - -/* Line 1455 of yacc.c */ -#line 1478 "program_parse.y" +#line 1478 "program/program_parse.y" { (yyval.integer) = STATE_AMBIENT; ;} break; case 172: - -/* Line 1455 of yacc.c */ -#line 1482 "program_parse.y" +#line 1482 "program/program_parse.y" { (yyval.integer) = STATE_DIFFUSE; ;} break; case 173: - -/* Line 1455 of yacc.c */ -#line 1486 "program_parse.y" +#line 1486 "program/program_parse.y" { (yyval.integer) = STATE_SPECULAR; ;} break; case 174: - -/* Line 1455 of yacc.c */ -#line 1492 "program_parse.y" +#line 1492 "program/program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxLights) { yyerror(& (yylsp[(1) - (1)]), state, "invalid light selector"); @@ -3858,9 +3670,7 @@ yyreduce: break; case 175: - -/* Line 1455 of yacc.c */ -#line 1503 "program_parse.y" +#line 1503 "program/program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_TEXGEN; @@ -3870,63 +3680,49 @@ yyreduce: break; case 176: - -/* Line 1455 of yacc.c */ -#line 1512 "program_parse.y" +#line 1512 "program/program_parse.y" { (yyval.integer) = STATE_TEXGEN_EYE_S; ;} break; case 177: - -/* Line 1455 of yacc.c */ -#line 1516 "program_parse.y" +#line 1516 "program/program_parse.y" { (yyval.integer) = STATE_TEXGEN_OBJECT_S; ;} break; case 178: - -/* Line 1455 of yacc.c */ -#line 1521 "program_parse.y" +#line 1521 "program/program_parse.y" { (yyval.integer) = STATE_TEXGEN_EYE_S - STATE_TEXGEN_EYE_S; ;} break; case 179: - -/* Line 1455 of yacc.c */ -#line 1525 "program_parse.y" +#line 1525 "program/program_parse.y" { (yyval.integer) = STATE_TEXGEN_EYE_T - STATE_TEXGEN_EYE_S; ;} break; case 180: - -/* Line 1455 of yacc.c */ -#line 1529 "program_parse.y" +#line 1529 "program/program_parse.y" { (yyval.integer) = STATE_TEXGEN_EYE_R - STATE_TEXGEN_EYE_S; ;} break; case 181: - -/* Line 1455 of yacc.c */ -#line 1533 "program_parse.y" +#line 1533 "program/program_parse.y" { (yyval.integer) = STATE_TEXGEN_EYE_Q - STATE_TEXGEN_EYE_S; ;} break; case 182: - -/* Line 1455 of yacc.c */ -#line 1539 "program_parse.y" +#line 1539 "program/program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = (yyvsp[(2) - (2)].integer); @@ -3934,27 +3730,21 @@ yyreduce: break; case 183: - -/* Line 1455 of yacc.c */ -#line 1546 "program_parse.y" +#line 1546 "program/program_parse.y" { (yyval.integer) = STATE_FOG_COLOR; ;} break; case 184: - -/* Line 1455 of yacc.c */ -#line 1550 "program_parse.y" +#line 1550 "program/program_parse.y" { (yyval.integer) = STATE_FOG_PARAMS; ;} break; case 185: - -/* Line 1455 of yacc.c */ -#line 1556 "program_parse.y" +#line 1556 "program/program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_CLIPPLANE; @@ -3963,9 +3753,7 @@ yyreduce: break; case 186: - -/* Line 1455 of yacc.c */ -#line 1564 "program_parse.y" +#line 1564 "program/program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxClipPlanes) { yyerror(& (yylsp[(1) - (1)]), state, "invalid clip plane selector"); @@ -3977,9 +3765,7 @@ yyreduce: break; case 187: - -/* Line 1455 of yacc.c */ -#line 1575 "program_parse.y" +#line 1575 "program/program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = (yyvsp[(2) - (2)].integer); @@ -3987,27 +3773,21 @@ yyreduce: break; case 188: - -/* Line 1455 of yacc.c */ -#line 1582 "program_parse.y" +#line 1582 "program/program_parse.y" { (yyval.integer) = STATE_POINT_SIZE; ;} break; case 189: - -/* Line 1455 of yacc.c */ -#line 1586 "program_parse.y" +#line 1586 "program/program_parse.y" { (yyval.integer) = STATE_POINT_ATTENUATION; ;} break; case 190: - -/* Line 1455 of yacc.c */ -#line 1592 "program_parse.y" +#line 1592 "program/program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (5)].state)[0]; (yyval.state)[1] = (yyvsp[(1) - (5)].state)[1]; @@ -4018,9 +3798,7 @@ yyreduce: break; case 191: - -/* Line 1455 of yacc.c */ -#line 1602 "program_parse.y" +#line 1602 "program/program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (2)].state)[0]; (yyval.state)[1] = (yyvsp[(1) - (2)].state)[1]; @@ -4031,9 +3809,7 @@ yyreduce: break; case 192: - -/* Line 1455 of yacc.c */ -#line 1612 "program_parse.y" +#line 1612 "program/program_parse.y" { (yyval.state)[2] = 0; (yyval.state)[3] = 3; @@ -4041,9 +3817,7 @@ yyreduce: break; case 193: - -/* Line 1455 of yacc.c */ -#line 1617 "program_parse.y" +#line 1617 "program/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). @@ -4062,9 +3836,7 @@ yyreduce: break; case 194: - -/* Line 1455 of yacc.c */ -#line 1635 "program_parse.y" +#line 1635 "program/program_parse.y" { (yyval.state)[0] = (yyvsp[(2) - (3)].state)[0]; (yyval.state)[1] = (yyvsp[(2) - (3)].state)[1]; @@ -4073,54 +3845,42 @@ yyreduce: break; case 195: - -/* Line 1455 of yacc.c */ -#line 1643 "program_parse.y" +#line 1643 "program/program_parse.y" { (yyval.integer) = 0; ;} break; case 196: - -/* Line 1455 of yacc.c */ -#line 1647 "program_parse.y" +#line 1647 "program/program_parse.y" { (yyval.integer) = (yyvsp[(1) - (1)].integer); ;} break; case 197: - -/* Line 1455 of yacc.c */ -#line 1653 "program_parse.y" +#line 1653 "program/program_parse.y" { (yyval.integer) = STATE_MATRIX_INVERSE; ;} break; case 198: - -/* Line 1455 of yacc.c */ -#line 1657 "program_parse.y" +#line 1657 "program/program_parse.y" { (yyval.integer) = STATE_MATRIX_TRANSPOSE; ;} break; case 199: - -/* Line 1455 of yacc.c */ -#line 1661 "program_parse.y" +#line 1661 "program/program_parse.y" { (yyval.integer) = STATE_MATRIX_INVTRANS; ;} break; case 200: - -/* Line 1455 of yacc.c */ -#line 1667 "program_parse.y" +#line 1667 "program/program_parse.y" { if ((yyvsp[(1) - (1)].integer) > 3) { yyerror(& (yylsp[(1) - (1)]), state, "invalid matrix row reference"); @@ -4132,9 +3892,7 @@ yyreduce: break; case 201: - -/* Line 1455 of yacc.c */ -#line 1678 "program_parse.y" +#line 1678 "program/program_parse.y" { (yyval.state)[0] = STATE_MODELVIEW_MATRIX; (yyval.state)[1] = (yyvsp[(2) - (2)].integer); @@ -4142,9 +3900,7 @@ yyreduce: break; case 202: - -/* Line 1455 of yacc.c */ -#line 1683 "program_parse.y" +#line 1683 "program/program_parse.y" { (yyval.state)[0] = STATE_PROJECTION_MATRIX; (yyval.state)[1] = 0; @@ -4152,9 +3908,7 @@ yyreduce: break; case 203: - -/* Line 1455 of yacc.c */ -#line 1688 "program_parse.y" +#line 1688 "program/program_parse.y" { (yyval.state)[0] = STATE_MVP_MATRIX; (yyval.state)[1] = 0; @@ -4162,9 +3916,7 @@ yyreduce: break; case 204: - -/* Line 1455 of yacc.c */ -#line 1693 "program_parse.y" +#line 1693 "program/program_parse.y" { (yyval.state)[0] = STATE_TEXTURE_MATRIX; (yyval.state)[1] = (yyvsp[(2) - (2)].integer); @@ -4172,9 +3924,7 @@ yyreduce: break; case 205: - -/* Line 1455 of yacc.c */ -#line 1698 "program_parse.y" +#line 1698 "program/program_parse.y" { yyerror(& (yylsp[(1) - (4)]), state, "GL_ARB_matrix_palette not supported"); YYERROR; @@ -4182,9 +3932,7 @@ yyreduce: break; case 206: - -/* Line 1455 of yacc.c */ -#line 1703 "program_parse.y" +#line 1703 "program/program_parse.y" { (yyval.state)[0] = STATE_PROGRAM_MATRIX; (yyval.state)[1] = (yyvsp[(3) - (4)].integer); @@ -4192,27 +3940,21 @@ yyreduce: break; case 207: - -/* Line 1455 of yacc.c */ -#line 1710 "program_parse.y" +#line 1710 "program/program_parse.y" { (yyval.integer) = 0; ;} break; case 208: - -/* Line 1455 of yacc.c */ -#line 1714 "program_parse.y" +#line 1714 "program/program_parse.y" { (yyval.integer) = (yyvsp[(2) - (3)].integer); ;} break; case 209: - -/* Line 1455 of yacc.c */ -#line 1719 "program_parse.y" +#line 1719 "program/program_parse.y" { /* Since GL_ARB_vertex_blend isn't supported, only modelview matrix * zero is valid. @@ -4227,9 +3969,7 @@ yyreduce: break; case 210: - -/* Line 1455 of yacc.c */ -#line 1732 "program_parse.y" +#line 1732 "program/program_parse.y" { /* Since GL_ARB_matrix_palette isn't supported, just let any value * through here. The error will be generated later. @@ -4239,9 +3979,7 @@ yyreduce: break; case 211: - -/* Line 1455 of yacc.c */ -#line 1740 "program_parse.y" +#line 1740 "program/program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxProgramMatrices) { yyerror(& (yylsp[(1) - (1)]), state, "invalid program matrix selector"); @@ -4253,9 +3991,7 @@ yyreduce: break; case 212: - -/* Line 1455 of yacc.c */ -#line 1751 "program_parse.y" +#line 1751 "program/program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_DEPTH_RANGE; @@ -4263,9 +3999,7 @@ yyreduce: break; case 217: - -/* Line 1455 of yacc.c */ -#line 1763 "program_parse.y" +#line 1763 "program/program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = state->state_param_enum; @@ -4276,9 +4010,7 @@ yyreduce: break; case 218: - -/* Line 1455 of yacc.c */ -#line 1773 "program_parse.y" +#line 1773 "program/program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (1)].integer); (yyval.state)[1] = (yyvsp[(1) - (1)].integer); @@ -4286,9 +4018,7 @@ yyreduce: break; case 219: - -/* Line 1455 of yacc.c */ -#line 1778 "program_parse.y" +#line 1778 "program/program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (3)].integer); (yyval.state)[1] = (yyvsp[(3) - (3)].integer); @@ -4296,9 +4026,7 @@ yyreduce: break; case 220: - -/* Line 1455 of yacc.c */ -#line 1785 "program_parse.y" +#line 1785 "program/program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = state->state_param_enum; @@ -4309,9 +4037,7 @@ yyreduce: break; case 221: - -/* Line 1455 of yacc.c */ -#line 1795 "program_parse.y" +#line 1795 "program/program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = state->state_param_enum; @@ -4322,9 +4048,7 @@ yyreduce: break; case 222: - -/* Line 1455 of yacc.c */ -#line 1804 "program_parse.y" +#line 1804 "program/program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (1)].integer); (yyval.state)[1] = (yyvsp[(1) - (1)].integer); @@ -4332,9 +4056,7 @@ yyreduce: break; case 223: - -/* Line 1455 of yacc.c */ -#line 1809 "program_parse.y" +#line 1809 "program/program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (3)].integer); (yyval.state)[1] = (yyvsp[(3) - (3)].integer); @@ -4342,9 +4064,7 @@ yyreduce: break; case 224: - -/* Line 1455 of yacc.c */ -#line 1816 "program_parse.y" +#line 1816 "program/program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = state->state_param_enum; @@ -4355,9 +4075,7 @@ yyreduce: break; case 225: - -/* Line 1455 of yacc.c */ -#line 1826 "program_parse.y" +#line 1826 "program/program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->limits->MaxEnvParams) { yyerror(& (yylsp[(1) - (1)]), state, "invalid environment parameter reference"); @@ -4368,9 +4086,7 @@ yyreduce: break; case 226: - -/* Line 1455 of yacc.c */ -#line 1836 "program_parse.y" +#line 1836 "program/program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->limits->MaxLocalParams) { yyerror(& (yylsp[(1) - (1)]), state, "invalid local parameter reference"); @@ -4381,9 +4097,7 @@ yyreduce: break; case 231: - -/* Line 1455 of yacc.c */ -#line 1851 "program_parse.y" +#line 1851 "program/program_parse.y" { (yyval.vector).count = 4; (yyval.vector).data[0] = (yyvsp[(1) - (1)].real); @@ -4394,9 +4108,7 @@ yyreduce: break; case 232: - -/* Line 1455 of yacc.c */ -#line 1861 "program_parse.y" +#line 1861 "program/program_parse.y" { (yyval.vector).count = 1; (yyval.vector).data[0] = (yyvsp[(1) - (1)].real); @@ -4407,9 +4119,7 @@ yyreduce: break; case 233: - -/* Line 1455 of yacc.c */ -#line 1869 "program_parse.y" +#line 1869 "program/program_parse.y" { (yyval.vector).count = 1; (yyval.vector).data[0] = (float) (yyvsp[(1) - (1)].integer); @@ -4420,9 +4130,7 @@ yyreduce: break; case 234: - -/* Line 1455 of yacc.c */ -#line 1879 "program_parse.y" +#line 1879 "program/program_parse.y" { (yyval.vector).count = 4; (yyval.vector).data[0] = (yyvsp[(2) - (3)].real); @@ -4433,9 +4141,7 @@ yyreduce: break; case 235: - -/* Line 1455 of yacc.c */ -#line 1887 "program_parse.y" +#line 1887 "program/program_parse.y" { (yyval.vector).count = 4; (yyval.vector).data[0] = (yyvsp[(2) - (5)].real); @@ -4446,9 +4152,7 @@ yyreduce: break; case 236: - -/* Line 1455 of yacc.c */ -#line 1896 "program_parse.y" +#line 1896 "program/program_parse.y" { (yyval.vector).count = 4; (yyval.vector).data[0] = (yyvsp[(2) - (7)].real); @@ -4459,9 +4163,7 @@ yyreduce: break; case 237: - -/* Line 1455 of yacc.c */ -#line 1905 "program_parse.y" +#line 1905 "program/program_parse.y" { (yyval.vector).count = 4; (yyval.vector).data[0] = (yyvsp[(2) - (9)].real); @@ -4472,55 +4174,41 @@ yyreduce: break; case 238: - -/* Line 1455 of yacc.c */ -#line 1915 "program_parse.y" +#line 1915 "program/program_parse.y" { (yyval.real) = ((yyvsp[(1) - (2)].negate)) ? -(yyvsp[(2) - (2)].real) : (yyvsp[(2) - (2)].real); ;} break; case 239: - -/* Line 1455 of yacc.c */ -#line 1919 "program_parse.y" +#line 1919 "program/program_parse.y" { (yyval.real) = (float)(((yyvsp[(1) - (2)].negate)) ? -(yyvsp[(2) - (2)].integer) : (yyvsp[(2) - (2)].integer)); ;} break; case 240: - -/* Line 1455 of yacc.c */ -#line 1924 "program_parse.y" +#line 1924 "program/program_parse.y" { (yyval.negate) = FALSE; ;} break; case 241: - -/* Line 1455 of yacc.c */ -#line 1925 "program_parse.y" +#line 1925 "program/program_parse.y" { (yyval.negate) = TRUE; ;} break; case 242: - -/* Line 1455 of yacc.c */ -#line 1926 "program_parse.y" +#line 1926 "program/program_parse.y" { (yyval.negate) = FALSE; ;} break; case 243: - -/* Line 1455 of yacc.c */ -#line 1929 "program_parse.y" +#line 1929 "program/program_parse.y" { (yyval.integer) = (yyvsp[(2) - (2)].integer); ;} break; case 245: - -/* Line 1455 of yacc.c */ -#line 1933 "program_parse.y" +#line 1933 "program/program_parse.y" { /* NV_fragment_program_option defines the size qualifiers in a * fairly broken way. "SHORT" or "LONG" can optionally be used @@ -4557,24 +4245,18 @@ yyreduce: break; case 246: - -/* Line 1455 of yacc.c */ -#line 1967 "program_parse.y" +#line 1967 "program/program_parse.y" { ;} break; case 247: - -/* Line 1455 of yacc.c */ -#line 1971 "program_parse.y" +#line 1971 "program/program_parse.y" { (yyval.integer) = (yyvsp[(1) - (1)].integer); ;} break; case 249: - -/* Line 1455 of yacc.c */ -#line 1975 "program_parse.y" +#line 1975 "program/program_parse.y" { if (!declare_variable(state, (yyvsp[(3) - (3)].string), (yyvsp[(0) - (3)].integer), & (yylsp[(3) - (3)]))) { free((yyvsp[(3) - (3)].string)); @@ -4584,9 +4266,7 @@ yyreduce: break; case 250: - -/* Line 1455 of yacc.c */ -#line 1982 "program_parse.y" +#line 1982 "program/program_parse.y" { if (!declare_variable(state, (yyvsp[(1) - (1)].string), (yyvsp[(0) - (1)].integer), & (yylsp[(1) - (1)]))) { free((yyvsp[(1) - (1)].string)); @@ -4596,9 +4276,7 @@ yyreduce: break; case 251: - -/* Line 1455 of yacc.c */ -#line 1991 "program_parse.y" +#line 1991 "program/program_parse.y" { struct asm_symbol *const s = declare_variable(state, (yyvsp[(3) - (5)].string), at_output, & (yylsp[(3) - (5)])); @@ -4613,9 +4291,7 @@ yyreduce: break; case 252: - -/* Line 1455 of yacc.c */ -#line 2005 "program_parse.y" +#line 2005 "program/program_parse.y" { if (state->mode == ARB_vertex) { (yyval.result) = VERT_RESULT_HPOS; @@ -4627,9 +4303,7 @@ yyreduce: break; case 253: - -/* Line 1455 of yacc.c */ -#line 2014 "program_parse.y" +#line 2014 "program/program_parse.y" { if (state->mode == ARB_vertex) { (yyval.result) = VERT_RESULT_FOGC; @@ -4641,18 +4315,14 @@ yyreduce: break; case 254: - -/* Line 1455 of yacc.c */ -#line 2023 "program_parse.y" +#line 2023 "program/program_parse.y" { (yyval.result) = (yyvsp[(2) - (2)].result); ;} break; case 255: - -/* Line 1455 of yacc.c */ -#line 2027 "program_parse.y" +#line 2027 "program/program_parse.y" { if (state->mode == ARB_vertex) { (yyval.result) = VERT_RESULT_PSIZ; @@ -4664,9 +4334,7 @@ yyreduce: break; case 256: - -/* Line 1455 of yacc.c */ -#line 2036 "program_parse.y" +#line 2036 "program/program_parse.y" { if (state->mode == ARB_vertex) { (yyval.result) = VERT_RESULT_TEX0 + (yyvsp[(3) - (3)].integer); @@ -4678,9 +4346,7 @@ yyreduce: break; case 257: - -/* Line 1455 of yacc.c */ -#line 2045 "program_parse.y" +#line 2045 "program/program_parse.y" { if (state->mode == ARB_fragment) { (yyval.result) = FRAG_RESULT_DEPTH; @@ -4692,18 +4358,14 @@ yyreduce: break; case 258: - -/* Line 1455 of yacc.c */ -#line 2056 "program_parse.y" +#line 2056 "program/program_parse.y" { (yyval.result) = (yyvsp[(2) - (3)].integer) + (yyvsp[(3) - (3)].integer); ;} break; case 259: - -/* Line 1455 of yacc.c */ -#line 2062 "program_parse.y" +#line 2062 "program/program_parse.y" { (yyval.integer) = (state->mode == ARB_vertex) ? VERT_RESULT_COL0 @@ -4712,9 +4374,7 @@ yyreduce: break; case 260: - -/* Line 1455 of yacc.c */ -#line 2068 "program_parse.y" +#line 2068 "program/program_parse.y" { if (state->mode == ARB_vertex) { (yyval.integer) = VERT_RESULT_COL0; @@ -4726,9 +4386,7 @@ yyreduce: break; case 261: - -/* Line 1455 of yacc.c */ -#line 2077 "program_parse.y" +#line 2077 "program/program_parse.y" { if (state->mode == ARB_vertex) { (yyval.integer) = VERT_RESULT_BFC0; @@ -4740,18 +4398,14 @@ yyreduce: break; case 262: - -/* Line 1455 of yacc.c */ -#line 2088 "program_parse.y" +#line 2088 "program/program_parse.y" { (yyval.integer) = 0; ;} break; case 263: - -/* Line 1455 of yacc.c */ -#line 2092 "program_parse.y" +#line 2092 "program/program_parse.y" { if (state->mode == ARB_vertex) { (yyval.integer) = 0; @@ -4763,9 +4417,7 @@ yyreduce: break; case 264: - -/* Line 1455 of yacc.c */ -#line 2101 "program_parse.y" +#line 2101 "program/program_parse.y" { if (state->mode == ARB_vertex) { (yyval.integer) = 1; @@ -4777,93 +4429,67 @@ yyreduce: break; case 265: - -/* Line 1455 of yacc.c */ -#line 2111 "program_parse.y" +#line 2111 "program/program_parse.y" { (yyval.integer) = 0; ;} break; case 266: - -/* Line 1455 of yacc.c */ -#line 2112 "program_parse.y" +#line 2112 "program/program_parse.y" { (yyval.integer) = 0; ;} break; case 267: - -/* Line 1455 of yacc.c */ -#line 2113 "program_parse.y" +#line 2113 "program/program_parse.y" { (yyval.integer) = 1; ;} break; case 268: - -/* Line 1455 of yacc.c */ -#line 2116 "program_parse.y" +#line 2116 "program/program_parse.y" { (yyval.integer) = 0; ;} break; case 269: - -/* Line 1455 of yacc.c */ -#line 2117 "program_parse.y" +#line 2117 "program/program_parse.y" { (yyval.integer) = 0; ;} break; case 270: - -/* Line 1455 of yacc.c */ -#line 2118 "program_parse.y" +#line 2118 "program/program_parse.y" { (yyval.integer) = 1; ;} break; case 271: - -/* Line 1455 of yacc.c */ -#line 2121 "program_parse.y" +#line 2121 "program/program_parse.y" { (yyval.integer) = 0; ;} break; case 272: - -/* Line 1455 of yacc.c */ -#line 2122 "program_parse.y" +#line 2122 "program/program_parse.y" { (yyval.integer) = (yyvsp[(2) - (3)].integer); ;} break; case 273: - -/* Line 1455 of yacc.c */ -#line 2125 "program_parse.y" +#line 2125 "program/program_parse.y" { (yyval.integer) = 0; ;} break; case 274: - -/* Line 1455 of yacc.c */ -#line 2126 "program_parse.y" +#line 2126 "program/program_parse.y" { (yyval.integer) = (yyvsp[(2) - (3)].integer); ;} break; case 275: - -/* Line 1455 of yacc.c */ -#line 2129 "program_parse.y" +#line 2129 "program/program_parse.y" { (yyval.integer) = 0; ;} break; case 276: - -/* Line 1455 of yacc.c */ -#line 2130 "program_parse.y" +#line 2130 "program/program_parse.y" { (yyval.integer) = (yyvsp[(2) - (3)].integer); ;} break; case 277: - -/* Line 1455 of yacc.c */ -#line 2134 "program_parse.y" +#line 2134 "program/program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxTextureCoordUnits) { yyerror(& (yylsp[(1) - (1)]), state, "invalid texture coordinate unit selector"); @@ -4875,9 +4501,7 @@ yyreduce: break; case 278: - -/* Line 1455 of yacc.c */ -#line 2145 "program_parse.y" +#line 2145 "program/program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxTextureImageUnits) { yyerror(& (yylsp[(1) - (1)]), state, "invalid texture image unit selector"); @@ -4889,9 +4513,7 @@ yyreduce: break; case 279: - -/* Line 1455 of yacc.c */ -#line 2156 "program_parse.y" +#line 2156 "program/program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxTextureUnits) { yyerror(& (yylsp[(1) - (1)]), state, "invalid texture unit selector"); @@ -4903,9 +4525,7 @@ yyreduce: break; case 280: - -/* Line 1455 of yacc.c */ -#line 2167 "program_parse.y" +#line 2167 "program/program_parse.y" { struct asm_symbol *exist = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(2) - (4)].string)); @@ -4932,9 +4552,8 @@ yyreduce: break; - -/* Line 1455 of yacc.c */ -#line 4938 "program_parse.tab.c" +/* Line 1267 of yacc.c. */ +#line 4557 "program/program_parse.tab.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -5010,7 +4629,7 @@ yyerrlab: if (yyerrstatus == 3) { - /* If just tried and failed to reuse lookahead token after an + /* If just tried and failed to reuse look-ahead token after an error, discard it. */ if (yychar <= YYEOF) @@ -5027,7 +4646,7 @@ yyerrlab: } } - /* Else will try to reuse lookahead token after shifting the error + /* Else will try to reuse look-ahead token after shifting the error token. */ goto yyerrlab1; @@ -5085,11 +4704,14 @@ yyerrlab1: YY_STACK_PRINT (yyss, yyssp); } + if (yyn == YYFINAL) + YYACCEPT; + *++yyvsp = yylval; yyerror_range[1] = yylloc; /* Using YYLLOC is tempting, but would change the location of - the lookahead. YYLOC is available though. */ + the look-ahead. YYLOC is available though. */ YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2); *++yylsp = yyloc; @@ -5114,7 +4736,7 @@ yyabortlab: yyresult = 1; goto yyreturn; -#if !defined(yyoverflow) || YYERROR_VERBOSE +#ifndef yyoverflow /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ @@ -5125,7 +4747,7 @@ yyexhaustedlab: #endif yyreturn: - if (yychar != YYEMPTY) + if (yychar != YYEOF && yychar != YYEMPTY) yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval, &yylloc, state); /* Do not reclaim the symbols of the rule which action triggered @@ -5151,9 +4773,7 @@ yyreturn: } - -/* Line 1675 of yacc.c */ -#line 2196 "program_parse.y" +#line 2196 "program/program_parse.y" void diff --git a/src/mesa/program/program_parse.tab.h b/src/mesa/program/program_parse.tab.h index 045241d9e7..1b30f94139 100644 --- a/src/mesa/program/program_parse.tab.h +++ b/src/mesa/program/program_parse.tab.h @@ -1,23 +1,24 @@ - -/* A Bison parser, made by GNU Bison 2.4.1. */ +/* A Bison parser, made by GNU Bison 2.3. */ /* Skeleton interface for Bison's Yacc-like parsers in C - - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify + + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - + the Free Software Foundation; either version 2, or (at your option) + any later version. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -28,11 +29,10 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ - /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE @@ -146,16 +146,120 @@ DOT = 362 }; #endif +/* Tokens. */ +#define ARBvp_10 258 +#define ARBfp_10 259 +#define ADDRESS 260 +#define ALIAS 261 +#define ATTRIB 262 +#define OPTION 263 +#define OUTPUT 264 +#define PARAM 265 +#define TEMP 266 +#define END 267 +#define BIN_OP 268 +#define BINSC_OP 269 +#define SAMPLE_OP 270 +#define SCALAR_OP 271 +#define TRI_OP 272 +#define VECTOR_OP 273 +#define ARL 274 +#define KIL 275 +#define SWZ 276 +#define TXD_OP 277 +#define INTEGER 278 +#define REAL 279 +#define AMBIENT 280 +#define ATTENUATION 281 +#define BACK 282 +#define CLIP 283 +#define COLOR 284 +#define DEPTH 285 +#define DIFFUSE 286 +#define DIRECTION 287 +#define EMISSION 288 +#define ENV 289 +#define EYE 290 +#define FOG 291 +#define FOGCOORD 292 +#define FRAGMENT 293 +#define FRONT 294 +#define HALF 295 +#define INVERSE 296 +#define INVTRANS 297 +#define LIGHT 298 +#define LIGHTMODEL 299 +#define LIGHTPROD 300 +#define LOCAL 301 +#define MATERIAL 302 +#define MAT_PROGRAM 303 +#define MATRIX 304 +#define MATRIXINDEX 305 +#define MODELVIEW 306 +#define MVP 307 +#define NORMAL 308 +#define OBJECT 309 +#define PALETTE 310 +#define PARAMS 311 +#define PLANE 312 +#define POINT_TOK 313 +#define POINTSIZE 314 +#define POSITION 315 +#define PRIMARY 316 +#define PROGRAM 317 +#define PROJECTION 318 +#define RANGE 319 +#define RESULT 320 +#define ROW 321 +#define SCENECOLOR 322 +#define SECONDARY 323 +#define SHININESS 324 +#define SIZE_TOK 325 +#define SPECULAR 326 +#define SPOT 327 +#define STATE 328 +#define TEXCOORD 329 +#define TEXENV 330 +#define TEXGEN 331 +#define TEXGEN_Q 332 +#define TEXGEN_R 333 +#define TEXGEN_S 334 +#define TEXGEN_T 335 +#define TEXTURE 336 +#define TRANSPOSE 337 +#define TEXTURE_UNIT 338 +#define TEX_1D 339 +#define TEX_2D 340 +#define TEX_3D 341 +#define TEX_CUBE 342 +#define TEX_RECT 343 +#define TEX_SHADOW1D 344 +#define TEX_SHADOW2D 345 +#define TEX_SHADOWRECT 346 +#define TEX_ARRAY1D 347 +#define TEX_ARRAY2D 348 +#define TEX_ARRAYSHADOW1D 349 +#define TEX_ARRAYSHADOW2D 350 +#define VERTEX 351 +#define VTXATTRIB 352 +#define WEIGHT 353 +#define IDENTIFIER 354 +#define USED_IDENTIFIER 355 +#define MASK4 356 +#define MASK3 357 +#define MASK2 358 +#define MASK1 359 +#define SWIZZLE 360 +#define DOT_DOT 361 +#define DOT 362 + #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE +#line 126 "program/program_parse.y" { - -/* Line 1676 of yacc.c */ -#line 126 "program_parse.y" - struct asm_instruction *inst; struct asm_symbol *sym; struct asm_symbol temp_sym; @@ -179,15 +283,13 @@ typedef union YYSTYPE unsigned xyzw_valid:1; unsigned negate:1; } ext_swizzle; - - - -/* Line 1676 of yacc.c */ -#line 187 "program_parse.tab.h" -} YYSTYPE; -# define YYSTYPE_IS_TRIVIAL 1 +} +/* Line 1529 of yacc.c. */ +#line 289 "program/program_parse.tab.h" + YYSTYPE; # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 +# define YYSTYPE_IS_TRIVIAL 1 #endif @@ -206,4 +308,3 @@ typedef struct YYLTYPE #endif - diff --git a/src/mesa/program/program_parse.y b/src/mesa/program/program_parse.y index 784ea28c17..19aa8ccdb5 100644 --- a/src/mesa/program/program_parse.y +++ b/src/mesa/program/program_parse.y @@ -935,7 +935,7 @@ addrRegRelOffset: { $$ = 0; } addrRegPosOffset: INTEGER { - if (($1 < 0) || ($1 > 4095)) { + if (($1 < 0) || ($1 > (state->limits->MaxAddressOffset - 1))) { char s[100]; _mesa_snprintf(s, sizeof(s), "relative address offset too large (%d)", $1); @@ -949,7 +949,7 @@ addrRegPosOffset: INTEGER addrRegNegOffset: INTEGER { - if (($1 < 0) || ($1 > 4096)) { + if (($1 < 0) || ($1 > state->limits->MaxAddressOffset)) { char s[100]; _mesa_snprintf(s, sizeof(s), "relative address offset too large (%d)", $1); diff --git a/src/mesa/program/register_allocate.c b/src/mesa/program/register_allocate.c index ada6e35641..95a9bde401 100644 --- a/src/mesa/program/register_allocate.c +++ b/src/mesa/program/register_allocate.c @@ -30,7 +30,7 @@ * Graph-coloring register allocator. */ -#include <talloc.h> +#include <ralloc.h> #include "main/imports.h" #include "main/macros.h" @@ -38,8 +38,10 @@ #include "register_allocate.h" struct ra_reg { - char *name; GLboolean *conflicts; + unsigned int *conflict_list; + unsigned int conflict_list_size; + unsigned int num_conflicts; }; struct ra_regs { @@ -68,6 +70,7 @@ struct ra_class { struct ra_node { GLboolean *adjacency; + unsigned int *adjacency_list; unsigned int class; unsigned int adjacency_count; unsigned int reg; @@ -93,23 +96,44 @@ ra_alloc_reg_set(unsigned int count) unsigned int i; struct ra_regs *regs; - regs = talloc_zero(NULL, struct ra_regs); + regs = rzalloc(NULL, struct ra_regs); regs->count = count; - regs->regs = talloc_zero_array(regs, struct ra_reg, count); + regs->regs = rzalloc_array(regs, struct ra_reg, count); for (i = 0; i < count; i++) { - regs->regs[i].conflicts = talloc_zero_array(regs->regs, GLboolean, count); + regs->regs[i].conflicts = rzalloc_array(regs->regs, GLboolean, count); regs->regs[i].conflicts[i] = GL_TRUE; + + regs->regs[i].conflict_list = ralloc_array(regs->regs, unsigned int, 4); + regs->regs[i].conflict_list_size = 4; + regs->regs[i].conflict_list[0] = i; + regs->regs[i].num_conflicts = 1; } return regs; } +static void +ra_add_conflict_list(struct ra_regs *regs, unsigned int r1, unsigned int r2) +{ + struct ra_reg *reg1 = ®s->regs[r1]; + + if (reg1->conflict_list_size == reg1->num_conflicts) { + reg1->conflict_list_size *= 2; + reg1->conflict_list = reralloc(regs->regs, reg1->conflict_list, + unsigned int, reg1->conflict_list_size); + } + reg1->conflict_list[reg1->num_conflicts++] = r2; + reg1->conflicts[r2] = GL_TRUE; +} + void ra_add_reg_conflict(struct ra_regs *regs, unsigned int r1, unsigned int r2) { - regs->regs[r1].conflicts[r2] = GL_TRUE; - regs->regs[r2].conflicts[r1] = GL_TRUE; + if (!regs->regs[r1].conflicts[r2]) { + ra_add_conflict_list(regs, r1, r2); + ra_add_conflict_list(regs, r2, r1); + } } unsigned int @@ -117,14 +141,13 @@ ra_alloc_reg_class(struct ra_regs *regs) { struct ra_class *class; - regs->classes = talloc_realloc(regs, regs->classes, - struct ra_class *, - regs->class_count + 1); + regs->classes = reralloc(regs->regs, regs->classes, struct ra_class *, + regs->class_count + 1); - class = talloc_zero(regs, struct ra_class); + class = rzalloc(regs, struct ra_class); regs->classes[regs->class_count] = class; - class->regs = talloc_zero_array(class, GLboolean, regs->count); + class->regs = rzalloc_array(class, GLboolean, regs->count); return regs->class_count++; } @@ -148,7 +171,7 @@ ra_set_finalize(struct ra_regs *regs) unsigned int b, c; for (b = 0; b < regs->class_count; b++) { - regs->classes[b]->q = talloc_array(regs, unsigned int, regs->class_count); + regs->classes[b]->q = ralloc_array(regs, unsigned int, regs->class_count); } /* Compute, for each class B and C, how many regs of B an @@ -160,15 +183,15 @@ ra_set_finalize(struct ra_regs *regs) int max_conflicts = 0; for (rc = 0; rc < regs->count; rc++) { - unsigned int rb; int conflicts = 0; + int i; if (!regs->classes[c]->regs[rc]) continue; - for (rb = 0; rb < regs->count; rb++) { - if (regs->classes[b]->regs[rb] && - regs->regs[rb].conflicts[rc]) + for (i = 0; i < regs->regs[rc].num_conflicts; i++) { + unsigned int rb = regs->regs[rc].conflict_list[i]; + if (regs->classes[b]->regs[rb]) conflicts++; } max_conflicts = MAX2(max_conflicts, conflicts); @@ -178,22 +201,32 @@ ra_set_finalize(struct ra_regs *regs) } } +static void +ra_add_node_adjacency(struct ra_graph *g, unsigned int n1, unsigned int n2) +{ + g->nodes[n1].adjacency[n2] = GL_TRUE; + g->nodes[n1].adjacency_list[g->nodes[n1].adjacency_count] = n2; + g->nodes[n1].adjacency_count++; +} + struct ra_graph * ra_alloc_interference_graph(struct ra_regs *regs, unsigned int count) { struct ra_graph *g; unsigned int i; - g = talloc_zero(regs, struct ra_graph); + g = rzalloc(regs, struct ra_graph); g->regs = regs; - g->nodes = talloc_zero_array(g, struct ra_node, count); + g->nodes = rzalloc_array(g, struct ra_node, count); g->count = count; - g->stack = talloc_zero_array(g, unsigned int, count); + g->stack = rzalloc_array(g, unsigned int, count); for (i = 0; i < count; i++) { - g->nodes[i].adjacency = talloc_zero_array(g, GLboolean, count); - g->nodes[i].adjacency[i] = GL_TRUE; + g->nodes[i].adjacency = rzalloc_array(g, GLboolean, count); + g->nodes[i].adjacency_list = ralloc_array(g, unsigned int, count); + g->nodes[i].adjacency_count = 0; + ra_add_node_adjacency(g, i, i); g->nodes[i].reg = ~0; } @@ -211,13 +244,10 @@ void ra_add_node_interference(struct ra_graph *g, unsigned int n1, unsigned int n2) { - if (g->nodes[n1].adjacency[n2]) - return; - - g->nodes[n1].adjacency[n2] = GL_TRUE; - g->nodes[n2].adjacency_count++; - g->nodes[n2].adjacency[n1] = GL_TRUE; - g->nodes[n2].adjacency_count++; + if (!g->nodes[n1].adjacency[n2]) { + ra_add_node_adjacency(g, n1, n2); + ra_add_node_adjacency(g, n2, n1); + } } static GLboolean pq_test(struct ra_graph *g, unsigned int n) @@ -226,13 +256,12 @@ static GLboolean pq_test(struct ra_graph *g, unsigned int n) unsigned int q = 0; int n_class = g->nodes[n].class; - for (j = 0; j < g->count; j++) { - if (j == n || g->nodes[j].in_stack) - continue; + for (j = 0; j < g->nodes[n].adjacency_count; j++) { + unsigned int n2 = g->nodes[n].adjacency_list[j]; + unsigned int n2_class = g->nodes[n2].class; - if (g->nodes[n].adjacency[j]) { - unsigned int j_class = g->nodes[j].class; - q += g->regs->classes[n_class]->q[j_class]; + if (n != n2 && !g->nodes[n2].in_stack) { + q += g->regs->classes[n_class]->q[n2_class]; } } @@ -303,14 +332,15 @@ ra_select(struct ra_graph *g) continue; /* Check if any of our neighbors conflict with this register choice. */ - for (i = 0; i < g->count; i++) { - if (g->nodes[n].adjacency[i] && - !g->nodes[i].in_stack && - g->regs->regs[r].conflicts[g->nodes[i].reg]) { + for (i = 0; i < g->nodes[n].adjacency_count; i++) { + unsigned int n2 = g->nodes[n].adjacency_list[i]; + + if (!g->nodes[n2].in_stack && + g->regs->regs[r].conflicts[g->nodes[n2].reg]) { break; } } - if (i == g->count) + if (i == g->nodes[n].adjacency_count) break; } if (r == g->regs->count) @@ -368,17 +398,17 @@ ra_get_spill_benefit(struct ra_graph *g, unsigned int n) float benefit = 0; int n_class = g->nodes[n].class; - /* Define the benefit of eliminating an interference between n, j + /* Define the benefit of eliminating an interference between n, n2 * through spilling as q(C, B) / p(C). This is similar to the * "count number of edges" approach of traditional graph coloring, * but takes classes into account. */ - for (j = 0; j < g->count; j++) { - if (j != n && g->nodes[n].adjacency[j]) { - unsigned int j_class = g->nodes[j].class; - benefit += ((float)g->regs->classes[n_class]->q[j_class] / + for (j = 0; j < g->nodes[n].adjacency_count; j++) { + unsigned int n2 = g->nodes[n].adjacency_list[j]; + if (n != n2) { + unsigned int n2_class = g->nodes[n2].class; + benefit += ((float)g->regs->classes[n_class]->q[n2_class] / g->regs->classes[n_class]->p); - break; } } diff --git a/src/mesa/program/sampler.cpp b/src/mesa/program/sampler.cpp index 9a813c8795..1457d1199f 100644 --- a/src/mesa/program/sampler.cpp +++ b/src/mesa/program/sampler.cpp @@ -23,7 +23,6 @@ * DEALINGS IN THE SOFTWARE. */ -#include <cstdio> #include "ir.h" #include "glsl_types.h" #include "ir_visitor.h" @@ -40,7 +39,7 @@ static void fail_link(struct gl_shader_program *prog, const char *fmt, ...) { va_list args; va_start(args, fmt); - prog->InfoLog = talloc_vasprintf_append(prog->InfoLog, fmt, args); + ralloc_vasprintf_append(&prog->InfoLog, fmt, args); va_end(args); prog->LinkStatus = GL_FALSE; @@ -52,7 +51,7 @@ public: get_sampler_name(ir_dereference *last, struct gl_shader_program *shader_program) { - this->mem_ctx = talloc_new(NULL); + this->mem_ctx = ralloc_context(NULL); this->shader_program = shader_program; this->name = NULL; this->offset = 0; @@ -61,7 +60,7 @@ public: ~get_sampler_name() { - talloc_free(this->mem_ctx); + ralloc_free(this->mem_ctx); } virtual ir_visitor_status visit(ir_dereference_variable *ir) @@ -72,7 +71,7 @@ public: virtual ir_visitor_status visit_leave(ir_dereference_record *ir) { - this->name = talloc_asprintf(mem_ctx, "%s.%s", name, ir->field); + this->name = ralloc_asprintf(mem_ctx, "%s.%s", name, ir->field); return visit_continue; } @@ -91,16 +90,14 @@ public: * all that would work would be an unrolled loop counter that ends * up being constant above. */ - shader_program->InfoLog = - talloc_asprintf_append(shader_program->InfoLog, - "warning: Variable sampler array index " - "unsupported.\nThis feature of the language " - "was removed in GLSL 1.20 and is unlikely " - "to be supported for 1.10 in Mesa.\n"); + ralloc_strcat(&shader_program->InfoLog, + "warning: Variable sampler array index unsupported.\n" + "This feature of the language was removed in GLSL 1.20 " + "and is unlikely to be supported for 1.10 in Mesa.\n"); i = 0; } if (ir != last) { - this->name = talloc_asprintf(mem_ctx, "%s[%d]", name, i); + this->name = ralloc_asprintf(mem_ctx, "%s[%d]", name, i); } else { offset = i; } |