r300-gallium: A handful of fixups.
authorCorbin Simpson <MostAwesomeDude@gmail.com>
Sat, 28 Feb 2009 16:13:31 +0000 (08:13 -0800)
committerCorbin Simpson <MostAwesomeDude@gmail.com>
Sat, 28 Feb 2009 16:14:35 +0000 (08:14 -0800)
src/gallium/drivers/r300/r300_context.c
src/gallium/drivers/r300/r300_state_derived.c

index 81ac6ffc0d005c534b6f0729ebb993a1d4ac1947..a9811501435d20ffbf2f65f34c4925959984566b 100644 (file)
@@ -97,6 +97,7 @@ static void r300_destroy_context(struct pipe_context* context) {
     draw_destroy(r300->draw);
 
     FREE(r300->blend_color_state);
+    FREE(r300->rs_block);
     FREE(r300->scissor_state);
     FREE(r300);
 }
@@ -126,6 +127,7 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
     draw_set_rasterize_stage(r300->draw, r300_draw_swtcl_stage(r300));
 
     r300->blend_color_state = CALLOC_STRUCT(r300_blend_color_state);
+    r300->rs_block = CALLOC_STRUCT(r300_rs_block);
     r300->scissor_state = CALLOC_STRUCT(r300_scissor_state);
 
     r300_init_flush_functions(r300);
index 5bf4f24b7a8156e71476921eadd70a0c36ed5341..548a840f25d636ae5efe138828f71b43d12b52c9 100644 (file)
@@ -83,6 +83,7 @@ static void r300_update_vertex_layout(struct r300_context* r300)
                 break;
             case TGSI_SEMANTIC_FOG:
                 fog = TRUE;
+                tab[i] = 6 + texs++;
                 break;
             case TGSI_SEMANTIC_PSIZE:
                 psize = TRUE;
@@ -110,6 +111,11 @@ static void r300_update_vertex_layout(struct r300_context* r300)
 
     if (!pos) {
         debug_printf("r300: Forcing vertex position attribute emit...\n");
+        /* Make room for the position attribute
+         * at the beginning of the tab. */
+        for (i = 1; i < 16; i++) {
+            tab[i] = tab[i-1];
+        }
         tab[0] = 0;
     }
 
@@ -131,16 +137,17 @@ static void r300_update_vertex_layout(struct r300_context* r300)
         vinfo.hwfmt[2] |= (R300_VAP_OUTPUT_VTX_FMT_0__COLOR_0_PRESENT << i);
     }
 
-    if (fog) {
+    for (i = 0; i < texs; i++) {
         draw_emit_vertex_attr(&vinfo, EMIT_4F, INTERP_PERSPECTIVE,
-            draw_find_vs_output(r300->draw, TGSI_SEMANTIC_FOG, 0));
-        vinfo.hwfmt[2] |=
-            (R300_VAP_OUTPUT_VTX_FMT_0__COLOR_0_PRESENT << cols);
+            draw_find_vs_output(r300->draw, TGSI_SEMANTIC_GENERIC, i));
+        vinfo.hwfmt[1] |= (R300_INPUT_CNTL_TC0 << i);
+        vinfo.hwfmt[3] |= (4 << (3 * i));
     }
 
-    for (i = 0; i < texs; i++) {
+    if (fog) {
+        i++;
         draw_emit_vertex_attr(&vinfo, EMIT_4F, INTERP_PERSPECTIVE,
-            draw_find_vs_output(r300->draw, TGSI_SEMANTIC_GENERIC, i));
+            draw_find_vs_output(r300->draw, TGSI_SEMANTIC_FOG, 0));
         vinfo.hwfmt[1] |= (R300_INPUT_CNTL_TC0 << i);
         vinfo.hwfmt[3] |= (4 << (3 * i));
     }
@@ -159,7 +166,15 @@ static void r300_update_vertex_layout(struct r300_context* r300)
 
         for (i = 0; i < vinfo.num_attribs; i++) {
             /* Make sure we have a proper destination for our attribute */
-            if (tab[i] != -1) {
+            if (tab[i] == -1) {
+                debug_printf("attrib count: %d, fp input count: %d\n",
+                        vinfo.num_attribs, info->num_inputs);
+                for (i = 0; i < vinfo.num_attribs; i++) {
+                    debug_printf("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]);
+                }
                 assert(0);
             }