Browse Source

r300: Added support for Back Facing Color.

tags/mesa_7_1_rc1
Tommy Schultz Lassen 18 years ago
parent
commit
ee7fece054
2 changed files with 28 additions and 32 deletions
  1. 2
    2
      src/mesa/drivers/dri/r300/r300_emit.c
  2. 26
    30
      src/mesa/drivers/dri/r300/r300_vertprog.c

+ 2
- 2
src/mesa/drivers/dri/r300/r300_emit.c 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


+ 26
- 30
src/mesa/drivers/dri/r300/r300_vertprog.c 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);

Loading…
Cancel
Save