mesa: merge the prog_src_register::NegateBase and NegateAbs fields

There's really no need for two negation fields.  This came from the
GL_NV_fragment_program extension.  The new, unified Negate bitfield applies
after the absolute value step.
This commit is contained in:
Brian Paul
2009-04-14 22:14:30 -06:00
parent 0115a4f8f1
commit 7db7ff878d
26 changed files with 156 additions and 208 deletions

View File

@@ -957,6 +957,7 @@ Parse_VectorSrc(struct parse_state *parseState,
GLfloat sign = 1.0F;
GLubyte token[100];
GLint idx;
GLuint negateBase, negateAbs;
/*
* First, take care of +/- and absolute value stuff.
@@ -968,21 +969,23 @@ Parse_VectorSrc(struct parse_state *parseState,
if (Parse_String(parseState, "|")) {
srcReg->Abs = GL_TRUE;
srcReg->NegateAbs = (sign < 0.0F) ? GL_TRUE : GL_FALSE;
negateAbs = (sign < 0.0F) ? NEGATE_XYZW : NEGATE_NONE;
if (Parse_String(parseState, "-"))
srcReg->NegateBase = NEGATE_XYZW;
negateBase = NEGATE_XYZW;
else if (Parse_String(parseState, "+"))
srcReg->NegateBase = NEGATE_NONE;
negateBase = NEGATE_NONE;
else
srcReg->NegateBase = NEGATE_NONE;
negateBase = NEGATE_NONE;
}
else {
srcReg->Abs = GL_FALSE;
srcReg->NegateAbs = GL_FALSE;
srcReg->NegateBase = (sign < 0.0F) ? NEGATE_XYZW : NEGATE_NONE;
negateAbs = NEGATE_NONE;
negateBase = (sign < 0.0F) ? NEGATE_XYZW : NEGATE_NONE;
}
srcReg->Negate = srcReg->Abs ? negateAbs : negateBase;
/* This should be the real src vector/register name */
if (!Peek_Token(parseState, token))
RETURN_ERROR;
@@ -1083,6 +1086,7 @@ Parse_ScalarSrcReg(struct parse_state *parseState,
GLfloat sign = 1.0F;
GLboolean needSuffix = GL_TRUE;
GLint idx;
GLuint negateBase, negateAbs;
/*
* First, take care of +/- and absolute value stuff.
@@ -1094,21 +1098,23 @@ Parse_ScalarSrcReg(struct parse_state *parseState,
if (Parse_String(parseState, "|")) {
srcReg->Abs = GL_TRUE;
srcReg->NegateAbs = (sign < 0.0F) ? GL_TRUE : GL_FALSE;
negateAbs = (sign < 0.0F) ? NEGATE_XYZW : NEGATE_NONE;
if (Parse_String(parseState, "-"))
srcReg->NegateBase = NEGATE_XYZW;
negateBase = NEGATE_XYZW;
else if (Parse_String(parseState, "+"))
srcReg->NegateBase = NEGATE_NONE;
negateBase = NEGATE_NONE;
else
srcReg->NegateBase = NEGATE_NONE;
negateBase = NEGATE_NONE;
}
else {
srcReg->Abs = GL_FALSE;
srcReg->NegateAbs = GL_FALSE;
srcReg->NegateBase = (sign < 0.0F) ? NEGATE_XYZW : NEGATE_NONE;
negateAbs = NEGATE_NONE;
negateBase = (sign < 0.0F) ? NEGATE_XYZW : NEGATE_NONE;
}
srcReg->Negate = srcReg->Abs ? negateAbs : negateBase;
if (!Peek_Token(parseState, token))
RETURN_ERROR;
@@ -1247,9 +1253,8 @@ Parse_PrintInstruction(struct parse_state *parseState,
}
inst->SrcReg[0].Swizzle = SWIZZLE_NOOP;
inst->SrcReg[0].NegateBase = NEGATE_NONE;
inst->SrcReg[0].Abs = GL_FALSE;
inst->SrcReg[0].NegateAbs = GL_FALSE;
inst->SrcReg[0].Negate = NEGATE_NONE;
return GL_TRUE;
}