Lines Matching refs:state

55 static struct asm_symbol *declare_variable(struct asm_parser_state *state,
71 static int yyparse(struct asm_parser_state *state);
75 static void yyerror(struct YYLTYPE *locp, struct asm_parser_state *state,
79 struct asm_parser_state *state);
133 %lex-param { struct asm_parser_state *state }
134 %parse-param { struct asm_parser_state *state }
150 gl_state_index16 state[STATE_LENGTH];
240 %type <state> stateSingleItem stateMultipleItem
241 %type <state> stateMaterialItem
242 %type <state> stateLightItem stateLightModelItem stateLightProdItem
243 %type <state> stateTexGenItem stateFogItem stateClipPlaneItem statePointItem
244 %type <state> stateMatrixItem stateMatrixRow stateMatrixRows
245 %type <state> stateTexEnvItem stateDepthItem
247 %type <state> stateLModProperty
248 %type <state> stateMatrixName optMatrixRows
266 %type <state> programSingleItem progEnvParam progLocalParam
267 %type <state> programMultipleItem progEnvParams progLocalParams
273 %type <state> progEnvParamNums progLocalParamNums
287 struct asm_parser_state *state)
289 return _mesa_program_lexer_lex(yylval_param, yylloc_param, state->scanner);
300 if (state->prog->Target != GL_VERTEX_PROGRAM_ARB) {
301 yyerror(& @1, state, "invalid fragment program header");
304 state->mode = ARB_vertex;
308 if (state->prog->Target != GL_FRAGMENT_PROGRAM_ARB) {
309 yyerror(& @1, state, "invalid vertex program header");
311 state->mode = ARB_fragment;
313 state->option.TexRect =
314 (state->ctx->Extensions.NV_texture_rectangle != GL_FALSE);
326 if (state->mode == ARB_vertex) {
327 valid = _mesa_ARBvp_parse_option(state, $2);
328 } else if (state->mode == ARB_fragment) {
329 valid = _mesa_ARBfp_parse_option(state, $2);
336 const char *const err_str = (state->mode == ARB_vertex)
340 yyerror(& @2, state, err_str);
353 if (state->inst_tail == NULL) {
354 state->inst_head = $1;
356 state->inst_tail->next = $1;
359 state->inst_tail = $1;
362 state->prog->arb.NumInstructions++;
371 state->prog->arb.NumAluInstructions++;
376 state->prog->arb.NumTexInstructions++;
460 if ((state->prog->TexturesUsed[$6] != 0)
461 && ((state->prog->TexturesUsed[$6] != target_mask)
462 || ((state->prog->ShadowSamplers & tex_mask)
464 yyerror(& @8, state,
470 state->prog->TexturesUsed[$6] |= target_mask;
471 state->prog->ShadowSamplers |= shadow_tex;
479 state->fragment.UsesKill = 1;
511 if ((state->prog->TexturesUsed[$10] != 0)
512 && ((state->prog->TexturesUsed[$10] != target_mask)
513 || ((state->prog->ShadowSamplers & tex_mask)
515 yyerror(& @12, state,
521 state->prog->TexturesUsed[$10] |= target_mask;
522 state->prog->ShadowSamplers |= shadow_tex;
601 if (state->option.PositionInvariant
603 yyerror(& @1, state, "position-invariant programs cannot "
608 state->prog->info.outputs_written |= BITFIELD64_BIT($$.Index);
642 yyerror(& @1, state, "cannot combine RGBA and XYZW swizzle "
663 yyerror(& @1, state, "invalid extended swizzle selector");
681 yyerror(& @1, state, "invalid extended swizzle selector");
728 yyerror(& @1, state, "invalid extended swizzle selector");
738 _mesa_symbol_table_find_symbol(state->st, $1);
743 yyerror(& @1, state, "invalid operand variable");
747 yyerror(& @1, state, "invalid operand variable");
750 yyerror(& @1, state, "non-array access to array PARAM");
766 state->prog->info.inputs_read |= BITFIELD64_BIT($$.Base.Index);
768 if (!validate_inputs(& @1, state)) {
781 state->prog->info.inputs_read |= BITFIELD64_BIT($$.Base.Index);
783 if (!validate_inputs(& @1, state)) {
791 yyerror(& @3, state, "out of bounds array access");
799 state->prog->arb.IndirectRegisterFiles |= (1 << $$.Base.File);
826 _mesa_symbol_table_find_symbol(state->st, $1);
831 yyerror(& @1, state, "invalid operand variable");
834 yyerror(& @1, state, "invalid operand variable");
855 _mesa_symbol_table_find_symbol(state->st, $1);
860 yyerror(& @1, state, "invalid operand variable");
863 yyerror(& @1, state, "array access to non-PARAM variable");
899 if (($1 < 0) || ($1 > (state->limits->MaxAddressOffset - 1))) {
903 yyerror(& @1, state, s);
913 if (($1 < 0) || ($1 > state->limits->MaxAddressOffset)) {
917 yyerror(& @1, state, s);
928 _mesa_symbol_table_find_symbol(state->st, $1);
933 yyerror(& @1, state, "invalid array member");
936 yyerror(& @1, state,
948 yyerror(& @1, state, "invalid address component selector");
959 yyerror(& @1, state,
991 declare_variable(state, $2, at_attrib, & @2);
998 state->InputsBound |= BITFIELD64_BIT(s->attrib_binding);
1000 if (!validate_inputs(& @4, state)) {
1039 yyerror(& @1, state, "GL_ARB_matrix_palette not supported");
1050 if ((unsigned) $1 >= state->limits->MaxAttribs) {
1051 yyerror(& @1, state, "invalid vertex attribute reference");
1084 declare_variable(state, $2, at_param, & @2);
1103 yyerror(& @4, state,
1108 declare_variable(state, $2, $6.type, & @2);
1130 if (($1 < 1) || ((unsigned) $1 > state->limits->MaxParameters)) {
1134 $1, state->limits->MaxParameters);
1135 yyerror(& @1, state, msg);
1167 initialize_symbol_from_state(state->prog, & $$, $1);
1173 initialize_symbol_from_param(state->prog, & $$, $1);
1179 initialize_symbol_from_const(state->prog, & $$, & $1, GL_TRUE);
1187 initialize_symbol_from_state(state->prog, & $$, $1);
1193 initialize_symbol_from_param(state->prog, & $$, $1);
1199 initialize_symbol_from_const(state->prog, & $$, & $1, GL_TRUE);
1207 initialize_symbol_from_state(state->prog, & $$, $1);
1213 initialize_symbol_from_param(state->prog, & $$, $1);
1219 initialize_symbol_from_const(state->prog, & $$, & $1, GL_FALSE);
1376 if ((unsigned) $1 >= state->MaxLights) {
1377 yyerror(& @1, state, "invalid light selector");
1448 if ((unsigned) $1 >= state->MaxClipPlanes) {
1449 yyerror(& @1, state, "invalid clip plane selector");
1506 yyerror(& @3, state, "invalid matrix row range");
1550 yyerror(& @1, state, "invalid matrix row reference");
1580 yyerror(& @1, state, "GL_ARB_matrix_palette not supported");
1605 yyerror(& @1, state, "invalid modelview matrix index");
1622 if ((unsigned) $1 >= state->MaxProgramMatrices) {
1623 yyerror(& @1, state, "invalid program matrix selector");
1646 $$[0] = state->state_param_enum_env;
1668 $$[0] = state->state_param_enum_env;
1678 $$[0] = state->state_param_enum_local;
1699 $$[0] = state->state_param_enum_local;
1708 if ((unsigned) $1 >= state->limits->MaxEnvParams) {
1709 yyerror(& @1, state, "invalid environment parameter reference");
1718 if ((unsigned) $1 >= state->limits->MaxLocalParams) {
1719 yyerror(& @1, state, "invalid local parameter reference");
1818 if (!declare_variable(state, $3, $<integer>0, & @3)) {
1825 if (!declare_variable(state, $1, $<integer>0, & @1)) {
1835 declare_variable(state, $2, at_output, & @2);
1848 if (state->mode == ARB_vertex) {
1851 yyerror(& @2, state, "invalid program result name");
1857 if (state->mode == ARB_vertex) {
1860 yyerror(& @2, state, "invalid program result name");
1870 if (state->mode == ARB_vertex) {
1873 yyerror(& @2, state, "invalid program result name");
1879 if (state->mode == ARB_vertex) {
1882 yyerror(& @2, state, "invalid program result name");
1888 if (state->mode == ARB_fragment) {
1891 yyerror(& @2, state, "invalid program result name");
1905 if (state->mode == ARB_vertex) {
1908 if (state->option.DrawBuffers)
1916 if (state->mode == ARB_vertex) {
1917 yyerror(& @1, state, "invalid program result name");
1920 if (!state->option.DrawBuffers) {
1929 yyerror(& @1, state,
1934 } else if ($2 >= state->MaxDrawBuffers) {
1935 yyerror(& @1, state,
1944 if (state->mode == ARB_vertex) {
1947 yyerror(& @1, state, "invalid program result name");
1953 if (state->mode == ARB_vertex) {
1956 yyerror(& @1, state, "invalid program result name");
1968 if (state->mode == ARB_vertex) {
1971 yyerror(& @1, state, "invalid program result name");
1977 if (state->mode == ARB_vertex) {
1980 yyerror(& @1, state, "invalid program result name");
2010 if ((unsigned) $1 >= state->MaxTextureCoordUnits) {
2011 yyerror(& @1, state, "invalid texture coordinate unit selector");
2021 if ((unsigned) $1 >= state->MaxTextureImageUnits) {
2022 yyerror(& @1, state, "invalid texture image unit selector");
2032 if ((unsigned) $1 >= state->MaxTextureUnits) {
2033 yyerror(& @1, state, "invalid texture unit selector");
2044 _mesa_symbol_table_find_symbol(state->st, $2);
2046 _mesa_symbol_table_find_symbol(state->st, $4);
2054 yyerror(& @2, state, m);
2058 yyerror(& @4, state,
2062 _mesa_symbol_table_add_symbol(state->st, $2, target);
2232 validate_inputs(struct YYLTYPE *locp, struct asm_parser_state *state)
2234 const GLbitfield64 inputs = state->prog->info.inputs_read | state->InputsBound;
2258 yyerror(locp, state, "illegal use of generic attribute and name attribute");
2267 declare_variable(struct asm_parser_state *state, char *name, enum asm_type t,
2272 _mesa_symbol_table_find_symbol(state->st, name);
2276 yyerror(locp, state, "redeclared identifier");
2284 if (state->prog->arb.NumTemporaries >= state->limits->MaxTemps) {
2285 yyerror(locp, state, "too many temporaries declared");
2290 s->temp_binding = state->prog->arb.NumTemporaries;
2291 state->prog->arb.NumTemporaries++;
2295 if (state->prog->arb.NumAddressRegs >=
2296 state->limits->MaxAddressRegs) {
2297 yyerror(locp, state, "too many address registers declared");
2304 state->prog->arb.NumAddressRegs++;
2311 _mesa_symbol_table_add_symbol(state->st, s->name, s);
2312 s->next = state->sym;
2313 state->sym = s;
2508 yyerror(YYLTYPE *locp, struct asm_parser_state *state, const char *s)
2515 _mesa_error(state->ctx, GL_INVALID_OPERATION, "%s", err_str);
2521 _mesa_set_program_error(state->ctx, locp->position, err_str);
2531 GLsizei len, struct asm_parser_state *state)
2540 state->ctx = ctx;
2541 state->prog->Target = target;
2542 state->prog->Parameters = _mesa_new_parameter_list();
2546 strz = (GLubyte *) ralloc_size(state->mem_ctx, len + 2);
2548 if (state->prog->Parameters) {
2549 _mesa_free_parameter_list(state->prog->Parameters);
2550 state->prog->Parameters = NULL;
2559 state->prog->String = strz;
2561 state->st = _mesa_symbol_table_ctor();
2563 state->limits = (target == GL_VERTEX_PROGRAM_ARB)
2567 state->MaxTextureImageUnits = ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits;
2568 state->MaxTextureCoordUnits = ctx->Const.MaxTextureCoordUnits;
2569 state->MaxTextureUnits = ctx->Const.MaxTextureUnits;
2570 state->MaxClipPlanes = ctx->Const.MaxClipPlanes;
2571 state->MaxLights = ctx->Const.MaxLights;
2572 state->MaxProgramMatrices = ctx->Const.MaxProgramMatrices;
2573 state->MaxDrawBuffers = ctx->Const.MaxDrawBuffers;
2575 state->state_param_enum_env = (target == GL_VERTEX_PROGRAM_ARB)
2577 state->state_param_enum_local = (target == GL_VERTEX_PROGRAM_ARB)
2582 _mesa_program_lexer_ctor(& state->scanner, state, (const char *) strz, len + 1);
2583 yyparse(state);
2584 _mesa_program_lexer_dtor(state->scanner);
2593 if (! _mesa_layout_parameters(state)) {
2600 yyerror(& loc, state, "invalid PARAM usage");
2608 state->prog->arb.Instructions =
2609 rzalloc_array(state->mem_ctx, struct prog_instruction,
2610 state->prog->arb.NumInstructions + 1);
2612 if (state->prog->arb.Instructions == NULL) {
2616 inst = state->inst_head;
2617 for (i = 0; i < state->prog->arb.NumInstructions; i++) {
2620 state->prog->arb.Instructions[i] = inst->Base;
2626 const GLuint numInst = state->prog->arb.NumInstructions;
2627 _mesa_init_instructions(state->prog->arb.Instructions + numInst, 1);
2628 state->prog->arb.Instructions[numInst].Opcode = OPCODE_END;
2630 state->prog->arb.NumInstructions++;
2632 state->prog->arb.NumParameters = state->prog->Parameters->NumParameters;
2633 state->prog->arb.NumAttributes =
2634 util_bitcount64(state->prog->info.inputs_read);
2640 state->prog->arb.NumNativeInstructions = state->prog->arb.NumInstructions;
2641 state->prog->arb.NumNativeTemporaries = state->prog->arb.NumTemporaries;
2642 state->prog->arb.NumNativeParameters = state->prog->arb.NumParameters;
2643 state->prog->arb.NumNativeAttributes = state->prog->arb.NumAttributes;
2644 state->prog->arb.NumNativeAddressRegs = state->prog->arb.NumAddressRegs;
2649 for (inst = state->inst_head; inst != NULL; inst = temp) {
2654 state->inst_head = NULL;
2655 state->inst_tail = NULL;
2657 for (sym = state->sym; sym != NULL; sym = temp) {
2663 state->sym = NULL;
2665 _mesa_symbol_table_dtor(state->st);
2666 state->st = NULL;
2669 if (state->prog->Parameters) {
2670 _mesa_free_parameter_list(state->prog->Parameters);
2671 state->prog->Parameters = NULL;
2673 ralloc_free(state->prog->String);
2674 state->prog->String = NULL;