st/mesa: add some simple buffer/draw debug code
authorBrian Paul <brianp@vmware.com>
Mon, 14 Jan 2013 22:18:13 +0000 (15:18 -0700)
committerBrian Paul <brianp@vmware.com>
Tue, 15 Jan 2013 01:15:41 +0000 (18:15 -0700)
Reviewed-by: José Fonseca <jfonseca@vmware.com>
src/mesa/state_tracker/st_cb_bufferobjects.c
src/mesa/state_tracker/st_debug.c
src/mesa/state_tracker/st_debug.h
src/mesa/state_tracker/st_draw.c

index cf291c1c17639451a9cf678db20a8367908c9ac0..d5167352c40d4103209fe5610bca219c113bd933 100644 (file)
@@ -38,6 +38,7 @@
 
 #include "st_context.h"
 #include "st_cb_bufferobjects.h"
+#include "st_debug.h"
 
 #include "pipe/p_context.h"
 #include "pipe/p_defines.h"
@@ -230,6 +231,10 @@ st_bufferobj_data(struct gl_context *ctx,
 
    pipe_resource_reference( &st_obj->buffer, NULL );
 
+   if (ST_DEBUG & DEBUG_BUFFER) {
+      debug_printf("Create buffer size %lu bind 0x%x\n", size, bind);
+   }
+
    if (size != 0) {
       st_obj->buffer = pipe_buffer_create(pipe->screen, bind,
                                           pipe_usage, size);
index 850fab9250340fd63410486d07534dab06f1f7f8..d0abf5f8ca9c25b0d33f29576b15a5c21fb99575 100644 (file)
@@ -53,6 +53,8 @@ static const struct debug_named_value st_debug_flags[] = {
    { "fallback", DEBUG_FALLBACK, NULL },
    { "screen",   DEBUG_SCREEN, NULL },
    { "query",    DEBUG_QUERY, NULL },
+   { "draw",     DEBUG_DRAW, NULL },
+   { "buffer",   DEBUG_BUFFER, NULL },
    DEBUG_NAMED_VALUE_END
 };
 
index 4a060d7759c5dbf888db884e92433bd74c5de8ad..1c6e9eea17f18fa60087e1837df8b3cefeb34a4e 100644 (file)
@@ -44,6 +44,8 @@ st_print_current(void);
 #define DEBUG_FALLBACK  0x20
 #define DEBUG_QUERY     0x40
 #define DEBUG_SCREEN    0x80
+#define DEBUG_DRAW      0x100
+#define DEBUG_BUFFER    0x200
 
 #ifdef DEBUG
 extern int ST_DEBUG;
index 7de2bb9b853c79dd5940194f3bbde18b27566517..de539ca5a6f64ecb11b8290507552ea8cac0eb2d 100644 (file)
@@ -48,6 +48,7 @@
 #include "st_atom.h"
 #include "st_cb_bufferobjects.h"
 #include "st_cb_xformfb.h"
+#include "st_debug.h"
 #include "st_draw.h"
 #include "st_program.h"
 
@@ -254,6 +255,14 @@ st_draw_vbo(struct gl_context *ctx,
          info.max_index = info.start + info.count - 1;
       }
 
+      if (ST_DEBUG & DEBUG_DRAW) {
+         debug_printf("st/draw: mode %s  start %u  count %u  indexed %d\n",
+                      u_prim_name(info.mode),
+                      info.start,
+                      info.count,
+                      info.indexed);
+      }
+
       if (info.count_from_stream_output) {
          cso_draw_vbo(st->cso_context, &info);
       }