trace: Add dump util functions for wrapped pointers
authorJakob Bornecrantz <jakob@vmware.com>
Thu, 12 Mar 2009 14:37:13 +0000 (15:37 +0100)
committerJakob Bornecrantz <jakob@vmware.com>
Thu, 12 Mar 2009 15:35:43 +0000 (16:35 +0100)
src/gallium/drivers/trace/tr_dump.c
src/gallium/drivers/trace/tr_dump.h

index 0f29ba7e7e556e667872e8a297f5882cae770bde..6837c94542d3f711ddfa74a28ef4f6e9ecfb3017 100644 (file)
@@ -52,6 +52,8 @@
 
 #include "tr_dump.h"
 #include "tr_screen.h"
+#include "tr_texture.h"
+#include "tr_buffer.h"
 
 
 static struct util_stream *stream = NULL;
@@ -403,3 +405,49 @@ void trace_dump_ptr(const void *value)
    else
       trace_dump_null();
 }
+
+void trace_dump_buffer_ptr(struct pipe_buffer *_buffer)
+{
+   if (_buffer) {
+      struct trace_screen *tr_scr = trace_screen(_buffer->screen);
+      struct trace_buffer *tr_buf = trace_buffer(tr_scr, _buffer);
+      trace_dump_ptr(tr_buf->buffer);
+   } else {
+      trace_dump_null();
+   }
+}
+
+void trace_dump_texture_ptr(struct pipe_texture *_texture)
+{
+   if (_texture) {
+      struct trace_screen *tr_scr = trace_screen(_texture->screen);
+      struct trace_texture *tr_tex = trace_texture(tr_scr, _texture);
+      trace_dump_ptr(tr_tex->texture);
+   } else {
+      trace_dump_null();
+   }
+}
+
+void trace_dump_surface_ptr(struct pipe_surface *_surface)
+{
+   if (_surface) {
+      struct trace_screen *tr_scr = trace_screen(_surface->texture->screen);
+      struct trace_texture *tr_tex = trace_texture(tr_scr, _surface->texture);
+      struct trace_surface *tr_surf = trace_surface(tr_tex, _surface);
+      trace_dump_ptr(tr_surf->surface);
+   } else {
+      trace_dump_null();
+   }
+}
+
+void trace_dump_transfer_ptr(struct pipe_transfer *_transfer)
+{
+   if (_transfer) {
+      struct trace_screen *tr_scr = trace_screen(_transfer->texture->screen);
+      struct trace_texture *tr_tex = trace_texture(tr_scr, _transfer->texture);
+      struct trace_transfer *tr_tran = trace_transfer(tr_tex, _transfer);
+      trace_dump_ptr(tr_tran->transfer);
+   } else {
+      trace_dump_null();
+   }
+}
index 00543ee3b31db64a765de12886299feee50aa0db..26409f26c66ef4c6fd0f9c6f6c98b9f1969bbb79 100644 (file)
 #include "pipe/p_compiler.h"
 
 
+struct pipe_buffer;
+struct pipe_texture;
+struct pipe_surface;
+struct pipe_transfer;
+
 boolean trace_dump_trace_begin(void);
 boolean trace_dump_enabled(void);
 void trace_dump_trace_end(void);
@@ -63,7 +68,11 @@ void trace_dump_member_begin(const char *name);
 void trace_dump_member_end(void);
 void trace_dump_null(void);
 void trace_dump_ptr(const void *value);
-
+/* will turn a wrapped object into the real one and dump ptr */
+void trace_dump_buffer_ptr(struct pipe_buffer *_buffer);
+void trace_dump_texture_ptr(struct pipe_texture *_texture);
+void trace_dump_surface_ptr(struct pipe_surface *_surface);
+void trace_dump_transfer_ptr(struct pipe_transfer *_transfer);
 
 /*
  * Code saving macros.