r300: Added support for Back Facing Color.

This commit is contained in:
Tommy Schultz Lassen 2007-07-11 17:37:12 +00:00 committed by Oliver McFadden
parent 4bd04c9851
commit ee7fece054
2 changed files with 28 additions and 32 deletions

View 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

View 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);