Exemplo n.º 1
0
void CVPParser::ParseInstruction(struct nvfx_insn *insn,opcode *opc,const char *param_str)
{
	u32 i;
	char *token = SkipSpaces(strtok((char*)param_str,","));

	if(opc->is_imm)
		ParseMaskedDstAddr(token,insn);
	else
		ParseMaskedDstReg(token,insn);

	for(i=0;i<opc->nr_src;i++) {
		token = SkipSpaces(strtok(NULL,","));
		ParseSwizzledSrcReg(token,&insn->src[opc->src_slots[i]]);
	}

	if(opc->opcode == OPCODE_TEX) {
	  uint8_t unit = ~0, target = ~0;

	  token = SkipSpaces(strtok(NULL,","));
	  ParseTextureUnit(token,&unit);
	  
	  token = SkipSpaces(strtok(NULL,","));
	  ParseTextureTarget(token,&target);

	  insn->src[1] = nvfx_src(nvfx_reg(NVFXSR_VPTEXINPUT,unit));
	}
}
Exemplo n.º 2
0
void CFPParser::ParseInstruction(struct nvfx_insn *insn,opcode *opc,const char *param_str)
{
	char *token = SkipSpaces(strtok((char*)param_str,","));

	insn->precision = opc->suffixes&(_R|_H|_X);
	insn->sat = ((opc->suffixes&_S) ? TRUE : FALSE);
	insn->cc_update = ((opc->suffixes&_C) ? TRUE : FALSE);

	if(opc->outputs==OUTPUT_S || opc->outputs==OUTPUT_V) {
		ParseMaskedDstReg(token,insn);
	}

	if(opc->outputs!=OUTPUT_NONE && opc->inputs!=INPUT_NONE) {
		token = SkipSpaces(strtok(NULL,","));
	}

	if(opc->inputs==INPUT_1V) {
		ParseVectorSrc(token,&insn->src[0]);
	} else if(opc->inputs==INPUT_2V) {
		ParseVectorSrc(token,&insn->src[0]);

		token = SkipSpaces(strtok(NULL,","));
		ParseVectorSrc(token,&insn->src[1]);
	} else if(opc->inputs==INPUT_3V) {
		ParseVectorSrc(token,&insn->src[0]);

		token = SkipSpaces(strtok(NULL,","));
		ParseVectorSrc(token,&insn->src[1]);

		token = SkipSpaces(strtok(NULL,","));
		ParseVectorSrc(token,&insn->src[2]);
	} else if(opc->inputs==INPUT_1S) {
		ParseScalarSrc(token,&insn->src[0]);
	} else if(opc->inputs==INPUT_2S) {
		ParseScalarSrc(token,&insn->src[0]);

		token = SkipSpaces(strtok(NULL,","));
		ParseScalarSrc(token,&insn->src[1]);
	} else if(opc->inputs==INPUT_1V_T) {
		u8 unit,target;

		ParseVectorSrc(token,&insn->src[0]);

		token = SkipSpaces(strtok(NULL,","));
		ParseTextureUnit(token,&unit);

		token = SkipSpaces(strtok(NULL,","));
		ParseTextureTarget(token,&target);

		insn->unit = unit;
	} else if(opc->inputs==INPUT_3V_T) {
		u8 unit,target;

		ParseVectorSrc(token,&insn->src[0]);

		token = SkipSpaces(strtok(NULL,","));
		ParseVectorSrc(token,&insn->src[1]);

		token = SkipSpaces(strtok(NULL,","));
		ParseVectorSrc(token,&insn->src[2]);

		token = SkipSpaces(strtok(NULL,","));
		ParseTextureUnit(token,&unit);

		token = SkipSpaces(strtok(NULL,","));
		ParseTextureTarget(token,&target);

		insn->unit = unit;
	} else if(opc->inputs==INPUT_CC) {
		ParseCond(token,insn);
	}
}