draw: rearrange debug code
authorKeith Whitwell <keith@tungstengraphics.com>
Sat, 19 Apr 2008 19:20:40 +0000 (20:20 +0100)
committerKeith Whitwell <keith@tungstengraphics.com>
Sat, 19 Apr 2008 19:20:40 +0000 (20:20 +0100)
src/gallium/auxiliary/draw/draw_pipe_vbuf.c
src/gallium/auxiliary/draw/draw_pt_fetch_emit.c
src/gallium/auxiliary/draw/draw_vertex.c
src/gallium/auxiliary/draw/draw_vertex.h

index c835727e323575ad7b7410ac2c5b8514bbb3fc73..c5810febe0e15bc1522b52cc74f101c853ad8bfd 100644 (file)
@@ -115,59 +115,6 @@ check_space( struct vbuf_stage *vbuf, unsigned nr )
 }
 
 
-static INLINE void
-dump_emitted_vertex(const struct vertex_info *vinfo, const uint8_t *data)
-{
-//   assert(vinfo == vbuf->render->get_vertex_info(vbuf->render));
-   unsigned i, j;
-
-   for (i = 0; i < vinfo->num_attribs; i++) {
-      j = vinfo->src_index[i];
-      switch (vinfo->emit[i]) {
-      case EMIT_OMIT:
-         debug_printf("EMIT_OMIT:");
-         break;
-      case EMIT_1F:
-         debug_printf("EMIT_1F:\t");
-         debug_printf("%f ", *(float *)data); data += sizeof(float);
-         break;
-      case EMIT_1F_PSIZE:
-         debug_printf("EMIT_1F_PSIZE:\t");
-         debug_printf("%f ", *(float *)data); data += sizeof(float);
-         break;
-      case EMIT_2F:
-         debug_printf("EMIT_2F:\t");
-         debug_printf("%f ", *(float *)data); data += sizeof(float);
-         debug_printf("%f ", *(float *)data); data += sizeof(float);
-         break;
-      case EMIT_3F:
-         debug_printf("EMIT_3F:\t");
-         debug_printf("%f ", *(float *)data); data += sizeof(float);
-         debug_printf("%f ", *(float *)data); data += sizeof(float);
-         debug_printf("%f ", *(float *)data); data += sizeof(float);
-         data += sizeof(float);
-         break;
-      case EMIT_4F:
-         debug_printf("EMIT_4F:\t");
-         debug_printf("%f ", *(float *)data); data += sizeof(float);
-         debug_printf("%f ", *(float *)data); data += sizeof(float);
-         debug_printf("%f ", *(float *)data); data += sizeof(float);
-         debug_printf("%f ", *(float *)data); data += sizeof(float);
-         break;
-      case EMIT_4UB:
-         debug_printf("EMIT_4UB:\t");
-         debug_printf("%u ", *data++);
-         debug_printf("%u ", *data++);
-         debug_printf("%u ", *data++);
-         debug_printf("%u ", *data++);
-         break;
-      default:
-         assert(0);
-      }
-      debug_printf("\n");
-   }
-   debug_printf("\n");
-}
 
 
 /**
@@ -189,7 +136,7 @@ emit_vertex( struct vbuf_stage *vbuf,
       vbuf->translate->set_buffer(vbuf->translate, 0, vertex->data[0], 0);
       vbuf->translate->run(vbuf->translate, 0, 1, vbuf->vertex_ptr);
 
-      if (0) dump_emitted_vertex(vbuf->vinfo, (uint8_t *)vbuf->vertex_ptr);
+      if (0) draw_dump_emitted_vertex(vbuf->vinfo, (uint8_t *)vbuf->vertex_ptr);
       
       vbuf->vertex_ptr += vbuf->vertex_size/4;
       vertex->vertex_id = vbuf->nr_vertices++;
index 70d136dce642a4544c58363318f5034e585a19b6..002ced21865b772d0120e0b13703b779ca4b03d9 100644 (file)
@@ -75,6 +75,7 @@ struct fetch_emit_middle_end {
    struct draw_context *draw;
    
    struct translate *translate;
+   const struct vertex_info *vinfo;
 
    /* Cache point size somewhere it's address won't change:
     */
@@ -106,9 +107,9 @@ static void fetch_emit_prepare( struct draw_pt_middle_end *middle,
    
    /* Must do this after set_primitive() above:
     */
-   vinfo = draw->render->get_vertex_info(draw->render);
-
-
+   vinfo = feme->vinfo = draw->render->get_vertex_info(draw->render);
+   
+   
 
    /* Transform from API vertices to HW vertices, skipping the
     * pipeline_vertex intermediate step.
@@ -229,6 +230,15 @@ static void fetch_emit_run( struct draw_pt_middle_end *middle,
                              fetch_count,
                              hw_verts );
 
+   if (0) {
+      unsigned i;
+      for (i = 0; i < fetch_count; i++) {
+         debug_printf("\n\nvertex %d:\n", i);
+         draw_dump_emitted_vertex( feme->vinfo, 
+                                   (const uint8_t *)hw_verts + feme->vinfo->size * 4 * i );
+      }
+   }
+
    /* XXX: Draw arrays path to avoid re-emitting index list again and
     * again.
     */
index a42adaafb1a686b081dccb2febd1f4207a7487e2..1446f785c51aaec2f603d66a0aaaeb2aaaa9a365 100644 (file)
@@ -73,3 +73,57 @@ draw_compute_vertex_size(struct vertex_info *vinfo)
       }
    }
 }
+
+
+void
+draw_dump_emitted_vertex(const struct vertex_info *vinfo, const uint8_t *data)
+{
+   unsigned i, j;
+
+   for (i = 0; i < vinfo->num_attribs; i++) {
+      j = vinfo->src_index[i];
+      switch (vinfo->emit[i]) {
+      case EMIT_OMIT:
+         debug_printf("EMIT_OMIT:");
+         break;
+      case EMIT_1F:
+         debug_printf("EMIT_1F:\t");
+         debug_printf("%f ", *(float *)data); data += sizeof(float);
+         break;
+      case EMIT_1F_PSIZE:
+         debug_printf("EMIT_1F_PSIZE:\t");
+         debug_printf("%f ", *(float *)data); data += sizeof(float);
+         break;
+      case EMIT_2F:
+         debug_printf("EMIT_2F:\t");
+         debug_printf("%f ", *(float *)data); data += sizeof(float);
+         debug_printf("%f ", *(float *)data); data += sizeof(float);
+         break;
+      case EMIT_3F:
+         debug_printf("EMIT_3F:\t");
+         debug_printf("%f ", *(float *)data); data += sizeof(float);
+         debug_printf("%f ", *(float *)data); data += sizeof(float);
+         debug_printf("%f ", *(float *)data); data += sizeof(float);
+         data += sizeof(float);
+         break;
+      case EMIT_4F:
+         debug_printf("EMIT_4F:\t");
+         debug_printf("%f ", *(float *)data); data += sizeof(float);
+         debug_printf("%f ", *(float *)data); data += sizeof(float);
+         debug_printf("%f ", *(float *)data); data += sizeof(float);
+         debug_printf("%f ", *(float *)data); data += sizeof(float);
+         break;
+      case EMIT_4UB:
+         debug_printf("EMIT_4UB:\t");
+         debug_printf("%u ", *data++);
+         debug_printf("%u ", *data++);
+         debug_printf("%u ", *data++);
+         debug_printf("%u ", *data++);
+         break;
+      default:
+         assert(0);
+      }
+      debug_printf("\n");
+   }
+   debug_printf("\n");
+}
index 65818463caedc8a121e2c033692db5484fc4bdc7..6d8bac513846c31366cfc4820d70bb23f3b73205 100644 (file)
@@ -106,5 +106,7 @@ draw_emit_vertex_attr(struct vertex_info *vinfo,
 
 extern void draw_compute_vertex_size(struct vertex_info *vinfo);
 
+void draw_dump_emitted_vertex(const struct vertex_info *vinfo, 
+                              const uint8_t *data);
 
 #endif /* DRAW_VERTEX_H */