269
271
if (newprim != rmesa->tcl.hw_primitive ||
270
272
!discrete_prim[hw_prim&0xf]) {
273
/* need to disable perspective-correct texturing for point sprites */
274
if ((prim & PRIM_MODE_MASK) == GL_POINTS && ctx->Point.PointSprite) {
275
if (rmesa->hw.set.cmd[SET_RE_CNTL] & R200_PERSPECTIVE_ENABLE) {
276
R200_STATECHANGE( rmesa, set );
277
rmesa->hw.set.cmd[SET_RE_CNTL] &= ~R200_PERSPECTIVE_ENABLE;
280
else if (!(rmesa->hw.set.cmd[SET_RE_CNTL] & R200_PERSPECTIVE_ENABLE)) {
281
R200_STATECHANGE( rmesa, set );
282
rmesa->hw.set.cmd[SET_RE_CNTL] |= R200_PERSPECTIVE_ENABLE;
271
284
R200_NEWPRIM( rmesa );
272
285
rmesa->tcl.hw_primitive = newprim;
419
GLuint out_vtxfmt0 = 0;
420
GLuint out_vtxfmt1 = 0;
433
/* vtx_tcl_output_vtxfmt_0/1 need to match configuration of "fragment
434
part", since using some vertex interpolator later which is not in
435
out_vtxfmt0/1 will lock up. It seems to be ok to write in vertex
436
prog to a not enabled output however, so just don't mess with it.
437
We only need to change compsel. */
421
438
GLuint out_compsel = 0;
422
439
GLuint vp_out = rmesa->curr_vp_hw->mesa_program.Base.OutputsWritten;
423
441
/* can't handle other inputs, generic attribs etc. currently - should never arrive here */
424
442
assert ((rmesa->curr_vp_hw->mesa_program.Base.InputsRead &
425
443
~(VERT_BIT_POS | VERT_BIT_NORMAL | VERT_BIT_COLOR0 | VERT_BIT_COLOR1 |
426
444
VERT_BIT_FOG | VERT_BIT_TEX0 | VERT_BIT_TEX1 | VERT_BIT_TEX2 |
427
445
VERT_BIT_TEX3 | VERT_BIT_TEX4 | VERT_BIT_TEX5)) == 0);
428
447
inputs |= rmesa->curr_vp_hw->mesa_program.Base.InputsRead;
429
/* FIXME: this is a mess. Not really sure how to set up TCL_OUTPUT_VTXFMT
430
in "undefined" cases (e.g. output needed later but not written by vertex program or vice versa)
431
- however misconfiguration here will almost certainly lock up the chip.
432
I think at the very least we need to enable tcl outputs which we write to. Maybe even need to
433
fix up a vertex program so an output needed later always gets written?
434
For now just set the compsel and output_vtxfmt to the outputs written.
435
However, for simplicity we assume always all 4 values are written which may not be correct
436
(but I don't know if it could lead to lockups). */
437
448
assert(vp_out & (1 << VERT_RESULT_HPOS));
438
out_vtxfmt0 = R200_VTX_XY | R200_VTX_Z0 | R200_VTX_W0;
439
/* FIXME: need to always enable color_0 otherwise doom3's shadow vp (?) will lock up (?) */
440
out_vtxfmt0 |= R200_VTX_FP_RGBA << R200_VTX_COLOR_0_SHIFT;
441
449
out_compsel = R200_OUTPUT_XYZW;
442
450
if (vp_out & (1 << VERT_RESULT_COL0)) {
443
out_vtxfmt0 |= R200_VTX_FP_RGBA << R200_VTX_COLOR_0_SHIFT;
444
451
out_compsel |= R200_OUTPUT_COLOR_0;
446
453
if (vp_out & (1 << VERT_RESULT_COL1)) {
447
out_vtxfmt0 |= R200_VTX_FP_RGBA << R200_VTX_COLOR_1_SHIFT;
448
454
out_compsel |= R200_OUTPUT_COLOR_1;
450
/* FIXME: probably not everything is set up for fogc and psiz to work correctly */
451
456
if (vp_out & (1 << VERT_RESULT_FOGC)) {
452
out_vtxfmt0 |= R200_VTX_DISCRETE_FOG;
453
457
out_compsel |= R200_OUTPUT_DISCRETE_FOG;
455
459
if (vp_out & (1 << VERT_RESULT_PSIZ)) {
456
out_vtxfmt0 |= R200_VTX_POINT_SIZE;
457
460
out_compsel |= R200_OUTPUT_PT_SIZE;
459
462
for (i = VERT_RESULT_TEX0; i < VERT_RESULT_TEX6; i++) {
460
463
if (vp_out & (1 << i)) {
461
out_vtxfmt1 |= 4 << ((i - VERT_RESULT_TEX0) * 3);
462
464
out_compsel |= R200_OUTPUT_TEX_0 << (i - VERT_RESULT_TEX0);
465
if ((rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_VTXFMT_0] != out_vtxfmt0) ||
466
(rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_VTXFMT_1] != out_vtxfmt1) ||
467
(rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_COMPSEL] != out_compsel)) {
467
if (rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_COMPSEL] != out_compsel) {
468
468
R200_STATECHANGE( rmesa, vtx );
469
rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_VTXFMT_0] = out_vtxfmt0;
470
rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_VTXFMT_1] = out_vtxfmt1;
471
469
rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_COMPSEL] = out_compsel;
472
/* FIXME: should restore this when disabling vertex programs maybe? */