r300-gallium: Correct vertex format setup, cleanup regs and debugging.
authorCorbin Simpson <MostAwesomeDude@gmail.com>
Sat, 7 Mar 2009 21:26:48 +0000 (13:26 -0800)
committerCorbin Simpson <MostAwesomeDude@gmail.com>
Sat, 7 Mar 2009 21:28:03 +0000 (13:28 -0800)
trivial/point no longer hardlocks.

src/gallium/drivers/r300/r300_emit.c
src/gallium/drivers/r300/r300_state_derived.c
src/gallium/drivers/r300/r300_state_inlines.h
src/gallium/drivers/r300/r300_surface.c

index f55093f41d69ddbb1fcc76d14a177cba4fd71ec3..da5f2058c50079d418c19244f59fc1120c83e2e8 100644 (file)
@@ -160,7 +160,7 @@ void r300_emit_fb_state(struct r300_context* r300,
     struct r300_texture* tex;
     int i;
 
-    BEGIN_CS((5 * fb->nr_cbufs) + (fb->zsbuf ? 5 : 0) + 4);
+    BEGIN_CS((6 * fb->nr_cbufs) + (fb->zsbuf ? 5 : 0) + 4);
     for (i = 0; i < fb->nr_cbufs; i++) {
         tex = (struct r300_texture*)fb->cbufs[i]->texture;
         OUT_CS_REG_SEQ(R300_RB3D_COLOROFFSET0 + (4 * i), 1);
@@ -336,6 +336,11 @@ void r300_emit_dirty_state(struct r300_context* r300)
         r300->dirty_state &= ~R300_NEW_RASTERIZER;
     }
 
+    if (r300->dirty_state & R300_NEW_RS_BLOCK) {
+        r300_emit_rs_block_state(r300, r300->rs_block);
+        r300->dirty_state &= ~R300_NEW_RS_BLOCK;
+    }
+
     if (r300->dirty_state & R300_NEW_SCISSOR) {
         r300_emit_scissor_state(r300, r300->scissor_state);
         r300->dirty_state &= ~R300_NEW_SCISSOR;
index feb0faa13c9975aeeeac02c55acb34067e34b93c..7693f2c43396c5bdfe288503ae27a771d2050966 100644 (file)
@@ -161,6 +161,8 @@ static void r300_update_vertex_layout(struct r300_context* r300)
             r300->vertex_info.vap_prog_stream_cntl_ext[i >> 1] |=
                 (R300_VAP_SWIZZLE_XYZW << (i & 1 ? 16 : 0));
         }
+        /* Set the last vector. */
+        i--;
         r300->vertex_info.vap_prog_stream_cntl[i >> 1] |= (R300_LAST_VEC <<
                 (i & 1 ? 16 : 0));
 
@@ -226,8 +228,6 @@ static void r300_update_rs_block(struct r300_context* r300)
                 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++) {
             memory_pos = tab[vinfo->attrib[i].src_index] * 4;
@@ -261,9 +261,6 @@ static void r300_update_rs_block(struct r300_context* r300)
                 R300_RS_SEL_Q(R300_RS_SEL_K1);
         }
 
-        for (i = 0; i < 8; i++)
-            debug_printf("ip %d: 0x%x\n", i, rs->ip[i]);
-
         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);
@@ -275,17 +272,12 @@ static void r300_update_rs_block(struct r300_context* r300)
                 R300_RS_INST_COL_ADDR(fp_offset);
             fp_offset++;
         }
-
-        for (i = 0; i < 8; i++)
-            debug_printf("inst %d: 0x%x\n", i, rs->inst[i]);
     }
 
     rs->count = (tex_count * 4) | (col_count << R300_IC_COUNT_SHIFT) |
         R300_HIRES_EN;
 
     rs->inst_count = MAX2(MAX2(col_count - 1, tex_count - 1), 0);
-
-    debug_printf("count: 0x%x, inst_count: 0x%x\n", rs->count, rs->inst_count);
 }
 
 void r300_update_derived_state(struct r300_context* r300)
index 8d8b74dfc1d09bb3da84aa416186982b477d8198..cd3a4313f76011889dd516b1b211329b37f44b0f 100644 (file)
@@ -348,16 +348,16 @@ static uint32_t translate_vertex_data_type(int type) {
     switch (type) {
         case EMIT_1F:
         case EMIT_1F_PSIZE:
-            return R300_DATA_TYPE_FLOAT_1 | R300_SIGNED;
+            return R300_DATA_TYPE_FLOAT_1;
             break;
         case EMIT_2F:
-            return R300_DATA_TYPE_FLOAT_2 | R300_SIGNED;
+            return R300_DATA_TYPE_FLOAT_2;
             break;
         case EMIT_3F:
-            return R300_DATA_TYPE_FLOAT_3 | R300_SIGNED;
+            return R300_DATA_TYPE_FLOAT_3;
             break;
         case EMIT_4F:
-            return R300_DATA_TYPE_FLOAT_4 | R300_SIGNED;
+            return R300_DATA_TYPE_FLOAT_4;
             break;
         case EMIT_4UB:
             return R300_DATA_TYPE_BYTE;
index e7ba06fa3c637e86f28ad39ca84a8494523bfca4..b607b98a024571ed29b06086ff5c6921ce188c1e 100644 (file)
@@ -72,7 +72,7 @@ static void r300_surface_fill(struct pipe_context* pipe,
         r300_emit_rs_block_state(r300, &r300_rs_block_clear_state);
     }
 
-    BEGIN_CS(99 + (caps->has_tcl ? 9 : 0));
+    BEGIN_CS(97 + (caps->has_tcl ? 9 : 0));
     /* Flush PVS. */
     OUT_CS_REG(R300_VAP_PVS_STATE_FLUSH_REG, 0x0);
 
@@ -97,7 +97,6 @@ static void r300_surface_fill(struct pipe_context* pipe,
         OUT_CS_REG(R300_VAP_CNTL_STATUS, R300_VC_NO_SWAP |
                 R300_VAP_TCL_BYPASS);
     }
-    OUT_CS_REG(R300_VAP_PROG_STREAM_CNTL_0, 0x0);
     /* XXX magic number not in r300_reg */
     OUT_CS_REG(R300_VAP_PSC_SGN_NORM_CNTL, 0xAAAAAAAA);
     /* XXX point tex stuffing */