Lines Matching refs:STATE
42 static struct asm_symbol *declare_variable(struct asm_parser_state *state,
58 static int yyparse(struct asm_parser_state *state);
62 static void yyerror(struct YYLTYPE *locp, struct asm_parser_state *state,
66 struct asm_parser_state *state);
117 #define YYLEX_PARAM state->scanner
122 %parse-param { struct asm_parser_state *state }
139 gl_state_index state[STATE_LENGTH];
183 %token SCENECOLOR SECONDARY SHININESS SIZE_TOK SPECULAR SPOT STATE
232 %type <state> stateSingleItem stateMultipleItem
233 %type <state> stateMaterialItem
234 %type <state> stateLightItem stateLightModelItem stateLightProdItem
235 %type <state> stateTexGenItem stateFogItem stateClipPlaneItem statePointItem
236 %type <state> stateMatrixItem stateMatrixRow stateMatrixRows
237 %type <state> stateTexEnvItem stateDepthItem
239 %type <state> stateLModProperty
240 %type <state> stateMatrixName optMatrixRows
257 %type <state> programSingleItem progEnvParam progLocalParam
258 %type <state> programMultipleItem progEnvParams progLocalParams
264 %type <state> progEnvParamNums progLocalParamNums
283 if (state->prog->Target != GL_VERTEX_PROGRAM_ARB) {
284 yyerror(& @1, state, "invalid fragment program header");
287 state->mode = ARB_vertex;
291 if (state->prog->Target != GL_FRAGMENT_PROGRAM_ARB) {
292 yyerror(& @1, state, "invalid vertex program header");
294 state->mode = ARB_fragment;
296 state->option.TexRect =
297 (state->ctx->Extensions.NV_texture_rectangle != GL_FALSE);
309 if (state->mode == ARB_vertex) {
310 valid = _mesa_ARBvp_parse_option(state, $2);
311 } else if (state->mode == ARB_fragment) {
312 valid = _mesa_ARBfp_parse_option(state, $2);
319 const char *const err_str = (state->mode == ARB_vertex)
323 yyerror(& @2, state, err_str);
336 if (state->inst_tail == NULL) {
337 state->inst_head = $1;
339 state->inst_tail->next = $1;
342 state->inst_tail = $1;
345 state->prog->NumInstructions++;
354 state->prog->NumAluInstructions++;
359 state->prog->NumTexInstructions++;
386 state->fragment.UsesDFdy = 1;
445 if ((state->prog->TexturesUsed[$6] != 0)
446 && ((state->prog->TexturesUsed[$6] != target_mask)
447 || ((state->prog->ShadowSamplers & tex_mask)
449 yyerror(& @8, state,
455 state->prog->TexturesUsed[$6] |= target_mask;
456 state->prog->ShadowSamplers |= shadow_tex;
464 state->fragment.UsesKill = 1;
472 state->fragment.UsesKill = 1;
504 if ((state->prog->TexturesUsed[$10] != 0)
505 && ((state->prog->TexturesUsed[$10] != target_mask)
506 || ((state->prog->ShadowSamplers & tex_mask)
508 yyerror(& @12, state,
514 state->prog->TexturesUsed[$10] |= target_mask;
515 state->prog->ShadowSamplers |= shadow_tex;
564 state->option.NV_fragment) {
565 yyerror(& @2, state, "unexpected character '|'");
588 if (!state->option.NV_fragment) {
589 yyerror(& @1, state, "expected scalar suffix");
595 initialize_symbol_from_const(state->prog, & temp_sym, & $1, GL_TRUE);
618 if (!state->option.NV_fragment) {
619 yyerror(& @2, state, "unexpected character '|'");
647 if (state->option.PositionInvariant
649 yyerror(& @1, state, "position-invariant programs cannot "
654 state->prog->OutputsWritten |= BITFIELD64_BIT($$.Index);
688 yyerror(& @1, state, "cannot combine RGBA and XYZW swizzle "
709 yyerror(& @1, state, "invalid extended swizzle selector");
726 yyerror(& @1, state, "invalid extended swizzle selector");
769 yyerror(& @1, state, "invalid extended swizzle selector");
779 _mesa_symbol_table_find_symbol(state->st, 0, $1);
784 yyerror(& @1, state, "invalid operand variable");
788 yyerror(& @1, state, "invalid operand variable");
791 yyerror(& @1, state, "non-array access to array PARAM");
807 state->prog->InputsRead |= BITFIELD64_BIT($$.Base.Index);
809 if (!validate_inputs(& @1, state)) {
822 state->prog->InputsRead |= BITFIELD64_BIT($$.Base.Index);
824 if (!validate_inputs(& @1, state)) {
832 yyerror(& @3, state, "out of bounds array access");
840 state->prog->IndirectRegisterFiles |= (1 << $$.Base.File);
867 _mesa_symbol_table_find_symbol(state->st, 0, $1);
872 yyerror(& @1, state, "invalid operand variable");
875 yyerror(& @1, state, "invalid operand variable");
896 _mesa_symbol_table_find_symbol(state->st, 0, $1);
901 yyerror(& @1, state, "invalid operand variable");
904 yyerror(& @1, state, "array access to non-PARAM variable");
940 if (($1 < 0) || ($1 > (state->limits->MaxAddressOffset - 1))) {
944 yyerror(& @1, state, s);
954 if (($1 < 0) || ($1 > state->limits->MaxAddressOffset)) {
958 yyerror(& @1, state, s);
969 _mesa_symbol_table_find_symbol(state->st, 0, $1);
974 yyerror(& @1, state, "invalid array member");
977 yyerror(& @1, state,
989 yyerror(& @1, state, "invalid address component selector");
1000 yyerror(& @1, state,
1058 yyerror(& @1, state, (err_str != NULL)
1081 yyerror(& @1, state, (err_str != NULL)
1108 declare_variable(state, $2, at_attrib, & @2);
1115 state->InputsBound |= BITFIELD64_BIT(s->attrib_binding);
1117 if (!validate_inputs(& @4, state)) {
1148 if (!state->ctx->Extensions.EXT_secondary_color) {
1149 yyerror(& @2, state, "GL_EXT_secondary_color not supported");
1157 if (!state->ctx->Extensions.EXT_fog_coord) {
1158 yyerror(& @1, state, "GL_EXT_fog_coord not supported");
1170 yyerror(& @1, state, "GL_ARB_matrix_palette not supported");
1181 if ((unsigned) $1 >= state->limits->MaxAttribs) {
1182 yyerror(& @1, state, "invalid vertex attribute reference");
1216 declare_variable(state, $2, at_param, & @2);
1235 yyerror(& @4, state,
1240 declare_variable(state, $2, $6.type, & @2);
1262 if (($1 < 1) || ((unsigned) $1 > state->limits->MaxParameters)) {
1266 $1, state->limits->MaxParameters);
1267 yyerror(& @1, state, msg);
1299 initialize_symbol_from_state(state->prog, & $$, $1);
1305 initialize_symbol_from_param(state->prog, & $$, $1);
1311 initialize_symbol_from_const(state->prog, & $$, & $1, GL_TRUE);
1319 initialize_symbol_from_state(state->prog, & $$, $1);
1325 initialize_symbol_from_param(state->prog, & $$, $1);
1331 initialize_symbol_from_const(state->prog, & $$, & $1, GL_TRUE);
1339 initialize_symbol_from_state(state->prog, & $$, $1);
1345 initialize_symbol_from_param(state->prog, & $$, $1);
1351 initialize_symbol_from_const(state->prog, & $$, & $1, GL_FALSE);
1356 | STATE stateMatrixRows { memcpy($$, $2, sizeof($$)); }
1359 stateSingleItem: STATE stateMaterialItem { memcpy($$, $2, sizeof($$)); }
1360 | STATE stateLightItem { memcpy($$, $2, sizeof($$)); }
1361 | STATE stateLightModelItem { memcpy($$, $2, sizeof($$)); }
1362 | STATE stateLightProdItem { memcpy($$, $2, sizeof($$)); }
1363 | STATE stateTexGenItem { memcpy($$, $2, sizeof($$)); }
1364 | STATE stateTexEnvItem { memcpy($$, $2, sizeof($$)); }
1365 | STATE stateFogItem { memcpy($$, $2, sizeof($$)); }
1366 | STATE stateClipPlaneItem { memcpy($$, $2, sizeof($$)); }
1367 | STATE statePointItem { memcpy($$, $2, sizeof($$)); }
1368 | STATE stateMatrixRow { memcpy($$, $2, sizeof($$)); }
1369 | STATE stateDepthItem { memcpy($$, $2, sizeof($$)); }
1414 if (!state->ctx->Extensions.EXT_point_parameters) {
1415 yyerror(& @1, state, "GL_ARB_point_parameters not supported");
1499 if ((unsigned) $1 >= state->MaxLights) {
1500 yyerror(& @1, state, "invalid light selector");
1571 if ((unsigned) $1 >= state->MaxClipPlanes) {
1572 yyerror(& @1, state, "invalid clip plane selector");
1631 yyerror(& @3, state, "invalid matrix row range");
1675 yyerror(& @1, state, "invalid matrix row reference");
1705 yyerror(& @1, state, "GL_ARB_matrix_palette not supported");
1730 yyerror(& @1, state, "invalid modelview matrix index");
1747 if ((unsigned) $1 >= state->MaxProgramMatrices) {
1748 yyerror(& @1, state, "invalid program matrix selector");
1771 $$[0] = state->state_param_enum;
1793 $$[0] = state->state_param_enum;
1803 $$[0] = state->state_param_enum;
1824 $$[0] = state->state_param_enum;
1833 if ((unsigned) $1 >= state->limits->MaxEnvParams) {
1834 yyerror(& @1, state, "invalid environment parameter reference");
1843 if ((unsigned) $1 >= state->limits->MaxLocalParams) {
1844 yyerror(& @1, state, "invalid local parameter reference");
1950 if (!state->option.NV_fragment) {
1951 yyerror(& @1, state, "unexpected IDENTIFIER");
1962 yyerror(& @1, state, (err_str != NULL)
1982 if (!declare_variable(state, $3, $<integer>0, & @3)) {
1989 if (!declare_variable(state, $1, $<integer>0, & @1)) {
1999 declare_variable(state, $3, at_output, & @3);
2012 if (state->mode == ARB_vertex) {
2015 yyerror(& @2, state, "invalid program result name");
2021 if (state->mode == ARB_vertex) {
2024 yyerror(& @2, state, "invalid program result name");
2034 if (state->mode == ARB_vertex) {
2037 yyerror(& @2, state, "invalid program result name");
2043 if (state->mode == ARB_vertex) {
2046 yyerror(& @2, state, "invalid program result name");
2052 if (state->mode == ARB_fragment) {
2055 yyerror(& @2, state, "invalid program result name");
2069 if (state->mode == ARB_vertex) {
2072 if (state->option.DrawBuffers)
2080 if (state->mode == ARB_vertex) {
2081 yyerror(& @1, state, "invalid program result name");
2084 if (!state->option.DrawBuffers) {
2093 yyerror(& @1, state,
2098 } else if ($2 >= state->MaxDrawBuffers) {
2099 yyerror(& @1, state,
2108 if (state->mode == ARB_vertex) {
2111 yyerror(& @1, state, "invalid program result name");
2117 if (state->mode == ARB_vertex) {
2120 yyerror(& @1, state, "invalid program result name");
2132 if (state->mode == ARB_vertex) {
2135 yyerror(& @1, state, "invalid program result name");
2141 if (state->mode == ARB_vertex) {
2144 yyerror(& @1, state, "invalid program result name");
2174 if ((unsigned) $1 >= state->MaxTextureCoordUnits) {
2175 yyerror(& @1, state, "invalid texture coordinate unit selector");
2185 if ((unsigned) $1 >= state->MaxTextureImageUnits) {
2186 yyerror(& @1, state, "invalid texture image unit selector");
2196 if ((unsigned) $1 >= state->MaxTextureUnits) {
2197 yyerror(& @1, state, "invalid texture unit selector");
2208 _mesa_symbol_table_find_symbol(state->st, 0, $2);
2210 _mesa_symbol_table_find_symbol(state->st, 0, $4);
2218 yyerror(& @2, state, m);
2222 yyerror(& @4, state,
2226 _mesa_symbol_table_add_symbol(state->st, 0, $2, target);
2406 validate_inputs(struct YYLTYPE *locp, struct asm_parser_state *state)
2408 const GLbitfield64 inputs = state->prog->InputsRead | state->InputsBound;
2411 yyerror(locp, state, "illegal use of generic attribute and name attribute");
2420 declare_variable(struct asm_parser_state *state, char *name, enum asm_type t,
2425 _mesa_symbol_table_find_symbol(state->st, 0, name);
2429 yyerror(locp, state, "redeclared identifier");
2437 if (state->prog->NumTemporaries >= state->limits->MaxTemps) {
2438 yyerror(locp, state, "too many temporaries declared");
2443 s->temp_binding = state->prog->NumTemporaries;
2444 state->prog->NumTemporaries++;
2448 if (state->prog->NumAddressRegs >= state->limits->MaxAddressRegs) {
2449 yyerror(locp, state, "too many address registers declared");
2456 state->prog->NumAddressRegs++;
2463 _mesa_symbol_table_add_symbol(state->st, 0, s->name, s);
2464 s->next = state->sym;
2465 state->sym = s;
2663 yyerror(YYLTYPE *locp, struct asm_parser_state *state, const char *s)
2670 _mesa_error(state->ctx, GL_INVALID_OPERATION, "%s", err_str);
2676 _mesa_set_program_error(state->ctx, locp->position, err_str);
2686 GLsizei len, struct asm_parser_state *state)
2695 state->ctx = ctx;
2696 state->prog->Target = target;
2697 state->prog->Parameters = _mesa_new_parameter_list();
2709 state->prog->String = strz;
2711 state->st = _mesa_symbol_table_ctor();
2713 state->limits = (target == GL_VERTEX_PROGRAM_ARB)
2717 state->MaxTextureImageUnits = ctx->Const.MaxTextureImageUnits;
2718 state->MaxTextureCoordUnits = ctx->Const.MaxTextureCoordUnits;
2719 state->MaxTextureUnits = ctx->Const.MaxTextureUnits;
2720 state->MaxClipPlanes = ctx->Const.MaxClipPlanes;
2721 state->MaxLights = ctx->Const.MaxLights;
2722 state->MaxProgramMatrices = ctx->Const.MaxProgramMatrices;
2723 state->MaxDrawBuffers = ctx->Const.MaxDrawBuffers;
2725 state->state_param_enum = (target == GL_VERTEX_PROGRAM_ARB)
2730 _mesa_program_lexer_ctor(& state->scanner, state, (const char *) str, len);
2731 yyparse(state);
2732 _mesa_program_lexer_dtor(state->scanner);
2739 if (! _mesa_layout_parameters(state)) {
2746 yyerror(& loc, state, "invalid PARAM usage");
2754 state->prog->Instructions =
2755 _mesa_alloc_instructions(state->prog->NumInstructions + 1);
2756 inst = state->inst_head;
2757 for (i = 0; i < state->prog->NumInstructions; i++) {
2760 state->prog->Instructions[i] = inst->Base;
2766 const GLuint numInst = state->prog->NumInstructions;
2767 _mesa_init_instructions(state->prog->Instructions + numInst, 1);
2768 state->prog->Instructions[numInst].Opcode = OPCODE_END;
2770 state->prog->NumInstructions++;
2772 state->prog->NumParameters = state->prog->Parameters->NumParameters;
2773 state->prog->NumAttributes = _mesa_bitcount_64(state->prog->InputsRead);
2779 state->prog->NumNativeInstructions = state->prog->NumInstructions;
2780 state->prog->NumNativeTemporaries = state->prog->NumTemporaries;
2781 state->prog->NumNativeParameters = state->prog->NumParameters;
2782 state->prog->NumNativeAttributes = state->prog->NumAttributes;
2783 state->prog->NumNativeAddressRegs = state->prog->NumAddressRegs;
2788 for (inst = state->inst_head; inst != NULL; inst = temp) {
2793 state->inst_head = NULL;
2794 state->inst_tail = NULL;
2796 for (sym = state->sym; sym != NULL; sym = temp) {
2802 state->sym = NULL;
2804 _mesa_symbol_table_dtor(state->st);
2805 state->st = NULL;