r300: rewrite and hopefully simplify RS setup
[mesa.git] / src / mesa / drivers / dri / r300 / radeon_program_pair.c
index 5ad50d2863ac07ef7a0daea5240d5b2e551c4f10..f398404f9f5083ea3811df251dc2232af3fec1a9 100644 (file)
@@ -451,28 +451,33 @@ static void allocate_input_registers(struct pair_state *s)
        int i;
        GLuint hwindex = 0;
 
-       /* Texcoords come first */
+       /* Primary colour */
+       if (InputsRead & FRAG_BIT_COL0)
+               alloc_hw_reg(s, PROGRAM_INPUT, FRAG_ATTRIB_COL0, hwindex++);
+       InputsRead &= ~FRAG_BIT_COL0;
+
+       /* Secondary color */
+       if (InputsRead & FRAG_BIT_COL1)
+               alloc_hw_reg(s, PROGRAM_INPUT, FRAG_ATTRIB_COL1, hwindex++);
+       InputsRead &= ~FRAG_BIT_COL1;
+
+       /* Texcoords */
        for (i = 0; i < s->Ctx->Const.MaxTextureUnits; i++) {
                if (InputsRead & (FRAG_BIT_TEX0 << i))
                        alloc_hw_reg(s, PROGRAM_INPUT, FRAG_ATTRIB_TEX0+i, hwindex++);
        }
        InputsRead &= ~FRAG_BITS_TEX_ANY;
 
+       /* Fogcoords treated as a texcoord */
+       if (InputsRead & FRAG_BIT_FOGC)
+               alloc_hw_reg(s, PROGRAM_INPUT, FRAG_ATTRIB_FOGC, hwindex++);
+       InputsRead &= ~FRAG_BIT_FOGC;
+
        /* fragment position treated as a texcoord */
        if (InputsRead & FRAG_BIT_WPOS)
                alloc_hw_reg(s, PROGRAM_INPUT, FRAG_ATTRIB_WPOS, hwindex++);
        InputsRead &= ~FRAG_BIT_WPOS;
 
-       /* Then primary colour */
-       if (InputsRead & FRAG_BIT_COL0)
-               alloc_hw_reg(s, PROGRAM_INPUT, FRAG_ATTRIB_COL0, hwindex++);
-       InputsRead &= ~FRAG_BIT_COL0;
-
-       /* Secondary color */
-       if (InputsRead & FRAG_BIT_COL1)
-               alloc_hw_reg(s, PROGRAM_INPUT, FRAG_ATTRIB_COL1, hwindex++);
-       InputsRead &= ~FRAG_BIT_COL1;
-
        /* Anything else */
        if (InputsRead)
                error("Don't know how to handle inputs 0x%x\n", InputsRead);
@@ -773,10 +778,10 @@ static void fill_dest_into_pair(struct pair_state *s, struct radeon_pair_instruc
        struct prog_instruction *inst = s->Program->Instructions + ip;
 
        if (inst->DstReg.File == PROGRAM_OUTPUT) {
-               if (inst->DstReg.Index == FRAG_RESULT_COLR) {
+               if (inst->DstReg.Index == FRAG_RESULT_COLOR) {
                        pair->RGB.OutputWriteMask |= inst->DstReg.WriteMask & WRITEMASK_XYZ;
                        pair->Alpha.OutputWriteMask |= GET_BIT(inst->DstReg.WriteMask, 3);
-               } else if (inst->DstReg.Index == FRAG_RESULT_DEPR) {
+               } else if (inst->DstReg.Index == FRAG_RESULT_DEPTH) {
                        pair->Alpha.DepthWriteMask |= GET_BIT(inst->DstReg.WriteMask, 3);
                }
        } else {