r300: Added support for Back Facing Color.
authorTommy Schultz Lassen <mesa3d@krynn.dk>
Wed, 11 Jul 2007 17:37:12 +0000 (17:37 +0000)
committerOliver McFadden <z3ro.geek@gmail.com>
Wed, 11 Jul 2007 17:37:45 +0000 (17:37 +0000)
src/mesa/drivers/dri/r300/r300_emit.c
src/mesa/drivers/dri/r300/r300_vertprog.c

index 229439dfa871e6673a544133283b0d90774b0a29..732dbcbc9d980b4800ac01237378450617dadd1c 100644 (file)
@@ -299,13 +299,13 @@ GLuint r300VAPOutputCntl0(GLcontext * ctx, GLuint OutputsWritten)
        if (OutputsWritten & (1 << VERT_RESULT_COL1))
                ret |= R300_VAP_OUTPUT_VTX_FMT_0__COLOR_1_PRESENT;
 
-#if 0
        if (OutputsWritten & (1 << VERT_RESULT_BFC0))
-               ret |= R300_VAP_OUTPUT_VTX_FMT_0__COLOR_2_PRESENT;
+               ret |= (7 << 2);
 
        if (OutputsWritten & (1 << VERT_RESULT_BFC1))
                ret |= R300_VAP_OUTPUT_VTX_FMT_0__COLOR_3_PRESENT;
 
+#if 0
        if (OutputsWritten & (1 << VERT_RESULT_FOGC)) ;
 #endif
 
index 16dddf6557d5317ed539a9f17ed244cb4070d688..d5cae478539aaa96fa697589401a76e6000289cd 100644 (file)
@@ -438,32 +438,42 @@ static void r300TranslateVertexShader(struct r300_vertex_program *vp,
        assert(vp->key.OutputsWritten & (1 << VERT_RESULT_HPOS));
 
        /* Assign outputs */
-       if (vp->key.OutputsWritten & (1 << VERT_RESULT_HPOS))
-               vp->outputs[VERT_RESULT_HPOS] = cur_reg++;
+       if (vp->key.OutputsWritten & (1 << VERT_RESULT_HPOS)) {
+               vp->outputs[VERT_RESULT_HPOS] = cur_reg;
+               cur_reg = 1;
+       }
 
-       if (vp->key.OutputsWritten & (1 << VERT_RESULT_PSIZ))
-               vp->outputs[VERT_RESULT_PSIZ] = cur_reg++;
+       if (vp->key.OutputsWritten & (1 << VERT_RESULT_COL0)) {
+               vp->outputs[VERT_RESULT_COL0] = 1;
+               cur_reg = 2;
+       }
 
-       if (vp->key.OutputsWritten & (1 << VERT_RESULT_COL0))
-               vp->outputs[VERT_RESULT_COL0] = cur_reg++;
+       if (vp->key.OutputsWritten & (1 << VERT_RESULT_COL1)) {
+               vp->outputs[VERT_RESULT_COL1] = 2;
+               cur_reg = 3;
+       }
 
-       if (vp->key.OutputsWritten & (1 << VERT_RESULT_COL1))
-               vp->outputs[VERT_RESULT_COL1] = cur_reg++;
+       if (vp->key.OutputsWritten & (1 << VERT_RESULT_BFC0)) {
+               vp->outputs[VERT_RESULT_BFC0] = 3;
+               cur_reg = 5;
+       }
 
+       if (vp->key.OutputsWritten & (1 << VERT_RESULT_BFC1)) {
+               vp->outputs[VERT_RESULT_BFC1] = 4;
+               cur_reg = 5;
+       }
 #if 0                          /* Not supported yet */
-       if (vp->key.OutputsWritten & (1 << VERT_RESULT_BFC0))
-               vp->outputs[VERT_RESULT_BFC0] = cur_reg++;
-
-       if (vp->key.OutputsWritten & (1 << VERT_RESULT_BFC1))
-               vp->outputs[VERT_RESULT_BFC1] = cur_reg++;
-
        if (vp->key.OutputsWritten & (1 << VERT_RESULT_FOGC))
                vp->outputs[VERT_RESULT_FOGC] = cur_reg++;
 #endif
 
+       if (vp->key.OutputsWritten & (1 << VERT_RESULT_PSIZ))
+               vp->outputs[VERT_RESULT_PSIZ] = cur_reg++;
+
        for (i = VERT_RESULT_TEX0; i <= VERT_RESULT_TEX7; i++)
-               if (vp->key.OutputsWritten & (1 << i))
+               if (vp->key.OutputsWritten & (1 << i)) {
                        vp->outputs[i] = cur_reg++;
+               }
 
        vp->translated = GL_TRUE;
        vp->native = GL_TRUE;
@@ -1255,8 +1265,6 @@ void r300SelectVertexShader(r300ContextPtr r300)
        vpc = (struct r300_vertex_program_cont *)ctx->VertexProgram._Current;
        InputsRead = ctx->FragmentProgram._Current->Base.InputsRead;
 
-       wanted_key.OutputsWritten |= 1 << VERT_RESULT_HPOS;
-
        wpos_idx = -1;
        if (InputsRead & FRAG_BIT_WPOS) {
                for (i = 0; i < ctx->Const.MaxTextureUnits; i++)
@@ -1271,20 +1279,8 @@ void r300SelectVertexShader(r300ContextPtr r300)
                InputsRead |= (FRAG_BIT_TEX0 << i);
                wpos_idx = i;
        }
-
-       if (InputsRead & FRAG_BIT_COL0)
-               wanted_key.OutputsWritten |= 1 << VERT_RESULT_COL0;
-
-       if ((InputsRead & FRAG_BIT_COL1)        /*||
-                                                  (InputsRead & FRAG_BIT_FOGC) */ )
-               wanted_key.OutputsWritten |= 1 << VERT_RESULT_COL1;
-
-       for (i = 0; i < ctx->Const.MaxTextureUnits; i++)
-               if (InputsRead & (FRAG_BIT_TEX0 << i))
-                       wanted_key.OutputsWritten |=
-                           1 << (VERT_RESULT_TEX0 + i);
-
        wanted_key.InputsRead = vpc->mesa_program.Base.InputsRead;
+       wanted_key.OutputsWritten = vpc->mesa_program.Base.OutputsWritten;
        if (vpc->mesa_program.IsPositionInvariant) {
                /* we wan't position don't we ? */
                wanted_key.InputsRead |= (1 << VERT_ATTRIB_POS);