r300-gallium: Cleanup PSC for HW TCL.
authorCorbin Simpson <MostAwesomeDude@gmail.com>
Mon, 11 May 2009 16:57:57 +0000 (09:57 -0700)
committerCorbin Simpson <MostAwesomeDude@gmail.com>
Mon, 11 May 2009 16:57:57 +0000 (09:57 -0700)
Still dies in assert, but at least it's not my assert anymore. :3

src/gallium/drivers/r300/r300_state_derived.c

index c4c9784a00c1302eb7b256bb176edd6f50d931e8..caa5f3b5433bf00ded4a3353b8e28784a48a15db 100644 (file)
@@ -162,26 +162,40 @@ static void r300_vs_tab_routes(struct r300_context* r300,
 static void r300_vertex_psc(struct r300_context* r300,
                             struct r300_vertex_format* vformat)
 {
+    struct r300_screen* r300screen = r300_screen(r300->context.screen);
     struct vertex_info* vinfo = &vformat->vinfo;
     int* tab = vformat->vs_tab;
     uint32_t temp;
-    int i;
+    int i, attrib_count;
 
-    debug_printf("r300: attrib count: %d\n", vinfo->num_attribs);
-    for (i = 0; i < vinfo->num_attribs; i++) {
-        debug_printf("r300: attrib: offset %d, interp %d, size %d,"
-               " tab %d\n", vinfo->attrib[i].src_index,
-               vinfo->attrib[i].interp_mode, vinfo->attrib[i].emit,
-               tab[i]);
+    /* Vertex shaders have no semantics on their inputs,
+     * so PSC should just route stuff based on their info,
+     * and not on attrib information. */
+    if (r300screen->caps->has_tcl) {
+        attrib_count = r300->vs->info.num_inputs;
+        debug_printf("r300: routing %d attribs in psc for vs\n",
+                attrib_count);
+    } else {
+        attrib_count = vinfo->num_attribs;
+        debug_printf("r300: attrib count: %d\n", attrib_count);
+        for (i = 0; i < attrib_count; i++) {
+            debug_printf("r300: attrib: offset %d, interp %d, size %d,"
+                   " tab %d\n", vinfo->attrib[i].src_index,
+                   vinfo->attrib[i].interp_mode, vinfo->attrib[i].emit,
+                   tab[i]);
+        }
     }
 
-    for (i = 0; i < vinfo->num_attribs; i++) {
+    for (i = 0; i < attrib_count; i++) {
         /* Make sure we have a proper destination for our attribute */
         assert(tab[i] != -1);
 
         /* Add the attribute to the PSC table. */
-        temp = translate_vertex_data_type(vinfo->attrib[i].emit) |
-            (tab[i] << R300_DST_VEC_LOC_SHIFT);
+        temp = r300screen->caps->has_tcl ?
+            R300_DATA_TYPE_FLOAT_4 :
+            translate_vertex_data_type(vinfo->attrib[i].emit);
+        temp |= tab[i] << R300_DST_VEC_LOC_SHIFT;
+
         if (i & 1) {
             vformat->vap_prog_stream_cntl[i >> 1] &= 0x0000ffff;
             vformat->vap_prog_stream_cntl[i >> 1] |= temp << 16;
@@ -206,7 +220,6 @@ static void r300_vertex_psc(struct r300_context* r300,
 /* Update the vertex format. */
 static void r300_update_vertex_format(struct r300_context* r300)
 {
-    struct r300_screen* r300screen = r300_screen(r300->context.screen);
     struct r300_vertex_format vformat;
     int i;