Lines Matching refs:parseState
164 record_error(struct parse_state *parseState, const char *msg, int lineNo) in record_error() argument
169 lineStr = _mesa_find_line_column(parseState->start, in record_error()
170 parseState->pos, &line, &column); in record_error()
171 _mesa_debug(parseState->ctx, in record_error()
180 if (parseState->ctx->Program.ErrorString[0] == 0) { in record_error()
181 _mesa_set_program_error(parseState->ctx, in record_error()
182 parseState->pos - parseState->start, in record_error()
190 record_error(parseState, "Unexpected end of input.", __LINE__); \
196 record_error(parseState, msg, __LINE__); \
204 record_error(parseState, err, __LINE__); \
293 GetToken(struct parse_state *parseState, GLubyte *token) in GetToken() argument
295 const GLubyte *str = parseState->pos; in GetToken()
308 parseState->curLine = str + i + 1; in GetToken()
313 parseState->curLine = str + i + 1; in GetToken()
356 Parse_Token(struct parse_state *parseState, GLubyte *token) in Parse_Token() argument
359 i = GetToken(parseState, token); in Parse_Token()
361 parseState->pos += (-i); in Parse_Token()
364 parseState->pos += i; in Parse_Token()
373 Peek_Token(struct parse_state *parseState, GLubyte *token) in Peek_Token() argument
376 i = GetToken(parseState, token); in Peek_Token()
378 parseState->pos += (-i); in Peek_Token()
382 parseState->pos += (i - len); in Peek_Token()
402 Parse_String(struct parse_state *parseState, const char *pattern) in Parse_String() argument
408 while (IsWhitespace(*parseState->pos) || *parseState->pos == '#') { in Parse_String()
409 if (*parseState->pos == '#') { in Parse_String()
410 while (*parseState->pos && (*parseState->pos != '\n' && *parseState->pos != '\r')) { in Parse_String()
411 parseState->pos += 1; in Parse_String()
413 if (*parseState->pos == '\n' || *parseState->pos == '\r') in Parse_String()
414 parseState->curLine = parseState->pos + 1; in Parse_String()
418 if (*parseState->pos == '\n' || *parseState->pos == '\r') in Parse_String()
419 parseState->curLine = parseState->pos + 1; in Parse_String()
420 parseState->pos += 1; in Parse_String()
425 m = parseState->pos; in Parse_String()
431 parseState->pos = m; in Parse_String()
438 Parse_Identifier(struct parse_state *parseState, GLubyte *ident) in Parse_Identifier() argument
440 if (!Parse_Token(parseState, ident)) in Parse_Identifier()
455 Parse_ScalarConstant(struct parse_state *parseState, GLfloat *number) in Parse_ScalarConstant() argument
459 *number = (GLfloat) _mesa_strtof((const char *) parseState->pos, &end); in Parse_ScalarConstant()
461 if (end && end > (char *) parseState->pos) { in Parse_ScalarConstant()
463 parseState->pos = (GLubyte *) end; in Parse_ScalarConstant()
473 if (!Parse_Identifier(parseState, ident)) in Parse_ScalarConstant()
475 constant = (GLfloat *)_mesa_lookup_parameter_value(parseState->parameters, in Parse_ScalarConstant()
499 Parse_VectorConstant(struct parse_state *parseState, GLfloat *vec) in Parse_VectorConstant() argument
505 if (!Parse_ScalarConstant(parseState, vec+0)) /* X */ in Parse_VectorConstant()
508 if (Parse_String(parseState, "}")) { in Parse_VectorConstant()
512 if (!Parse_String(parseState, ",")) in Parse_VectorConstant()
515 if (!Parse_ScalarConstant(parseState, vec+1)) /* Y */ in Parse_VectorConstant()
518 if (Parse_String(parseState, "}")) { in Parse_VectorConstant()
522 if (!Parse_String(parseState, ",")) in Parse_VectorConstant()
525 if (!Parse_ScalarConstant(parseState, vec+2)) /* Z */ in Parse_VectorConstant()
528 if (Parse_String(parseState, "}")) { in Parse_VectorConstant()
532 if (!Parse_String(parseState, ",")) in Parse_VectorConstant()
535 if (!Parse_ScalarConstant(parseState, vec+3)) /* W */ in Parse_VectorConstant()
538 if (!Parse_String(parseState, "}")) in Parse_VectorConstant()
550 Parse_VectorOrScalarConstant(struct parse_state *parseState, GLfloat *vec) in Parse_VectorOrScalarConstant() argument
552 if (Parse_String(parseState, "{")) { in Parse_VectorOrScalarConstant()
553 return Parse_VectorConstant(parseState, vec); in Parse_VectorOrScalarConstant()
556 GLboolean b = Parse_ScalarConstant(parseState, vec); in Parse_VectorOrScalarConstant()
570 Parse_TextureImageId(struct parse_state *parseState, in Parse_TextureImageId() argument
576 if (!Parse_Token(parseState, imageSrc)) in Parse_TextureImageId()
591 if (!Parse_String(parseState, ",")) in Parse_TextureImageId()
594 if (Parse_String(parseState, "1D")) { in Parse_TextureImageId()
597 else if (Parse_String(parseState, "2D")) { in Parse_TextureImageId()
600 else if (Parse_String(parseState, "3D")) { in Parse_TextureImageId()
603 else if (Parse_String(parseState, "CUBE")) { in Parse_TextureImageId()
606 else if (Parse_String(parseState, "RECT")) { in Parse_TextureImageId()
614 parseState->texturesUsed[*texUnit] |= (1 << *texTarget); in Parse_TextureImageId()
615 if (_mesa_bitcount(parseState->texturesUsed[*texUnit]) > 1) { in Parse_TextureImageId()
666 Parse_CondCodeMask(struct parse_state *parseState, in Parse_CondCodeMask() argument
669 if (Parse_String(parseState, "EQ")) in Parse_CondCodeMask()
671 else if (Parse_String(parseState, "GE")) in Parse_CondCodeMask()
673 else if (Parse_String(parseState, "GT")) in Parse_CondCodeMask()
675 else if (Parse_String(parseState, "LE")) in Parse_CondCodeMask()
677 else if (Parse_String(parseState, "LT")) in Parse_CondCodeMask()
679 else if (Parse_String(parseState, "NE")) in Parse_CondCodeMask()
681 else if (Parse_String(parseState, "TR")) in Parse_CondCodeMask()
683 else if (Parse_String(parseState, "FL")) in Parse_CondCodeMask()
689 if (Parse_String(parseState, ".")) { in Parse_CondCodeMask()
693 if (!Parse_Token(parseState, token)) /* get xyzw suffix */ in Parse_CondCodeMask()
710 Parse_TempReg(struct parse_state *parseState, GLint *tempRegNum) in Parse_TempReg() argument
715 if (!Parse_Token(parseState, token)) in Parse_TempReg()
740 Parse_DummyReg(struct parse_state *parseState, GLint *regNum) in Parse_DummyReg() argument
742 if (Parse_String(parseState, "RC")) { in Parse_DummyReg()
745 else if (Parse_String(parseState, "HC")) { in Parse_DummyReg()
760 Parse_ProgramParamReg(struct parse_state *parseState, GLint *regNum) in Parse_ProgramParamReg() argument
764 if (!Parse_String(parseState, "p[")) in Parse_ProgramParamReg()
767 if (!Parse_Token(parseState, token)) in Parse_ProgramParamReg()
781 if (!Parse_String(parseState, "]")) in Parse_ProgramParamReg()
792 Parse_FragReg(struct parse_state *parseState, GLint *tempRegNum) in Parse_FragReg() argument
798 if (!Parse_String(parseState, "f[")) in Parse_FragReg()
802 if (!Parse_Token(parseState, token)) { in Parse_FragReg()
808 parseState->inputsRead |= (1 << j); in Parse_FragReg()
818 if (!Parse_String(parseState, "]")) in Parse_FragReg()
826 Parse_OutputReg(struct parse_state *parseState, GLint *outputRegNum) in Parse_OutputReg() argument
831 if (!Parse_String(parseState, "o[")) in Parse_OutputReg()
835 if (!Parse_Token(parseState, token)) in Parse_OutputReg()
843 parseState->outputsWritten |= (1 << FRAG_RESULT_COLOR); in Parse_OutputReg()
847 parseState->outputsWritten |= (1 << FRAG_RESULT_DEPTH); in Parse_OutputReg()
854 if (!Parse_String(parseState, "]")) in Parse_OutputReg()
862 Parse_MaskedDstReg(struct parse_state *parseState, in Parse_MaskedDstReg() argument
869 if (!Peek_Token(parseState, token)) in Parse_MaskedDstReg()
876 if (!Parse_DummyReg(parseState, &idx)) in Parse_MaskedDstReg()
883 if (!Parse_TempReg(parseState, &idx)) in Parse_MaskedDstReg()
890 if (!Parse_OutputReg(parseState, &idx)) in Parse_MaskedDstReg()
899 if (Parse_String(parseState, ".")) { in Parse_MaskedDstReg()
903 if (!Parse_Token(parseState, token)) /* get xyzw writemask */ in Parse_MaskedDstReg()
934 if (Parse_String(parseState, "(")) { in Parse_MaskedDstReg()
937 if (!Parse_CondCodeMask(parseState, dstReg)) in Parse_MaskedDstReg()
940 if (!Parse_String(parseState, ")")) /* consume ")" */ in Parse_MaskedDstReg()
961 Parse_VectorSrc(struct parse_state *parseState, in Parse_VectorSrc() argument
972 if (Parse_String(parseState, "-")) in Parse_VectorSrc()
974 else if (Parse_String(parseState, "+")) in Parse_VectorSrc()
977 if (Parse_String(parseState, "|")) { in Parse_VectorSrc()
981 if (Parse_String(parseState, "-")) in Parse_VectorSrc()
983 else if (Parse_String(parseState, "+")) in Parse_VectorSrc()
997 if (!Peek_Token(parseState, token)) in Parse_VectorSrc()
1005 if (!Parse_TempReg(parseState, &idx)) in Parse_VectorSrc()
1012 if (!Parse_FragReg(parseState, &idx)) in Parse_VectorSrc()
1019 if (!Parse_ProgramParamReg(parseState, &idx)) in Parse_VectorSrc()
1026 if (!Parse_Identifier(parseState, ident)) in Parse_VectorSrc()
1028 paramIndex = _mesa_lookup_parameter_index(parseState->parameters, in Parse_VectorSrc()
1040 if (!Parse_ScalarConstant(parseState, values)) in Parse_VectorSrc()
1042 paramIndex = _mesa_add_unnamed_constant(parseState->parameters, in Parse_VectorSrc()
1052 (void) Parse_String(parseState, "{"); in Parse_VectorSrc()
1053 if (!Parse_VectorConstant(parseState, values)) in Parse_VectorSrc()
1055 paramIndex = _mesa_add_unnamed_constant(parseState->parameters, in Parse_VectorSrc()
1069 if (Parse_String(parseState, ".")) { in Parse_VectorSrc()
1072 if (!Parse_Token(parseState, token)) in Parse_VectorSrc()
1082 if (srcReg->Abs && !Parse_String(parseState, "|")) { in Parse_VectorSrc()
1091 Parse_ScalarSrcReg(struct parse_state *parseState, in Parse_ScalarSrcReg() argument
1103 if (Parse_String(parseState, "-")) in Parse_ScalarSrcReg()
1105 else if (Parse_String(parseState, "+")) in Parse_ScalarSrcReg()
1108 if (Parse_String(parseState, "|")) { in Parse_ScalarSrcReg()
1112 if (Parse_String(parseState, "-")) in Parse_ScalarSrcReg()
1114 else if (Parse_String(parseState, "+")) in Parse_ScalarSrcReg()
1127 if (!Peek_Token(parseState, token)) in Parse_ScalarSrcReg()
1133 if (!Parse_TempReg(parseState, &idx)) in Parse_ScalarSrcReg()
1139 if (!Parse_FragReg(parseState, &idx)) in Parse_ScalarSrcReg()
1147 (void) Parse_String(parseState, "{"); in Parse_ScalarSrcReg()
1148 if (!Parse_VectorConstant(parseState, values)) in Parse_ScalarSrcReg()
1150 paramIndex = _mesa_add_unnamed_constant(parseState->parameters, in Parse_ScalarSrcReg()
1160 if (!Parse_Identifier(parseState, ident)) in Parse_ScalarSrcReg()
1162 paramIndex = _mesa_lookup_parameter_index(parseState->parameters, in Parse_ScalarSrcReg()
1174 if (!Parse_ScalarConstant(parseState, values)) in Parse_ScalarSrcReg()
1176 paramIndex = _mesa_add_unnamed_constant(parseState->parameters, in Parse_ScalarSrcReg()
1190 if (!Parse_String(parseState, ".")) in Parse_ScalarSrcReg()
1193 if (!Parse_Token(parseState, token)) in Parse_ScalarSrcReg()
1214 if (srcReg->Abs && !Parse_String(parseState, "|")) { in Parse_ScalarSrcReg()
1223 Parse_PrintInstruction(struct parse_state *parseState, in Parse_PrintInstruction() argument
1232 if (!Parse_String(parseState, "'")) in Parse_PrintInstruction()
1235 str = parseState->pos; in Parse_PrintInstruction()
1238 parseState->pos += len + 1; in Parse_PrintInstruction()
1245 if (Parse_String(parseState, ",")) { in Parse_PrintInstruction()
1248 GetToken(parseState, token); in Parse_PrintInstruction()
1251 if (!Parse_OutputReg(parseState, &idx)) in Parse_PrintInstruction()
1258 if (!Parse_VectorSrc(parseState, &inst->SrcReg[0])) in Parse_PrintInstruction()
1275 Parse_InstructionSequence(struct parse_state *parseState, in Parse_InstructionSequence() argument
1279 struct prog_instruction *inst = program + parseState->numInst; in Parse_InstructionSequence()
1287 if (Parse_String(parseState, "DEFINE")) { in Parse_InstructionSequence()
1290 if (!Parse_Identifier(parseState, id)) in Parse_InstructionSequence()
1293 if (!Parse_String(parseState, "=")) in Parse_InstructionSequence()
1295 if (!Parse_VectorOrScalarConstant(parseState, value)) in Parse_InstructionSequence()
1297 if (!Parse_String(parseState, ";")) in Parse_InstructionSequence()
1299 if (_mesa_lookup_parameter_index(parseState->parameters, in Parse_InstructionSequence()
1303 _mesa_add_named_parameter(parseState->parameters, in Parse_InstructionSequence()
1307 else if (Parse_String(parseState, "DECLARE")) { in Parse_InstructionSequence()
1310 if (!Parse_Identifier(parseState, id)) in Parse_InstructionSequence()
1313 if (Parse_String(parseState, "=")) { in Parse_InstructionSequence()
1314 if (!Parse_VectorOrScalarConstant(parseState, value)) in Parse_InstructionSequence()
1317 if (!Parse_String(parseState, ";")) in Parse_InstructionSequence()
1319 if (_mesa_lookup_parameter_index(parseState->parameters, in Parse_InstructionSequence()
1323 _mesa_add_named_parameter(parseState->parameters, in Parse_InstructionSequence()
1327 else if (Parse_String(parseState, "END")) { in Parse_InstructionSequence()
1329 parseState->numInst++; in Parse_InstructionSequence()
1330 if (Parse_Token(parseState, token)) { in Parse_InstructionSequence()
1339 if (!Parse_Token(parseState, token)) { in Parse_InstructionSequence()
1360 if (!Parse_MaskedDstReg(parseState, &inst->DstReg)) in Parse_InstructionSequence()
1362 if (!Parse_String(parseState, ",")) in Parse_InstructionSequence()
1370 if (!Parse_CondCodeMask(parseState, &inst->DstReg)) in Parse_InstructionSequence()
1379 if (!Parse_VectorSrc(parseState, &inst->SrcReg[0])) in Parse_InstructionSequence()
1383 if (!Parse_VectorSrc(parseState, &inst->SrcReg[0])) in Parse_InstructionSequence()
1385 if (!Parse_String(parseState, ",")) in Parse_InstructionSequence()
1387 if (!Parse_VectorSrc(parseState, &inst->SrcReg[1])) in Parse_InstructionSequence()
1391 if (!Parse_VectorSrc(parseState, &inst->SrcReg[0])) in Parse_InstructionSequence()
1393 if (!Parse_String(parseState, ",")) in Parse_InstructionSequence()
1395 if (!Parse_VectorSrc(parseState, &inst->SrcReg[1])) in Parse_InstructionSequence()
1397 if (!Parse_String(parseState, ",")) in Parse_InstructionSequence()
1399 if (!Parse_VectorSrc(parseState, &inst->SrcReg[2])) in Parse_InstructionSequence()
1403 if (!Parse_ScalarSrcReg(parseState, &inst->SrcReg[0])) in Parse_InstructionSequence()
1407 if (!Parse_ScalarSrcReg(parseState, &inst->SrcReg[0])) in Parse_InstructionSequence()
1409 if (!Parse_String(parseState, ",")) in Parse_InstructionSequence()
1411 if (!Parse_ScalarSrcReg(parseState, &inst->SrcReg[1])) in Parse_InstructionSequence()
1419 if (!Parse_VectorSrc(parseState, &inst->SrcReg[0])) in Parse_InstructionSequence()
1421 if (!Parse_String(parseState, ",")) in Parse_InstructionSequence()
1423 if (!Parse_TextureImageId(parseState, &unit, &idx)) in Parse_InstructionSequence()
1430 if (!Parse_VectorSrc(parseState, &inst->SrcReg[0])) in Parse_InstructionSequence()
1432 if (!Parse_String(parseState, ",")) in Parse_InstructionSequence()
1434 if (!Parse_VectorSrc(parseState, &inst->SrcReg[1])) in Parse_InstructionSequence()
1436 if (!Parse_String(parseState, ",")) in Parse_InstructionSequence()
1438 if (!Parse_VectorSrc(parseState, &inst->SrcReg[2])) in Parse_InstructionSequence()
1440 if (!Parse_String(parseState, ",")) in Parse_InstructionSequence()
1442 if (!Parse_TextureImageId(parseState, &unit, &idx)) in Parse_InstructionSequence()
1448 if (!Parse_PrintInstruction(parseState, inst)) in Parse_InstructionSequence()
1453 if (!Parse_String(parseState, ";")) in Parse_InstructionSequence()
1456 parseState->numInst++; in Parse_InstructionSequence()
1458 if (parseState->numInst >= MAX_NV_FRAGMENT_PROGRAM_INSTRUCTIONS) in Parse_InstructionSequence()
1477 struct parse_state parseState; in _mesa_parse_nv_fragment_program() local
1493 memset(&parseState, 0, sizeof(struct parse_state)); in _mesa_parse_nv_fragment_program()
1494 parseState.ctx = ctx; in _mesa_parse_nv_fragment_program()
1495 parseState.start = programString; in _mesa_parse_nv_fragment_program()
1496 parseState.program = program; in _mesa_parse_nv_fragment_program()
1497 parseState.numInst = 0; in _mesa_parse_nv_fragment_program()
1498 parseState.curLine = programString; in _mesa_parse_nv_fragment_program()
1499 parseState.parameters = _mesa_new_parameter_list(); in _mesa_parse_nv_fragment_program()
1507 parseState.pos = programString + 7; in _mesa_parse_nv_fragment_program()
1530 if (Parse_InstructionSequence(&parseState, instBuffer)) { in _mesa_parse_nv_fragment_program()
1534 if (parseState.outputsWritten == 0) { in _mesa_parse_nv_fragment_program()
1542 assert(parseState.numInst <= MAX_NV_FRAGMENT_PROGRAM_INSTRUCTIONS); in _mesa_parse_nv_fragment_program()
1543 newInst = _mesa_alloc_instructions(parseState.numInst); in _mesa_parse_nv_fragment_program()
1548 _mesa_copy_instructions(newInst, instBuffer, parseState.numInst); in _mesa_parse_nv_fragment_program()
1561 program->Base.NumInstructions = parseState.numInst; in _mesa_parse_nv_fragment_program()
1562 program->Base.InputsRead = parseState.inputsRead; in _mesa_parse_nv_fragment_program()
1563 program->Base.OutputsWritten = parseState.outputsWritten; in _mesa_parse_nv_fragment_program()
1565 program->Base.TexturesUsed[u] = parseState.texturesUsed[u]; in _mesa_parse_nv_fragment_program()
1568 program->Base.Parameters = parseState.parameters; in _mesa_parse_nv_fragment_program()