Mesa (master): vbo: move/refactor debug code

Brian Paul brianp at kemper.freedesktop.org
Wed Jun 3 23:18:44 UTC 2009


Module: Mesa
Branch: master
Commit: aa18e54ac9a70883a98f803c097d45f8ee84e717
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=aa18e54ac9a70883a98f803c097d45f8ee84e717

Author: Brian Paul <brianp at vmware.com>
Date:   Wed Jun  3 17:03:11 2009 -0600

vbo: move/refactor debug code

---

 src/mesa/vbo/vbo_exec_array.c |   87 +++++++++++++++++++++++------------------
 1 files changed, 49 insertions(+), 38 deletions(-)

diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c
index 74d3e19..ca24fb4 100644
--- a/src/mesa/vbo/vbo_exec_array.c
+++ b/src/mesa/vbo/vbo_exec_array.c
@@ -234,6 +234,52 @@ check_draw_arrays_data(GLcontext *ctx, GLint start, GLsizei count)
 
 
 /**
+ * Print info/data for glDrawArrays().
+ */
+static void
+print_draw_arrays(GLcontext *ctx, struct vbo_exec_context *exec,
+                  GLenum mode, GLint start, GLsizei count)
+{
+   int i;
+
+   _mesa_printf("vbo_exec_DrawArrays(mode 0x%x, start %d, count %d):\n",
+                mode, start, count);
+
+   for (i = 0; i < 32; i++) {
+      GLuint bufName = exec->array.inputs[i]->BufferObj->Name;
+      GLint stride = exec->array.inputs[i]->Stride;
+      _mesa_printf("attr %2d: size %d stride %d  enabled %d  "
+                   "ptr %p  Bufobj %u\n",
+                   i,
+                   exec->array.inputs[i]->Size,
+                   stride,
+                   /*exec->array.inputs[i]->Enabled,*/
+                   exec->array.legacy_array[i]->Enabled,
+                   exec->array.inputs[i]->Ptr,
+                   bufName);
+
+      if (bufName) {
+         struct gl_buffer_object *buf = _mesa_lookup_bufferobj(ctx, bufName);
+         GLubyte *p = ctx->Driver.MapBuffer(ctx, GL_ARRAY_BUFFER_ARB,
+                                            GL_READ_ONLY_ARB, buf);
+         int offset = (int) (GLintptr) exec->array.inputs[i]->Ptr;
+         float *f = (float *) (p + offset);
+         int *k = (int *) f;
+         int i;
+         int n = (count * stride) / 4;
+         if (n > 32)
+            n = 32;
+         _mesa_printf("  Data at offset %d:\n", offset);
+         for (i = 0; i < n; i++) {
+            _mesa_printf("    float[%d] = 0x%08x %f\n", i, k[i], f[i]);
+         }
+         ctx->Driver.UnmapBuffer(ctx, GL_ARRAY_BUFFER_ARB, buf);
+      }
+   }
+}
+
+
+/**
  * Just translate the arrayobj into a sane layout.
  */
 static void bind_array_obj( GLcontext *ctx )
@@ -455,44 +501,9 @@ vbo_exec_DrawArrays(GLenum mode, GLint start, GLsizei count)
                     start, start + count - 1 );
 
 #if 0
-   {
-      int i;
-
-      _mesa_printf("vbo_exec_DrawArrays(mode 0x%x, start %d, count %d):\n",
-                   mode, start, count);
-
-      for (i = 0; i < 32; i++) {
-         GLuint bufName = exec->array.inputs[i]->BufferObj->Name;
-         GLint stride = exec->array.inputs[i]->Stride;
-         _mesa_printf("attr %2d: size %d stride %d  enabled %d  "
-                      "ptr %p  Bufobj %u\n",
-                      i,
-                      exec->array.inputs[i]->Size,
-                      stride,
-                      /*exec->array.inputs[i]->Enabled,*/
-                      exec->array.legacy_array[i]->Enabled,
-                      exec->array.inputs[i]->Ptr,
-                      bufName);
-         
-         if (bufName) {
-            struct gl_buffer_object *buf = _mesa_lookup_bufferobj(ctx, bufName);
-            GLubyte *p = ctx->Driver.MapBuffer(ctx, GL_ARRAY_BUFFER_ARB,
-                                            GL_READ_ONLY_ARB, buf);
-            int offset = (int) exec->array.inputs[i]->Ptr;
-            float *f = (float *) (p + offset);
-            int *k = (int *) f;
-            int i;
-            int n = (count * stride) / 4;
-            if (n > 32)
-               n = 32;
-            _mesa_printf("  Data at offset %d:\n", offset);
-            for (i = 0; i < n; i++) {
-               _mesa_printf("    float[%d] = 0x%08x %f\n", i, k[i], f[i]);
-            }
-            ctx->Driver.UnmapBuffer(ctx, GL_ARRAY_BUFFER_ARB, buf);
-         }
-      }
-   }
+   print_draw_arrays(ctx, exec, mode, start, count);
+#else
+   (void) print_draw_arrays;
 #endif
 }
 




More information about the mesa-commit mailing list