r300-gallium: Properly split up RS into r300 and r500 variants.
authorCorbin Simpson <MostAwesomeDude@gmail.com>
Fri, 27 Feb 2009 20:23:16 +0000 (12:23 -0800)
committerCorbin Simpson <MostAwesomeDude@gmail.com>
Fri, 27 Feb 2009 20:25:09 +0000 (12:25 -0800)
src/gallium/drivers/r300/r300_emit.c
src/gallium/drivers/r300/r300_reg.h
src/gallium/drivers/r300/r300_state_derived.c

index 86fa46df42cd7839999033d365e732964af767a3..2f9ec2c3beba5aaa379dc0d42bdc0ad760a93e11 100644 (file)
@@ -216,7 +216,7 @@ void r300_emit_rs_block_state(struct r300_context* r300,
     CS_LOCALS(r300);
     int i;
 
-    BEGIN_CS(0);
+    BEGIN_CS(21);
     if (r300screen->caps->is_r500) {
         OUT_CS_REG_SEQ(R500_RS_IP_0, 8);
     } else {
@@ -238,6 +238,7 @@ void r300_emit_rs_block_state(struct r300_context* r300,
     for (i = 0; i < 8; i++) {
         OUT_CS(rs->inst[i]);
     }
+
     END_CS;
 }
 
index 8f31bd5d6e077f1b97ce73edd3da5243bc6bcd28..b3b8f494999d0f00537ea1643038759f747a38be 100644 (file)
@@ -732,6 +732,10 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #define R500_RS_IP_TEX_PTR_Q_SHIFT                     18
 #define R500_RS_IP_COL_PTR_SHIFT                       24
 #define R500_RS_IP_COL_FMT_SHIFT                       27
+#       define R500_RS_SEL_S(x)                         ((x) << 0)
+#       define R500_RS_SEL_T(x)                         ((x) << 6)
+#       define R500_RS_SEL_R(x)                         ((x) << 12)
+#       define R500_RS_SEL_Q(x)                         ((x) << 18)
 #      define R500_RS_COL_PTR(x)                       ((x) << 24)
 #       define R500_RS_COL_FMT(x)                       ((x) << 27)
 /* gap */
index dcf0990934dda3e02ad6814718a24c6bc5cb3a55..d17050e0d762f31a2a19f2fcb61f04fb39b311f0 100644 (file)
@@ -197,36 +197,72 @@ static void r300_update_rs_block(struct r300_context* r300)
 
     memset(rs, 0, sizeof(struct r300_rs_block));
 
-    for (i = 0; i < vinfo->num_attribs; i++) {
-        switch (vinfo->attrib[i].interp_mode) {
-            case INTERP_LINEAR:
-                rs->ip[col_count] |=
-                    R300_RS_COL_PTR(vinfo->attrib[i].src_index) |
-                    R300_RS_COL_FMT(R300_RS_COL_FMT_RGBA);
-                col_count++;
-                break;
-            case INTERP_PERSPECTIVE:
-                rs->ip[tex_count] |=
-                    R300_RS_TEX_PTR(vinfo->attrib[i].src_index) |
-                    R300_RS_SEL_S(R300_RS_SEL_C0) |
-                    R300_RS_SEL_T(R300_RS_SEL_C1) |
-                    R300_RS_SEL_R(R300_RS_SEL_C2) |
-                    R300_RS_SEL_Q(R300_RS_SEL_C3);
-                tex_count += 4;
-                break;
+    if (r300_screen(r300->context.screen)->caps->is_r500) {
+        for (i = 0; i < vinfo->num_attribs; i++) {
+            switch (vinfo->attrib[i].interp_mode) {
+                case INTERP_LINEAR:
+                    rs->ip[col_count] |=
+                        R500_RS_COL_PTR(vinfo->attrib[i].src_index) |
+                        R500_RS_COL_FMT(R300_RS_COL_FMT_RGBA);
+                    col_count++;
+                    break;
+                case INTERP_PERSPECTIVE:
+                    rs->ip[tex_count] |=
+                        R500_RS_TEX_PTR(vinfo->attrib[i].src_index) |
+                        R500_RS_SEL_S(tex_count) |
+                        R500_RS_SEL_T(tex_count + 1) |
+                        R500_RS_SEL_R(tex_count + 2) |
+                        R500_RS_SEL_Q(tex_count + 3);
+                    tex_count++;
+                    break;
+            }
         }
-    }
 
-    for (i = 0; i < tex_count; i++) {
-        rs->inst[i] |= R300_RS_INST_TEX_ID(i) | R300_RS_INST_TEX_CN_WRITE |
-            R300_RS_INST_TEX_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++;
+        }
+
+        rs->inst_count = MAX2(col_count, tex_count);
+    } else {
+        for (i = 0; i < vinfo->num_attribs; i++) {
+            switch (vinfo->attrib[i].interp_mode) {
+                case INTERP_LINEAR:
+                    rs->ip[col_count] |=
+                        R300_RS_COL_PTR(vinfo->attrib[i].src_index) |
+                        R300_RS_COL_FMT(R300_RS_COL_FMT_RGBA);
+                    col_count++;
+                    break;
+                case INTERP_PERSPECTIVE:
+                    rs->ip[tex_count] |=
+                        R300_RS_TEX_PTR(vinfo->attrib[i].src_index) |
+                        R300_RS_SEL_S(R300_RS_SEL_C0) |
+                        R300_RS_SEL_T(R300_RS_SEL_C1) |
+                        R300_RS_SEL_R(R300_RS_SEL_C2) |
+                        R300_RS_SEL_Q(R300_RS_SEL_C3);
+                    tex_count += 4;
+                    break;
+            }
+        }
 
-    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++) {
+            rs->inst[i] |= R300_RS_INST_TEX_ID(i) | 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 = (tex_count * 4) | (col_count << R300_IC_COUNT_SHIFT) |