mesa: added MESA_VERBOSE option 'draw' to debug glDrawArrays/Elements, etc.
authorBrian Paul <brianp@vmware.com>
Wed, 14 Oct 2009 22:23:22 +0000 (16:23 -0600)
committerBrian Paul <brianp@vmware.com>
Thu, 15 Oct 2009 01:08:38 +0000 (19:08 -0600)
src/mesa/main/debug.c
src/mesa/main/mtypes.h
src/mesa/vbo/vbo_exec_array.c

index 530170b52662d88626aabc5c37e77c2daa6c3321..07ed51f5abe97a2c956570358d96825043e78ac5 100644 (file)
@@ -174,7 +174,8 @@ static void add_debug_flags( const char *debug )
       { "api",       VERBOSE_API },
       { "list",      VERBOSE_DISPLAY_LIST },
       { "lighting",  VERBOSE_LIGHTING },
-      { "disassem",  VERBOSE_DISASSEM }
+      { "disassem",  VERBOSE_DISASSEM },
+      { "draw",      VERBOSE_DRAW }
    };
    GLuint i;
 
index f0f21f633f79a1a36060140c0fd906fe7e48d57a..5699db5d4a8874c8ecb91c6ede38865691b2b49a 100644 (file)
@@ -3095,6 +3095,7 @@ extern int MESA_DEBUG_FLAGS;
 #endif
 
 
+/** The MESA_VERBOSE var is a bitmask of these flags */
 enum _verbose
 {
    VERBOSE_VARRAY              = 0x0001,
@@ -3109,9 +3110,11 @@ enum _verbose
    VERBOSE_PRIMS               = 0x0400,
    VERBOSE_VERTS               = 0x0800,
    VERBOSE_DISASSEM            = 0x1000,
+   VERBOSE_DRAW                 = 0x2000
 };
 
 
+/** The MESA_DEBUG_FLAGS var is a bitmask of these flags */
 enum _debug
 {
    DEBUG_ALWAYS_FLUSH          = 0x1
index 774cffc451b861514c9c1c60170ff59a53f2120b..0e1737c21063072c8844bc67b1dfd39170f4db78 100644 (file)
@@ -33,6 +33,7 @@
 #include "main/api_noop.h"
 #include "main/varray.h"
 #include "main/bufferobj.h"
+#include "main/enums.h"
 #include "main/macros.h"
 #include "glapi/dispatch.h"
 
@@ -482,6 +483,10 @@ vbo_exec_DrawArrays(GLenum mode, GLint start, GLsizei count)
    struct vbo_exec_context *exec = &vbo->exec;
    struct _mesa_prim prim[1];
 
+   if (MESA_VERBOSE & VERBOSE_DRAW)
+      _mesa_debug(ctx, "glDrawArrays(%s, %d, %d)\n",
+                  _mesa_lookup_enum_by_nr(mode), start, count);
+
    if (!_mesa_validate_DrawArrays( ctx, mode, start, count ))
       return;
 
@@ -675,6 +680,12 @@ vbo_exec_DrawRangeElementsBaseVertex(GLenum mode,
    static GLuint warnCount = 0;
    GET_CURRENT_CONTEXT(ctx);
 
+   if (MESA_VERBOSE & VERBOSE_DRAW)
+      _mesa_debug(ctx,
+                "glDrawRangeElementsBaseVertex(%s, %u, %u, %d, %s, %p, %d)\n",
+                _mesa_lookup_enum_by_nr(mode), start, end, count,
+                _mesa_lookup_enum_by_nr(type), indices, basevertex);
+
    if (!_mesa_validate_DrawRangeElements( ctx, mode, start, end, count,
                                           type, indices, basevertex ))
       return;
@@ -761,6 +772,14 @@ vbo_exec_DrawRangeElements(GLenum mode,
                                     GLsizei count, GLenum type,
                                     const GLvoid *indices)
 {
+   GET_CURRENT_CONTEXT(ctx);
+
+   if (MESA_VERBOSE & VERBOSE_DRAW)
+      _mesa_debug(ctx,
+                  "glDrawRangeElements(%s, %u, %u, %d, %s, %p)\n",
+                  _mesa_lookup_enum_by_nr(mode), start, end, count,
+                  _mesa_lookup_enum_by_nr(type), indices);
+
    vbo_exec_DrawRangeElementsBaseVertex(mode, start, end, count, type,
                                        indices, 0);
 }
@@ -772,6 +791,11 @@ vbo_exec_DrawElements(GLenum mode, GLsizei count, GLenum type,
 {
    GET_CURRENT_CONTEXT(ctx);
 
+   if (MESA_VERBOSE & VERBOSE_DRAW)
+      _mesa_debug(ctx, "glDrawElements(%s, %u, %s, %p)\n",
+                  _mesa_lookup_enum_by_nr(mode), count,
+                  _mesa_lookup_enum_by_nr(type), indices);
+
    if (!_mesa_validate_DrawElements( ctx, mode, count, type, indices, 0 ))
       return;
 
@@ -785,6 +809,11 @@ vbo_exec_DrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type,
 {
    GET_CURRENT_CONTEXT(ctx);
 
+   if (MESA_VERBOSE & VERBOSE_DRAW)
+      _mesa_debug(ctx, "glDrawElementsBaseVertex(%s, %d, %s, %p, %d)\n",
+                  _mesa_lookup_enum_by_nr(mode), count,
+                  _mesa_lookup_enum_by_nr(type), indices, basevertex);
+
    if (!_mesa_validate_DrawElements( ctx, mode, count, type, indices,
                                     basevertex ))
       return;