static GLboolean Parse_BiOpInstruction(struct parse_state *parseState, struct prog_instruction *inst, enum prog_opcode opcode) { if (opcode == OPCODE_DPH && !parseState->isVersion1_1) RETURN_ERROR1("DPH illegal for vertex program 1.0"); if (opcode == OPCODE_SUB && !parseState->isVersion1_1) RETURN_ERROR1("SUB illegal for vertex program 1.0"); inst->Opcode = opcode; inst->StringPos = parseState->curLine - parseState->start; /* dest reg */ if (!Parse_MaskedDstReg(parseState, &inst->DstReg)) RETURN_ERROR; /* comma */ if (!Parse_String(parseState, ",")) RETURN_ERROR; /* first src arg */ if (!Parse_SwizzleSrcReg(parseState, &inst->SrcReg[0])) RETURN_ERROR; /* comma */ if (!Parse_String(parseState, ",")) RETURN_ERROR; /* second src arg */ if (!Parse_SwizzleSrcReg(parseState, &inst->SrcReg[1])) RETURN_ERROR; /* semicolon */ if (!Parse_String(parseState, ";")) RETURN_ERROR; /* make sure we don't reference more than one program parameter register */ if (inst->SrcReg[0].File == PROGRAM_ENV_PARAM && inst->SrcReg[1].File == PROGRAM_ENV_PARAM && inst->SrcReg[0].Index != inst->SrcReg[1].Index) RETURN_ERROR1("Can't reference two program parameter registers"); /* make sure we don't reference more than one vertex attribute register */ if (inst->SrcReg[0].File == PROGRAM_INPUT && inst->SrcReg[1].File == PROGRAM_INPUT && inst->SrcReg[0].Index != inst->SrcReg[1].Index) RETURN_ERROR1("Can't reference two vertex attribute registers"); return GL_TRUE; }
static GLint Parse_UnaryOpInstruction(struct parse_state *parseState, struct vp_instruction *inst, enum vp_opcode opcode) { if (opcode == VP_OPCODE_ABS && !parseState->isVersion1_1) RETURN_ERROR1("ABS illegal for vertex program 1.0"); inst->Opcode = opcode; inst->StringPos = parseState->curLine - parseState->start; /* dest reg */ if (!Parse_MaskedDstReg(parseState, &inst->DstReg)) RETURN_ERROR; /* comma */ if (!Parse_String(parseState, ",")) RETURN_ERROR; /* src arg */ if (!Parse_SwizzleSrcReg(parseState, &inst->SrcReg[0])) RETURN_ERROR; /* semicolon */ if (!Parse_String(parseState, ";")) RETURN_ERROR; return GL_TRUE; }
static GLboolean Parse_TriOpInstruction(struct parse_state *parseState, struct vp_instruction *inst, enum vp_opcode opcode) { inst->Opcode = opcode; inst->StringPos = parseState->curLine - parseState->start; /* dest reg */ if (!Parse_MaskedDstReg(parseState, &inst->DstReg)) RETURN_ERROR; /* comma */ if (!Parse_String(parseState, ",")) RETURN_ERROR; /* first src arg */ if (!Parse_SwizzleSrcReg(parseState, &inst->SrcReg[0])) RETURN_ERROR; /* comma */ if (!Parse_String(parseState, ",")) RETURN_ERROR; /* second src arg */ if (!Parse_SwizzleSrcReg(parseState, &inst->SrcReg[1])) RETURN_ERROR; /* comma */ if (!Parse_String(parseState, ",")) RETURN_ERROR; /* third src arg */ if (!Parse_SwizzleSrcReg(parseState, &inst->SrcReg[2])) RETURN_ERROR; /* semicolon */ if (!Parse_String(parseState, ";")) RETURN_ERROR; /* make sure we don't reference more than one program parameter register */ if ((inst->SrcReg[0].File == PROGRAM_ENV_PARAM && inst->SrcReg[1].File == PROGRAM_ENV_PARAM && inst->SrcReg[0].Index != inst->SrcReg[1].Index) || (inst->SrcReg[0].File == PROGRAM_ENV_PARAM && inst->SrcReg[2].File == PROGRAM_ENV_PARAM && inst->SrcReg[0].Index != inst->SrcReg[2].Index) || (inst->SrcReg[1].File == PROGRAM_ENV_PARAM && inst->SrcReg[2].File == PROGRAM_ENV_PARAM && inst->SrcReg[1].Index != inst->SrcReg[2].Index)) RETURN_ERROR1("Can only reference one program register"); /* make sure we don't reference more than one vertex attribute register */ if ((inst->SrcReg[0].File == PROGRAM_INPUT && inst->SrcReg[1].File == PROGRAM_INPUT && inst->SrcReg[0].Index != inst->SrcReg[1].Index) || (inst->SrcReg[0].File == PROGRAM_INPUT && inst->SrcReg[2].File == PROGRAM_INPUT && inst->SrcReg[0].Index != inst->SrcReg[2].Index) || (inst->SrcReg[1].File == PROGRAM_INPUT && inst->SrcReg[2].File == PROGRAM_INPUT && inst->SrcReg[1].Index != inst->SrcReg[2].Index)) RETURN_ERROR1("Can only reference one input register"); return GL_TRUE; }