From d044ecbe7625af1118655bcc9dba7ed00342534f Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Sat, 8 May 2010 22:50:49 +0200 Subject: r300g: follow pipe_rasterizer_state::light_twoside --- src/gallium/drivers/r300/r300_state_derived.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'src/gallium/drivers/r300/r300_state_derived.c') diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c index 193a60c034..c738899827 100644 --- a/src/gallium/drivers/r300/r300_state_derived.c +++ b/src/gallium/drivers/r300/r300_state_derived.c @@ -355,10 +355,26 @@ static void r300_update_rs_block(struct r300_context *r300) /* Set up back-face colors. The rasterizer will do the color selection * automatically. */ if (any_bcolor_used) { - for (i = 0; i < ATTR_COLOR_COUNT; i++) { - rs.vap_vsm_vtx_assm |= R300_INPUT_CNTL_COLOR; - rs.vap_out_vtx_fmt[0] |= R300_VAP_OUTPUT_VTX_FMT_0__COLOR_0_PRESENT << (2+i); - stream_loc_notcl[loc++] = 4 + i; + if (r300->two_sided_color) { + /* Rasterize as back-face colors. */ + for (i = 0; i < ATTR_COLOR_COUNT; i++) { + rs.vap_vsm_vtx_assm |= R300_INPUT_CNTL_COLOR; + rs.vap_out_vtx_fmt[0] |= R300_VAP_OUTPUT_VTX_FMT_0__COLOR_0_PRESENT << (2+i); + stream_loc_notcl[loc++] = 4 + i; + } + } else { + /* Rasterize two fake texcoords to prevent from the two-sided color + * selection. */ + /* XXX Consider recompiling the vertex shader to save 2 RS units. */ + for (i = 0; i < 2; i++) { + rs.vap_vsm_vtx_assm |= (R300_INPUT_CNTL_TC0 << tex_count); + rs.vap_out_vtx_fmt[1] |= (4 << (3 * tex_count)); + stream_loc_notcl[loc++] = 6 + tex_count; + + /* Rasterize it. */ + rX00_rs_tex(&rs, tex_count, tex_count, SWIZ_XYZW); + tex_count++; + } } } -- cgit v1.2.3