summaryrefslogtreecommitdiff
path: root/src/mesa/shader/nvfragparse.c
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2005-10-30 21:23:23 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2005-10-30 21:23:23 +0000
commit7aebaf3debc6482b49faee5ed38418ad3d35fc30 (patch)
treed3794359358ea33e561dd8bdbc84c34cfc229688 /src/mesa/shader/nvfragparse.c
parent094a1ddf2498d598da5abaef6d6ed53ec2dbe6dc (diff)
Lots of clean-up in arb program parser.
Use new _mesa_init_fp/vp_instruction() function to initialize instructions.
Diffstat (limited to 'src/mesa/shader/nvfragparse.c')
-rw-r--r--src/mesa/shader/nvfragparse.c28
1 files changed, 22 insertions, 6 deletions
diff --git a/src/mesa/shader/nvfragparse.c b/src/mesa/shader/nvfragparse.c
index 4f27a96eeb..520bf05627 100644
--- a/src/mesa/shader/nvfragparse.c
+++ b/src/mesa/shader/nvfragparse.c
@@ -1259,12 +1259,7 @@ Parse_InstructionSequence(struct parse_state *parseState,
GLubyte token[100];
/* Initialize the instruction */
- inst->SrcReg[0].File = PROGRAM_UNDEFINED;
- inst->SrcReg[1].File = PROGRAM_UNDEFINED;
- inst->SrcReg[2].File = PROGRAM_UNDEFINED;
- inst->DstReg.File = PROGRAM_UNDEFINED;
- inst->DstReg.CondSwizzle = SWIZZLE_NOOP;
- inst->Data = NULL;
+ _mesa_init_fp_instruction(inst);
/* special instructions */
if (Parse_String(parseState, "DEFINE")) {
@@ -1823,3 +1818,24 @@ _mesa_nv_fragment_output_register_name(GLuint i)
ASSERT(i < MAX_NV_FRAGMENT_PROGRAM_OUTPUTS);
return OutputRegisters[i];
}
+
+
+/**
+ * Initialize fragment program instruction fields to defaults.
+ */
+void
+_mesa_init_fp_instruction(struct fp_instruction *inst)
+{
+ _mesa_bzero(inst, sizeof(struct fp_instruction));
+ inst->SrcReg[0].File = PROGRAM_UNDEFINED;
+ inst->SrcReg[0].Swizzle = SWIZZLE_NOOP;
+ inst->SrcReg[1].File = PROGRAM_UNDEFINED;
+ inst->SrcReg[1].Swizzle = SWIZZLE_NOOP;
+ inst->SrcReg[2].File = PROGRAM_UNDEFINED;
+ inst->SrcReg[2].Swizzle = SWIZZLE_NOOP;
+ inst->DstReg.File = PROGRAM_UNDEFINED;
+ inst->DstReg.WriteMask = 0xf;
+ inst->DstReg.CondSwizzle = SWIZZLE_NOOP;
+ inst->Precision = FLOAT32;
+ inst->DstReg.CondMask = COND_TR;
+}