summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/r300/r300_state_derived.c
diff options
context:
space:
mode:
authorMarek Olšák <maraeo@gmail.com>2010-05-08 22:50:49 +0200
committerMarek Olšák <maraeo@gmail.com>2010-05-08 23:19:33 +0200
commitd044ecbe7625af1118655bcc9dba7ed00342534f (patch)
tree00f52655b66333a9e03f09f3a14465dc1a6fd6dc /src/gallium/drivers/r300/r300_state_derived.c
parent084580fa43320b1a0878b572c6804aa5a40b2f9d (diff)
r300g: follow pipe_rasterizer_state::light_twoside
Diffstat (limited to 'src/gallium/drivers/r300/r300_state_derived.c')
-rw-r--r--src/gallium/drivers/r300/r300_state_derived.c24
1 files changed, 20 insertions, 4 deletions
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++;
+ }
}
}