aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers
diff options
context:
space:
mode:
authorTommy Schultz Lassen <[email protected]>2007-07-11 17:37:12 +0000
committerOliver McFadden <[email protected]>2007-07-11 17:37:45 +0000
commitee7fece05462e3cc00b4f24069748c1401fcacef (patch)
tree8c26c43cbb78cf5cac292a020aae90a71cc90f8b /src/mesa/drivers
parent4bd04c9851097ff4dfbfd73f6c62e1bc4143fc0d (diff)
r300: Added support for Back Facing Color.
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r--src/mesa/drivers/dri/r300/r300_emit.c4
-rw-r--r--src/mesa/drivers/dri/r300/r300_vertprog.c56
2 files changed, 28 insertions, 32 deletions
diff --git a/src/mesa/drivers/dri/r300/r300_emit.c b/src/mesa/drivers/dri/r300/r300_emit.c
index 229439dfa87..732dbcbc9d9 100644
--- a/src/mesa/drivers/dri/r300/r300_emit.c
+++ b/src/mesa/drivers/dri/r300/r300_emit.c
@@ -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
diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.c b/src/mesa/drivers/dri/r300/r300_vertprog.c
index 16dddf6557d..d5cae478539 100644
--- a/src/mesa/drivers/dri/r300/r300_vertprog.c
+++ b/src/mesa/drivers/dri/r300/r300_vertprog.c
@@ -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);