Mesa (master): gallium/util: add debug_print_usage_enum() debug helper

Brian Paul brianp at kemper.freedesktop.org
Fri Feb 27 22:27:27 UTC 2015


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

Author: Brian Paul <brianp at vmware.com>
Date:   Fri Feb 27 13:00:50 2015 -0700

gallium/util: add debug_print_usage_enum() debug helper

Signed-off-by: Brian Paul <brianp at vmware.com>

---

 src/gallium/auxiliary/util/u_debug.c |   19 +++++++++++++++++++
 src/gallium/auxiliary/util/u_debug.h |    3 +++
 2 files changed, 22 insertions(+)

diff --git a/src/gallium/auxiliary/util/u_debug.c b/src/gallium/auxiliary/util/u_debug.c
index f54fc3a..2d2d049 100644
--- a/src/gallium/auxiliary/util/u_debug.c
+++ b/src/gallium/auxiliary/util/u_debug.c
@@ -771,4 +771,23 @@ debug_print_bind_flags(const char *msg, unsigned usage)
 }
 
 
+/**
+ * Print PIPE_USAGE_x enum values with a message.
+ */
+void
+debug_print_usage_enum(const char *msg, unsigned usage)
+{
+   static const struct debug_named_value names[] = {
+      DEBUG_NAMED_VALUE(PIPE_USAGE_DEFAULT),
+      DEBUG_NAMED_VALUE(PIPE_USAGE_IMMUTABLE),
+      DEBUG_NAMED_VALUE(PIPE_USAGE_DYNAMIC),
+      DEBUG_NAMED_VALUE(PIPE_USAGE_STREAM),
+      DEBUG_NAMED_VALUE(PIPE_USAGE_STAGING),
+      DEBUG_NAMED_VALUE_END
+   };
+
+   debug_printf("%s: %s\n", msg, debug_dump_enum(names, usage));
+}
+
+
 #endif
diff --git a/src/gallium/auxiliary/util/u_debug.h b/src/gallium/auxiliary/util/u_debug.h
index 5706eeb..3b22552 100644
--- a/src/gallium/auxiliary/util/u_debug.h
+++ b/src/gallium/auxiliary/util/u_debug.h
@@ -470,6 +470,9 @@ debug_print_transfer_flags(const char *msg, unsigned usage);
 void
 debug_print_bind_flags(const char *msg, unsigned usage);
 
+void
+debug_print_usage_enum(const char *msg, unsigned usage);
+
 
 #ifdef	__cplusplus
 }




More information about the mesa-commit mailing list