Mesa (master): mesa: added _mesa_print_arrays() for debugging

Brian Paul brianp at kemper.freedesktop.org
Thu May 21 15:32:19 UTC 2009


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

Author: Brian Paul <brianp at vmware.com>
Date:   Thu May 14 16:25:32 2009 -0600

mesa: added _mesa_print_arrays() for debugging

---

 src/mesa/main/varray.c |   47 ++++++++++++++++++++++++++++++++++++++++++++++-
 src/mesa/main/varray.h |   17 +++++------------
 2 files changed, 51 insertions(+), 13 deletions(-)

diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
index a9c9162..8e6ef9c 100644
--- a/src/mesa/main/varray.c
+++ b/src/mesa/main/varray.c
@@ -1,8 +1,9 @@
 /*
  * Mesa 3-D graphics library
- * Version:  7.2
+ * Version:  7.6
  *
  * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.
+ * Copyright (C) 2009  VMware, Inc.  All Rights Reserved.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
@@ -1033,6 +1034,50 @@ _mesa_MultiModeDrawElementsIBM( const GLenum * mode, const GLsizei * count,
 
 
 /**
+ * Print vertex array's fields.
+ */
+static void
+print_array(const char *name, GLint index, const struct gl_client_array *array)
+{
+   if (index >= 0)
+      _mesa_printf("  %s[%d]: ", name, index);
+   else
+      _mesa_printf("  %s: ", name);
+   _mesa_printf("Ptr=%p, Type=0x%x, Size=%d, ElemSize=%u, Stride=%d, Buffer=%u(Size %u), MaxElem=%u\n",
+                array->Ptr, array->Type, array->Size,
+                array->_ElementSize, array->StrideB,
+                array->BufferObj->Name, array->BufferObj->Size,
+                array->_MaxElement);
+}
+
+
+/**
+ * Print current vertex object/array info.  For debug.
+ */
+void
+_mesa_print_arrays(GLcontext *ctx)
+{
+   const struct gl_array_object *arrayObj = ctx->Array.ArrayObj;
+   GLuint i;
+
+   _mesa_printf("Array Object %u\n", arrayObj->Name);
+   if (arrayObj->Vertex.Enabled)
+      print_array("Vertex", -1, &arrayObj->Vertex);
+   if (arrayObj->Normal.Enabled)
+      print_array("Normal", -1, &arrayObj->Normal);
+   if (arrayObj->Color.Enabled)
+      print_array("Color", -1, &arrayObj->Color);
+   for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++)
+      if (arrayObj->TexCoord[i].Enabled)
+         print_array("TexCoord", i, &arrayObj->TexCoord[i]);
+   for (i = 0; i < VERT_ATTRIB_MAX; i++)
+      if (arrayObj->VertexAttrib[i].Enabled)
+         print_array("Attrib", i, &arrayObj->VertexAttrib[i]);
+   _mesa_printf("  _MaxElement = %u\n", arrayObj->_MaxElement);
+}
+
+
+/**
  * Initialize vertex array state for given context.
  */
 void 
diff --git a/src/mesa/main/varray.h b/src/mesa/main/varray.h
index 97d5c82..46cc3ee 100644
--- a/src/mesa/main/varray.h
+++ b/src/mesa/main/varray.h
@@ -1,18 +1,9 @@
-/**
- * \file varray.h
- * Vertex arrays.
- *
- * \if subset
- * (No-op)
- *
- * \endif
- */
-
 /*
  * Mesa 3-D graphics library
- * Version:  4.1
+ * Version:  7.6
  *
- * Copyright (C) 1999-2002  Brian Paul   All Rights Reserved.
+ * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.
+ * Copyright (C) 2009  VMware, Inc.  All Rights Reserved.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
@@ -169,6 +160,8 @@ _mesa_DrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count,
                         GLenum type, const GLvoid *indices);
 
 
+extern void
+_mesa_print_arrays(GLcontext *ctx);
 
 extern void
 _mesa_init_varray( GLcontext * ctx );




More information about the mesa-commit mailing list