summaryrefslogtreecommitdiff
path: root/src/mesa/shader/nvfragparse.c
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2009-04-14 22:14:30 -0600
committerBrian Paul <brianp@vmware.com>2009-04-14 22:14:30 -0600
commit7db7ff878d3e5a6b345228e6eaee4797bb68b360 (patch)
tree9dbdcfc3d9bc37d88f7e86f22f7c8f18b9420b14 /src/mesa/shader/nvfragparse.c
parent0115a4f8f1952b166eaad09f317ff8bc465e0f28 (diff)
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.
Diffstat (limited to 'src/mesa/shader/nvfragparse.c')
-rw-r--r--src/mesa/shader/nvfragparse.c33
1 files changed, 19 insertions, 14 deletions
diff --git a/src/mesa/shader/nvfragparse.c b/src/mesa/shader/nvfragparse.c
index 56b7c29bea..0fd55524ab 100644
--- a/src/mesa/shader/nvfragparse.c
+++ b/src/mesa/shader/nvfragparse.c
@@ -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;
}