Mesa (master): r300g: fix the rasterization of secondary color

Corbin Simpson csimpson at kemper.freedesktop.org
Sun Jan 17 09:14:58 UTC 2010


Module: Mesa
Branch: master
Commit: b62d339301f32d29c0a0fdaba2a0e192bff42c23
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=b62d339301f32d29c0a0fdaba2a0e192bff42c23

Author: Marek Olšák <maraeo at gmail.com>
Date:   Sun Jan 17 04:49:07 2010 +0100

r300g: fix the rasterization of secondary color

When the secondary color is used, the primary color must always be rasterized
regardless of whether it is used or not.

---

 src/gallium/drivers/r300/r300_state_derived.c |    3 ++-
 src/gallium/drivers/r300/r300_vs.c            |    9 ++++++---
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c
index 1928464..99c2720 100644
--- a/src/gallium/drivers/r300/r300_state_derived.c
+++ b/src/gallium/drivers/r300/r300_state_derived.c
@@ -350,7 +350,8 @@ static void r300_update_rs_block(struct r300_context* r300,
 
     /* Rasterize colors. */
     for (i = 0; i < ATTR_COLOR_COUNT; i++) {
-        if (vs_outputs->color[i] != ATTR_UNUSED || any_bcolor_used) {
+        if (vs_outputs->color[i] != ATTR_UNUSED || any_bcolor_used ||
+            vs_outputs->color[1] != ATTR_UNUSED) {
             /* Always rasterize if it's written by the VS,
              * otherwise it locks up. */
             rX00_rs_col(rs, col_count, i, FALSE);
diff --git a/src/gallium/drivers/r300/r300_vs.c b/src/gallium/drivers/r300/r300_vs.c
index 68aef70..9fbb830 100644
--- a/src/gallium/drivers/r300/r300_vs.c
+++ b/src/gallium/drivers/r300/r300_vs.c
@@ -124,7 +124,8 @@ static void r300_shader_vap_output_fmt(struct r300_vertex_shader* vs)
 
     /* Colors. */
     for (i = 0; i < ATTR_COLOR_COUNT; i++) {
-        if (vs_outputs->color[i] != ATTR_UNUSED || any_bcolor_used) {
+        if (vs_outputs->color[i] != ATTR_UNUSED || any_bcolor_used ||
+            vs_outputs->color[1] != ATTR_UNUSED) {
             hwfmt[1] |= R300_INPUT_CNTL_COLOR;
             hwfmt[2] |= R300_VAP_OUTPUT_VTX_FMT_0__COLOR_0_PRESENT << i;
         }
@@ -182,7 +183,8 @@ static void r300_stream_locations_notcl(
 
     /* Colors. */
     for (i = 0; i < ATTR_COLOR_COUNT; i++) {
-        if (vs_outputs->color[i] != ATTR_UNUSED || any_bcolor_used) {
+        if (vs_outputs->color[i] != ATTR_UNUSED || any_bcolor_used ||
+            vs_outputs->color[1] != ATTR_UNUSED) {
             stream_loc[tabi++] = 2 + i;
         }
     }
@@ -259,7 +261,8 @@ static void set_vertex_inputs_outputs(struct r300_vertex_program_compiler * c)
     for (i = 0; i < ATTR_COLOR_COUNT; i++) {
         if (outputs->color[i] != ATTR_UNUSED) {
             c->code->outputs[outputs->color[i]] = reg++;
-        } else if (any_bcolor_used) {
+        } else if (any_bcolor_used ||
+                   outputs->color[1] != ATTR_UNUSED) {
             reg++;
         }
     }




More information about the mesa-commit mailing list