trace: Fix set_index_buffer and draw_vbo tracing.
authorJosé Fonseca <jfonseca@vmware.com>
Sat, 25 Sep 2010 13:55:00 +0000 (14:55 +0100)
committerJosé Fonseca <jfonseca@vmware.com>
Wed, 29 Sep 2010 21:29:22 +0000 (22:29 +0100)
src/gallium/drivers/trace/tr_context.c
src/gallium/drivers/trace/tr_dump_state.c
src/gallium/drivers/trace/tr_dump_state.h

index 271cd4aff5ec2c4c1a26cbba7f0ad7159d9cd6d0..04f30f82c3d92fe38eaca47696740957f98b6ee4 100644 (file)
@@ -92,15 +92,7 @@ trace_context_draw_vbo(struct pipe_context *_pipe,
    trace_dump_call_begin("pipe_context", "draw_vbo");
 
    trace_dump_arg(ptr,  pipe);
-   trace_dump_arg(bool, info->indexed);
-   trace_dump_arg(uint, info->mode);
-   trace_dump_arg(uint, info->start);
-   trace_dump_arg(uint, info->count);
-   trace_dump_arg(uint, info->start_instance);
-   trace_dump_arg(uint, info->instance_count);
-   trace_dump_arg(int,  info->index_bias);
-   trace_dump_arg(uint, info->min_index);
-   trace_dump_arg(uint, info->max_index);
+   trace_dump_arg(draw_info, info);
 
    pipe->draw_vbo(pipe, info);
 
@@ -987,24 +979,24 @@ trace_context_set_vertex_buffers(struct pipe_context *_pipe,
 
 static INLINE void
 trace_context_set_index_buffer(struct pipe_context *_pipe,
-                               const struct pipe_index_buffer *_ib)
+                               const struct pipe_index_buffer *ib)
 {
    struct trace_context *tr_ctx = trace_context(_pipe);
    struct pipe_context *pipe = tr_ctx->pipe;
-   struct pipe_index_buffer unwrapped_ib, *ib = NULL;
-
-   if (_ib) {
-      unwrapped_ib = *_ib;
-      unwrapped_ib.buffer = trace_resource_unwrap(tr_ctx, _ib->buffer);
-      ib = &unwrapped_ib;
-   }
 
    trace_dump_call_begin("pipe_context", "set_index_buffer");
 
    trace_dump_arg(ptr, pipe);
-   trace_dump_arg(index_buffer, _ib);
+   trace_dump_arg(index_buffer, ib);
 
-   pipe->set_index_buffer(pipe, ib);
+   if (ib) {
+      struct pipe_index_buffer _ib;
+      _ib = *ib;
+      _ib.buffer = trace_resource_unwrap(tr_ctx, ib->buffer);
+      pipe->set_index_buffer(pipe, &_ib);
+   } else {
+      pipe->set_index_buffer(pipe, NULL);
+   }
 
    trace_dump_call_end();
 }
index bd9a9bfaf16cea9a853b106240899d8eae541705..8f816060324d50558940d1ccc5165cc97d29c5b2 100644 (file)
@@ -573,3 +573,32 @@ void trace_dump_vertex_element(const struct pipe_vertex_element *state)
 
    trace_dump_struct_end();
 }
+
+
+void trace_dump_draw_info(const struct pipe_draw_info *state)
+{
+   if (!trace_dumping_enabled_locked())
+      return;
+
+   if(!state) {
+      trace_dump_null();
+      return;
+   }
+
+   trace_dump_struct_begin("pipe_draw_info");
+
+   trace_dump_member(bool, state, indexed);
+
+   trace_dump_member(uint, state, mode);
+   trace_dump_member(uint, state, start);
+   trace_dump_member(uint, state, count);
+
+   trace_dump_member(uint, state, start_instance);
+   trace_dump_member(uint, state, instance_count);
+
+   trace_dump_member(int,  state, index_bias);
+   trace_dump_member(uint, state, min_index);
+   trace_dump_member(uint, state, max_index);
+
+   trace_dump_struct_end();
+}
index 2e70f4e1c74230e71a2a30050662c9f7e9d0e221..078d20861096fc0fba8930da497f8bf8c336cde3 100644 (file)
@@ -79,5 +79,7 @@ void trace_dump_index_buffer(const struct pipe_index_buffer *state);
 
 void trace_dump_vertex_element(const struct pipe_vertex_element *state);
 
+void trace_dump_draw_info(const struct pipe_draw_info *state);
+
 
 #endif /* TR_STATE_H */