r300g: fix typo in r300_reg.h to prevent the RS unit from doing random things
authorMarek Olšák <maraeo@gmail.com>
Thu, 19 Nov 2009 19:41:19 +0000 (20:41 +0100)
committerCorbin Simpson <MostAwesomeDude@gmail.com>
Sat, 21 Nov 2009 02:05:21 +0000 (18:05 -0800)
And reorder fragment shader inputs so that the colors are before texcoords,
as is allocated by the shader compiler. This commit makes VS->FS attribute
routing work on R500.

src/gallium/drivers/r300/r300_reg.h
src/gallium/drivers/r300/r300_state_derived.c

index 66fdada221091544e58fb76ddca8cf3ca3c85b77..3a419b24b01357717190fdb16cbccb9b18b1cff6 100644 (file)
@@ -1293,7 +1293,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #        define R500_RS_INST_TEX_ID(x)                  ((x) << 0)
 #define R500_RS_INST_TEX_CN_WRITE                      (1 << 4)
 #define R500_RS_INST_TEX_ADDR_SHIFT                    5
-#        define R500_RS_INST_TEX_ADDR(x)                ((x) << 0)
+#        define R500_RS_INST_TEX_ADDR(x)                ((x) << 5)
 #define R500_RS_INST_COL_ID_SHIFT                      12
 #        define R500_RS_INST_COL_ID(x)                  ((x) << 12)
 #define R500_RS_INST_COL_CN_NO_WRITE                   (0 << 16)
index 82f2be3101efa3eb7be1ac0e6c0353d4262a89e8..8faf78932dc68aa3bd505e9391bbc3a8aa25b238 100644 (file)
@@ -381,17 +381,18 @@ static void r300_update_rs_block(struct r300_context* r300,
             col_count++;
         }
 
+        for (i = 0; i < col_count; i++) {
+            rs->inst[i] |= R500_RS_INST_COL_ID(i) |
+                R500_RS_INST_COL_CN_WRITE | R500_RS_INST_COL_ADDR(fp_offset);
+            fp_offset++;
+        }
+
         for (i = 0; i < tex_count; i++) {
             rs->inst[i] |= R500_RS_INST_TEX_ID(i) |
                 R500_RS_INST_TEX_CN_WRITE | R500_RS_INST_TEX_ADDR(fp_offset);
             fp_offset++;
         }
 
-        for (i = 0; i < col_count; i++) {
-            rs->inst[i] |= R500_RS_INST_COL_ID(i) |
-                R500_RS_INST_COL_CN_WRITE | R500_RS_INST_COL_ADDR(fp_offset);
-            fp_offset++;
-        }
     } else {
         for (i = 0; i < info->num_inputs; i++) {
             switch (info->input_semantic_name[i]) {
@@ -416,8 +417,10 @@ static void r300_update_rs_block(struct r300_context* r300,
             }
         }
 
+        /* Rasterize at least one color, or bad things happen. */
         if (col_count == 0) {
             rs->ip[0] |= R300_RS_COL_FMT(R300_RS_COL_FMT_0001);
+            col_count++;
         }
 
         if (tex_count == 0) {
@@ -428,9 +431,10 @@ static void r300_update_rs_block(struct r300_context* r300,
                 R300_RS_SEL_Q(R300_RS_SEL_K1);
         }
 
-        /* Rasterize at least one color, or bad things happen. */
-        if ((col_count == 0) && (tex_count == 0)) {
-            col_count++;
+        for (i = 0; i < col_count; i++) {
+            rs->inst[i] |= R300_RS_INST_COL_ID(i) |
+                R300_RS_INST_COL_CN_WRITE | R300_RS_INST_COL_ADDR(fp_offset);
+            fp_offset++;
         }
 
         for (i = 0; i < tex_count; i++) {
@@ -438,12 +442,6 @@ static void r300_update_rs_block(struct r300_context* r300,
                 R300_RS_INST_TEX_CN_WRITE | R300_RS_INST_TEX_ADDR(fp_offset);
             fp_offset++;
         }
-
-        for (i = 0; i < col_count; i++) {
-            rs->inst[i] |= R300_RS_INST_COL_ID(i) |
-                R300_RS_INST_COL_CN_WRITE | R300_RS_INST_COL_ADDR(fp_offset);
-            fp_offset++;
-        }
     }
 
     rs->count = (rs_tex_comp) | (col_count << R300_IC_COUNT_SHIFT) |