Lines Matching refs:parseState
76 record_error(struct parse_state *parseState, const char *msg, int lineNo) in record_error() argument
81 lineStr = _mesa_find_line_column(parseState->start, in record_error()
82 parseState->pos, &line, &column); in record_error()
83 _mesa_debug(parseState->ctx, in record_error()
92 if (parseState->ctx->Program.ErrorString[0] == 0) { in record_error()
93 _mesa_set_program_error(parseState->ctx, in record_error()
94 parseState->pos - parseState->start, in record_error()
102 record_error(parseState, "Unexpected end of input.", __LINE__); \
108 record_error(parseState, msg, __LINE__); \
116 record_error(parseState, err, __LINE__); \
148 GetToken(struct parse_state *parseState, GLubyte *token) in GetToken() argument
150 const GLubyte *str = parseState->pos; in GetToken()
163 parseState->curLine = str + i + 1; in GetToken()
168 parseState->curLine = str + i + 1; in GetToken()
211 Parse_Token(struct parse_state *parseState, GLubyte *token) in Parse_Token() argument
214 i = GetToken(parseState, token); in Parse_Token()
216 parseState->pos += (-i); in Parse_Token()
219 parseState->pos += i; in Parse_Token()
228 Peek_Token(struct parse_state *parseState, GLubyte *token) in Peek_Token() argument
231 i = GetToken(parseState, token); in Peek_Token()
233 parseState->pos += (-i); in Peek_Token()
237 parseState->pos += (i - len); in Peek_Token()
248 Parse_String(struct parse_state *parseState, const char *pattern) in Parse_String() argument
254 while (IsWhitespace(*parseState->pos) || *parseState->pos == '#') { in Parse_String()
255 if (*parseState->pos == '#') { in Parse_String()
256 while (*parseState->pos && (*parseState->pos != '\n' && *parseState->pos != '\r')) { in Parse_String()
257 parseState->pos += 1; in Parse_String()
259 if (*parseState->pos == '\n' || *parseState->pos == '\r') in Parse_String()
260 parseState->curLine = parseState->pos + 1; in Parse_String()
264 if (*parseState->pos == '\n' || *parseState->pos == '\r') in Parse_String()
265 parseState->curLine = parseState->pos + 1; in Parse_String()
266 parseState->pos += 1; in Parse_String()
271 m = parseState->pos; in Parse_String()
277 parseState->pos = m; in Parse_String()
302 Parse_TempReg(struct parse_state *parseState, GLint *tempRegNum) in Parse_TempReg() argument
307 if (!Parse_Token(parseState, token)) in Parse_TempReg()
330 Parse_AddrReg(struct parse_state *parseState) in Parse_AddrReg() argument
333 if (!Parse_String(parseState, "A0")) in Parse_AddrReg()
337 if (!Parse_String(parseState, ".")) in Parse_AddrReg()
341 if (!Parse_String(parseState, "x")) in Parse_AddrReg()
352 Parse_AbsParamReg(struct parse_state *parseState, GLint *regNum) in Parse_AbsParamReg() argument
356 if (!Parse_String(parseState, "c")) in Parse_AbsParamReg()
359 if (!Parse_String(parseState, "[")) in Parse_AbsParamReg()
362 if (!Parse_Token(parseState, token)) in Parse_AbsParamReg()
376 if (!Parse_String(parseState, "]")) in Parse_AbsParamReg()
384 Parse_ParamReg(struct parse_state *parseState, struct prog_src_register *srcReg) in Parse_ParamReg() argument
388 if (!Parse_String(parseState, "c")) in Parse_ParamReg()
391 if (!Parse_String(parseState, "[")) in Parse_ParamReg()
394 if (!Peek_Token(parseState, token)) in Parse_ParamReg()
400 (void) Parse_Token(parseState, token); in Parse_ParamReg()
409 if (!Parse_AddrReg(parseState)) in Parse_ParamReg()
414 parseState->indirectRegisterFiles |= (1 << srcReg->File); in Parse_ParamReg()
416 if (!Peek_Token(parseState, token)) in Parse_ParamReg()
421 (void) Parse_Token(parseState, token); /* consume +/- */ in Parse_ParamReg()
424 if (!Parse_Token(parseState, token)) in Parse_ParamReg()
453 if (!Parse_String(parseState, "]")) in Parse_ParamReg()
464 Parse_AttribReg(struct parse_state *parseState, GLint *tempRegNum) in Parse_AttribReg() argument
470 if (!Parse_String(parseState, "v")) in Parse_AttribReg()
474 if (!Parse_String(parseState, "[")) in Parse_AttribReg()
478 if (!Parse_Token(parseState, token)) in Parse_AttribReg()
481 if (parseState->isStateProgram && token[0] != '0') in Parse_AttribReg()
504 if (!Parse_String(parseState, "]")) in Parse_AttribReg()
512 Parse_OutputReg(struct parse_state *parseState, GLint *outputRegNum) in Parse_OutputReg() argument
518 if (!Parse_String(parseState, "o")) in Parse_OutputReg()
522 if (!Parse_String(parseState, "[")) in Parse_OutputReg()
526 if (!Parse_Token(parseState, token)) in Parse_OutputReg()
529 if (parseState->isPositionInvariant) in Parse_OutputReg()
545 if (!Parse_String(parseState, "]")) in Parse_OutputReg()
553 Parse_MaskedDstReg(struct parse_state *parseState, struct prog_dst_register *dstReg) in Parse_MaskedDstReg() argument
559 if (!Peek_Token(parseState, token)) in Parse_MaskedDstReg()
565 if (!Parse_TempReg(parseState, &idx)) in Parse_MaskedDstReg()
569 else if (!parseState->isStateProgram && token[0] == 'o') { in Parse_MaskedDstReg()
572 if (!Parse_OutputReg(parseState, &idx)) in Parse_MaskedDstReg()
576 else if (parseState->isStateProgram && token[0] == 'c' && in Parse_MaskedDstReg()
577 parseState->isStateProgram) { in Parse_MaskedDstReg()
581 if (!Parse_AbsParamReg(parseState, &idx)) in Parse_MaskedDstReg()
590 if (!Peek_Token(parseState, token)) in Parse_MaskedDstReg()
597 if (!Parse_String(parseState, ".")) in Parse_MaskedDstReg()
600 if (!Parse_Token(parseState, token)) in Parse_MaskedDstReg()
634 Parse_SwizzleSrcReg(struct parse_state *parseState, struct prog_src_register *srcReg) in Parse_SwizzleSrcReg() argument
642 if (!Peek_Token(parseState, token)) in Parse_SwizzleSrcReg()
645 (void) Parse_String(parseState, "-"); in Parse_SwizzleSrcReg()
647 if (!Peek_Token(parseState, token)) in Parse_SwizzleSrcReg()
657 if (!Parse_TempReg(parseState, &idx)) in Parse_SwizzleSrcReg()
662 if (!Parse_ParamReg(parseState, srcReg)) in Parse_SwizzleSrcReg()
667 if (!Parse_AttribReg(parseState, &idx)) in Parse_SwizzleSrcReg()
679 if (!Peek_Token(parseState, token)) in Parse_SwizzleSrcReg()
682 (void) Parse_String(parseState, "."); /* consume . */ in Parse_SwizzleSrcReg()
684 if (!Parse_Token(parseState, token)) in Parse_SwizzleSrcReg()
728 Parse_ScalarSrcReg(struct parse_state *parseState, struct prog_src_register *srcReg) in Parse_ScalarSrcReg() argument
736 if (!Peek_Token(parseState, token)) in Parse_ScalarSrcReg()
740 (void) Parse_String(parseState, "-"); /* consume '-' */ in Parse_ScalarSrcReg()
741 if (!Peek_Token(parseState, token)) in Parse_ScalarSrcReg()
751 if (!Parse_TempReg(parseState, &idx)) in Parse_ScalarSrcReg()
756 if (!Parse_ParamReg(parseState, srcReg)) in Parse_ScalarSrcReg()
761 if (!Parse_AttribReg(parseState, &idx)) in Parse_ScalarSrcReg()
770 if (!Parse_String(parseState, ".")) in Parse_ScalarSrcReg()
773 if (!Parse_Token(parseState, token)) in Parse_ScalarSrcReg()
797 Parse_UnaryOpInstruction(struct parse_state *parseState, in Parse_UnaryOpInstruction() argument
801 if (opcode == OPCODE_ABS && !parseState->isVersion1_1) in Parse_UnaryOpInstruction()
807 if (!Parse_MaskedDstReg(parseState, &inst->DstReg)) in Parse_UnaryOpInstruction()
811 if (!Parse_String(parseState, ",")) in Parse_UnaryOpInstruction()
815 if (!Parse_SwizzleSrcReg(parseState, &inst->SrcReg[0])) in Parse_UnaryOpInstruction()
819 if (!Parse_String(parseState, ";")) in Parse_UnaryOpInstruction()
827 Parse_BiOpInstruction(struct parse_state *parseState, in Parse_BiOpInstruction() argument
831 if (opcode == OPCODE_DPH && !parseState->isVersion1_1) in Parse_BiOpInstruction()
833 if (opcode == OPCODE_SUB && !parseState->isVersion1_1) in Parse_BiOpInstruction()
839 if (!Parse_MaskedDstReg(parseState, &inst->DstReg)) in Parse_BiOpInstruction()
843 if (!Parse_String(parseState, ",")) in Parse_BiOpInstruction()
847 if (!Parse_SwizzleSrcReg(parseState, &inst->SrcReg[0])) in Parse_BiOpInstruction()
851 if (!Parse_String(parseState, ",")) in Parse_BiOpInstruction()
855 if (!Parse_SwizzleSrcReg(parseState, &inst->SrcReg[1])) in Parse_BiOpInstruction()
859 if (!Parse_String(parseState, ";")) in Parse_BiOpInstruction()
879 Parse_TriOpInstruction(struct parse_state *parseState, in Parse_TriOpInstruction() argument
886 if (!Parse_MaskedDstReg(parseState, &inst->DstReg)) in Parse_TriOpInstruction()
890 if (!Parse_String(parseState, ",")) in Parse_TriOpInstruction()
894 if (!Parse_SwizzleSrcReg(parseState, &inst->SrcReg[0])) in Parse_TriOpInstruction()
898 if (!Parse_String(parseState, ",")) in Parse_TriOpInstruction()
902 if (!Parse_SwizzleSrcReg(parseState, &inst->SrcReg[1])) in Parse_TriOpInstruction()
906 if (!Parse_String(parseState, ",")) in Parse_TriOpInstruction()
910 if (!Parse_SwizzleSrcReg(parseState, &inst->SrcReg[2])) in Parse_TriOpInstruction()
914 if (!Parse_String(parseState, ";")) in Parse_TriOpInstruction()
946 Parse_ScalarInstruction(struct parse_state *parseState, in Parse_ScalarInstruction() argument
950 if (opcode == OPCODE_RCC && !parseState->isVersion1_1) in Parse_ScalarInstruction()
956 if (!Parse_MaskedDstReg(parseState, &inst->DstReg)) in Parse_ScalarInstruction()
960 if (!Parse_String(parseState, ",")) in Parse_ScalarInstruction()
964 if (!Parse_ScalarSrcReg(parseState, &inst->SrcReg[0])) in Parse_ScalarInstruction()
968 if (!Parse_String(parseState, ";")) in Parse_ScalarInstruction()
976 Parse_AddressInstruction(struct parse_state *parseState, struct prog_instruction *inst) in Parse_AddressInstruction() argument
986 if (!Parse_AddrReg(parseState)) in Parse_AddressInstruction()
990 if (!Parse_String(parseState, ",")) in Parse_AddressInstruction()
994 if (!Parse_ScalarSrcReg(parseState, &inst->SrcReg[0])) in Parse_AddressInstruction()
998 if (!Parse_String(parseState, ";")) in Parse_AddressInstruction()
1006 Parse_EndInstruction(struct parse_state *parseState, struct prog_instruction *inst) in Parse_EndInstruction() argument
1013 if (Parse_Token(parseState, token)) in Parse_EndInstruction()
1034 Parse_PrintInstruction(struct parse_state *parseState, struct prog_instruction *inst) in Parse_PrintInstruction() argument
1046 if (!Parse_String(parseState, "'")) in Parse_PrintInstruction()
1049 str = parseState->pos; in Parse_PrintInstruction()
1052 parseState->pos += len + 1; in Parse_PrintInstruction()
1060 if (Parse_String(parseState, ",")) { in Parse_PrintInstruction()
1063 if (!Peek_Token(parseState, token)) in Parse_PrintInstruction()
1075 if (!Parse_TempReg(parseState, &idx)) in Parse_PrintInstruction()
1081 if (!Parse_ParamReg(parseState, srcReg)) in Parse_PrintInstruction()
1086 if (!Parse_AttribReg(parseState, &idx)) in Parse_PrintInstruction()
1092 if (!Parse_OutputReg(parseState, &idx)) in Parse_PrintInstruction()
1105 if (!Parse_String(parseState, ";")) in Parse_PrintInstruction()
1113 Parse_OptionSequence(struct parse_state *parseState, in Parse_OptionSequence() argument
1118 if (!Parse_String(parseState, "OPTION")) in Parse_OptionSequence()
1120 if (Parse_String(parseState, "NV_position_invariant")) { in Parse_OptionSequence()
1121 parseState->isPositionInvariant = GL_TRUE; in Parse_OptionSequence()
1126 if (!Parse_String(parseState, ";")) in Parse_OptionSequence()
1133 Parse_InstructionSequence(struct parse_state *parseState, in Parse_InstructionSequence() argument
1137 struct prog_instruction *inst = program + parseState->numInst; in Parse_InstructionSequence()
1142 if (Parse_String(parseState, "MOV")) { in Parse_InstructionSequence()
1143 if (!Parse_UnaryOpInstruction(parseState, inst, OPCODE_MOV)) in Parse_InstructionSequence()
1146 else if (Parse_String(parseState, "LIT")) { in Parse_InstructionSequence()
1147 if (!Parse_UnaryOpInstruction(parseState, inst, OPCODE_LIT)) in Parse_InstructionSequence()
1150 else if (Parse_String(parseState, "ABS")) { in Parse_InstructionSequence()
1151 if (!Parse_UnaryOpInstruction(parseState, inst, OPCODE_ABS)) in Parse_InstructionSequence()
1154 else if (Parse_String(parseState, "MUL")) { in Parse_InstructionSequence()
1155 if (!Parse_BiOpInstruction(parseState, inst, OPCODE_MUL)) in Parse_InstructionSequence()
1158 else if (Parse_String(parseState, "ADD")) { in Parse_InstructionSequence()
1159 if (!Parse_BiOpInstruction(parseState, inst, OPCODE_ADD)) in Parse_InstructionSequence()
1162 else if (Parse_String(parseState, "DP3")) { in Parse_InstructionSequence()
1163 if (!Parse_BiOpInstruction(parseState, inst, OPCODE_DP3)) in Parse_InstructionSequence()
1166 else if (Parse_String(parseState, "DP4")) { in Parse_InstructionSequence()
1167 if (!Parse_BiOpInstruction(parseState, inst, OPCODE_DP4)) in Parse_InstructionSequence()
1170 else if (Parse_String(parseState, "DST")) { in Parse_InstructionSequence()
1171 if (!Parse_BiOpInstruction(parseState, inst, OPCODE_DST)) in Parse_InstructionSequence()
1174 else if (Parse_String(parseState, "MIN")) { in Parse_InstructionSequence()
1175 if (!Parse_BiOpInstruction(parseState, inst, OPCODE_MIN)) in Parse_InstructionSequence()
1178 else if (Parse_String(parseState, "MAX")) { in Parse_InstructionSequence()
1179 if (!Parse_BiOpInstruction(parseState, inst, OPCODE_MAX)) in Parse_InstructionSequence()
1182 else if (Parse_String(parseState, "SLT")) { in Parse_InstructionSequence()
1183 if (!Parse_BiOpInstruction(parseState, inst, OPCODE_SLT)) in Parse_InstructionSequence()
1186 else if (Parse_String(parseState, "SGE")) { in Parse_InstructionSequence()
1187 if (!Parse_BiOpInstruction(parseState, inst, OPCODE_SGE)) in Parse_InstructionSequence()
1190 else if (Parse_String(parseState, "DPH")) { in Parse_InstructionSequence()
1191 if (!Parse_BiOpInstruction(parseState, inst, OPCODE_DPH)) in Parse_InstructionSequence()
1194 else if (Parse_String(parseState, "SUB")) { in Parse_InstructionSequence()
1195 if (!Parse_BiOpInstruction(parseState, inst, OPCODE_SUB)) in Parse_InstructionSequence()
1198 else if (Parse_String(parseState, "MAD")) { in Parse_InstructionSequence()
1199 if (!Parse_TriOpInstruction(parseState, inst, OPCODE_MAD)) in Parse_InstructionSequence()
1202 else if (Parse_String(parseState, "RCP")) { in Parse_InstructionSequence()
1203 if (!Parse_ScalarInstruction(parseState, inst, OPCODE_RCP)) in Parse_InstructionSequence()
1206 else if (Parse_String(parseState, "RSQ")) { in Parse_InstructionSequence()
1207 if (!Parse_ScalarInstruction(parseState, inst, OPCODE_RSQ)) in Parse_InstructionSequence()
1210 else if (Parse_String(parseState, "EXP")) { in Parse_InstructionSequence()
1211 if (!Parse_ScalarInstruction(parseState, inst, OPCODE_EXP)) in Parse_InstructionSequence()
1214 else if (Parse_String(parseState, "LOG")) { in Parse_InstructionSequence()
1215 if (!Parse_ScalarInstruction(parseState, inst, OPCODE_LOG)) in Parse_InstructionSequence()
1218 else if (Parse_String(parseState, "RCC")) { in Parse_InstructionSequence()
1219 if (!Parse_ScalarInstruction(parseState, inst, OPCODE_RCC)) in Parse_InstructionSequence()
1222 else if (Parse_String(parseState, "ARL")) { in Parse_InstructionSequence()
1223 if (!Parse_AddressInstruction(parseState, inst)) in Parse_InstructionSequence()
1226 else if (Parse_String(parseState, "PRINT")) { in Parse_InstructionSequence()
1227 if (!Parse_PrintInstruction(parseState, inst)) in Parse_InstructionSequence()
1230 else if (Parse_String(parseState, "END")) { in Parse_InstructionSequence()
1231 if (!Parse_EndInstruction(parseState, inst)) in Parse_InstructionSequence()
1234 parseState->numInst++; in Parse_InstructionSequence()
1245 parseState->outputsWritten |= (1 << inst->DstReg.Index); in Parse_InstructionSequence()
1247 parseState->anyProgRegsWritten = GL_TRUE; in Parse_InstructionSequence()
1250 parseState->inputsRead |= (1 << inst->SrcReg[0].Index); in Parse_InstructionSequence()
1252 parseState->inputsRead |= (1 << inst->SrcReg[1].Index); in Parse_InstructionSequence()
1254 parseState->inputsRead |= (1 << inst->SrcReg[2].Index); in Parse_InstructionSequence()
1256 parseState->numInst++; in Parse_InstructionSequence()
1258 if (parseState->numInst >= MAX_NV_VERTEX_PROGRAM_INSTRUCTIONS) in Parse_InstructionSequence()
1267 Parse_Program(struct parse_state *parseState, in Parse_Program() argument
1270 if (parseState->isVersion1_1) { in Parse_Program()
1271 if (!Parse_OptionSequence(parseState, instBuffer)) { in Parse_Program()
1275 return Parse_InstructionSequence(parseState, instBuffer); in Parse_Program()
1289 struct parse_state parseState; in _mesa_parse_nv_vertex_program() local
1305 parseState.ctx = ctx; in _mesa_parse_nv_vertex_program()
1306 parseState.start = programString; in _mesa_parse_nv_vertex_program()
1307 parseState.isPositionInvariant = GL_FALSE; in _mesa_parse_nv_vertex_program()
1308 parseState.isVersion1_1 = GL_FALSE; in _mesa_parse_nv_vertex_program()
1309 parseState.numInst = 0; in _mesa_parse_nv_vertex_program()
1310 parseState.inputsRead = 0; in _mesa_parse_nv_vertex_program()
1311 parseState.outputsWritten = 0; in _mesa_parse_nv_vertex_program()
1312 parseState.anyProgRegsWritten = GL_FALSE; in _mesa_parse_nv_vertex_program()
1313 parseState.indirectRegisterFiles = 0x0; in _mesa_parse_nv_vertex_program()
1321 parseState.pos = programString + 7; in _mesa_parse_nv_vertex_program()
1322 parseState.isStateProgram = GL_FALSE; in _mesa_parse_nv_vertex_program()
1326 parseState.pos = programString + 7; in _mesa_parse_nv_vertex_program()
1327 parseState.isStateProgram = GL_FALSE; in _mesa_parse_nv_vertex_program()
1328 parseState.isVersion1_1 = GL_TRUE; in _mesa_parse_nv_vertex_program()
1332 parseState.pos = programString + 8; in _mesa_parse_nv_vertex_program()
1333 parseState.isStateProgram = GL_TRUE; in _mesa_parse_nv_vertex_program()
1350 if (Parse_Program(&parseState, instBuffer)) { in _mesa_parse_nv_vertex_program()
1356 if (parseState.isStateProgram) { in _mesa_parse_nv_vertex_program()
1357 if (!parseState.anyProgRegsWritten) { in _mesa_parse_nv_vertex_program()
1364 if (!parseState.isPositionInvariant && in _mesa_parse_nv_vertex_program()
1365 !(parseState.outputsWritten & (1 << VERT_RESULT_HPOS))) { in _mesa_parse_nv_vertex_program()
1374 assert(parseState.numInst <= MAX_NV_VERTEX_PROGRAM_INSTRUCTIONS); in _mesa_parse_nv_vertex_program()
1375 newInst = _mesa_alloc_instructions(parseState.numInst); in _mesa_parse_nv_vertex_program()
1381 _mesa_copy_instructions(newInst, instBuffer, parseState.numInst); in _mesa_parse_nv_vertex_program()
1394 program->Base.InputsRead = parseState.inputsRead; in _mesa_parse_nv_vertex_program()
1395 if (parseState.isPositionInvariant) in _mesa_parse_nv_vertex_program()
1397 program->Base.NumInstructions = parseState.numInst; in _mesa_parse_nv_vertex_program()
1398 program->Base.OutputsWritten = parseState.outputsWritten; in _mesa_parse_nv_vertex_program()
1399 program->IsPositionInvariant = parseState.isPositionInvariant; in _mesa_parse_nv_vertex_program()
1414 program->Base.IndirectRegisterFiles = parseState.indirectRegisterFiles; in _mesa_parse_nv_vertex_program()