Ejemplo n.º 1
0
void CVPParser::ParseSwizzledSrcReg(const char *token,struct nvfx_src *reg)
{
    s32 idx;

    if(!token) return;

    if(token[0]=='-') {
        reg->negate = TRUE;
        token++;
    }
    if(token[0]=='|') {
        reg->abs = TRUE;
        token++;
    }

    if(token[0]=='v') {
        if(token[1]=='e')
            token = ParseInputReg(token,&idx);
        else if(token[1]=='[') {
            token = ParseInputReg(&token[2],&idx);
            if(*token==']') token++;
        }

        reg->reg.type = NVFXSR_INPUT;
        reg->reg.index = idx;
    } else if(token[0]=='R') {
        token = ParseTempReg(token,&idx);
        reg->reg.type = NVFXSR_TEMP;
        reg->reg.index = idx;
    } else if(token[0]=='c' && token[1]=='[') {
        token = ParseParamReg(&token[2],reg);
    }

    token = ParseRegSwizzle(token,reg);
}
Ejemplo n.º 2
0
void CVPParser::ParseSwizzledSrcReg(const char *token,struct nvfx_src *reg)
{
	s32 idx;

	if(!token) return;

	if(token[0]=='-') {
		reg->negate = TRUE;
		token++;
	}
	if(token[0]=='|') {
		reg->abs = TRUE;
		token++;
	}

	if(token[0]=='v') {
		if(token[1]=='e')
			token = ParseInputReg(token,&idx);
		else if(token[1]=='[') {
			token = ParseInputReg(&token[2],&idx);
			if(*token==']') token++;
		}

		reg->reg.type = NVFXSR_INPUT;
		reg->reg.index = idx;
	} else if(token[0]=='R') {
		token = ParseTempReg(token,&idx);
		reg->reg.type = NVFXSR_TEMP;
		reg->reg.index = idx;
	} else if(token[0]=='c' && token[1]=='[') {
		token = ParseParamReg(&token[2],reg);
	}

	if(token && *token!='\0') {
		if(token[0]=='.') {
			u32 k;

			token++;

			reg->swz[0] = reg->swz[1] = reg->swz[2] = reg->swz[3] = 0;
			for(k=0;token[k] && k<4;k++) {
				if(token[k]=='x')
					reg->swz[k] = NVFX_SWZ_X;
				else if(token[k]=='y')
					reg->swz[k] = NVFX_SWZ_Y;
				else if(token[k]=='z')
					reg->swz[k] = NVFX_SWZ_Z;
				else if(token[k]=='w')
					reg->swz[k] = NVFX_SWZ_W;
			}
		
			if(k && k<4) {
				u8 lastswz = reg->swz[k - 1];
				while(k<4) {
					reg->swz[k] = lastswz;
					k++;
				}
			}
		}
	}
}