gallium/util: add debug_print_usage_enum() debug helper
authorBrian Paul <brianp@vmware.com>
Fri, 27 Feb 2015 20:00:50 +0000 (13:00 -0700)
committerBrian Paul <brianp@vmware.com>
Fri, 27 Feb 2015 22:22:04 +0000 (15:22 -0700)
Signed-off-by: Brian Paul <brianp@vmware.com>
src/gallium/auxiliary/util/u_debug.c
src/gallium/auxiliary/util/u_debug.h

index f54fc3aa58c6adc8f8c4eac59598b6936700d34f..2d2d049b205d2c3243b07a753bf77878e652596e 100644 (file)
@@ -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
index 5706eeb8c0c4da6631b8e3ba87bc008632bf44f9..3b2255244a770621bfac0f3668ded9d161c46a14 100644 (file)
@@ -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
 }