util: add debug_print_bind_flags() debug helper
authorBrian Paul <brianp@vmware.com>
Wed, 25 Feb 2015 23:59:54 +0000 (16:59 -0700)
committerBrian Paul <brianp@vmware.com>
Thu, 26 Feb 2015 15:38:38 +0000 (08:38 -0700)
Reviewed-by: José Fonseca <jfonseca@vmware.com>
src/gallium/auxiliary/util/u_debug.c
src/gallium/auxiliary/util/u_debug.h

index 731cdec133428244521652bf673f21b5301676ac..f54fc3aa58c6adc8f8c4eac59598b6936700d34f 100644 (file)
@@ -737,5 +737,38 @@ debug_print_transfer_flags(const char *msg, unsigned usage)
 }
 
 
+/**
+ * Print PIPE_BIND_x flags with a message.
+ */
+void
+debug_print_bind_flags(const char *msg, unsigned usage)
+{
+   static const struct debug_named_value names[] = {
+      DEBUG_NAMED_VALUE(PIPE_BIND_DEPTH_STENCIL),
+      DEBUG_NAMED_VALUE(PIPE_BIND_RENDER_TARGET),
+      DEBUG_NAMED_VALUE(PIPE_BIND_BLENDABLE),
+      DEBUG_NAMED_VALUE(PIPE_BIND_SAMPLER_VIEW),
+      DEBUG_NAMED_VALUE(PIPE_BIND_VERTEX_BUFFER),
+      DEBUG_NAMED_VALUE(PIPE_BIND_INDEX_BUFFER),
+      DEBUG_NAMED_VALUE(PIPE_BIND_CONSTANT_BUFFER),
+      DEBUG_NAMED_VALUE(PIPE_BIND_DISPLAY_TARGET),
+      DEBUG_NAMED_VALUE(PIPE_BIND_TRANSFER_WRITE),
+      DEBUG_NAMED_VALUE(PIPE_BIND_TRANSFER_READ),
+      DEBUG_NAMED_VALUE(PIPE_BIND_STREAM_OUTPUT),
+      DEBUG_NAMED_VALUE(PIPE_BIND_CURSOR),
+      DEBUG_NAMED_VALUE(PIPE_BIND_CUSTOM),
+      DEBUG_NAMED_VALUE(PIPE_BIND_GLOBAL),
+      DEBUG_NAMED_VALUE(PIPE_BIND_SHADER_RESOURCE),
+      DEBUG_NAMED_VALUE(PIPE_BIND_COMPUTE_RESOURCE),
+      DEBUG_NAMED_VALUE(PIPE_BIND_COMMAND_ARGS_BUFFER),
+      DEBUG_NAMED_VALUE(PIPE_BIND_SCANOUT),
+      DEBUG_NAMED_VALUE(PIPE_BIND_SHARED),
+      DEBUG_NAMED_VALUE(PIPE_BIND_LINEAR),
+      DEBUG_NAMED_VALUE_END
+   };
+
+   debug_printf("%s: %s\n", msg, debug_dump_flags(names, usage));
+}
+
 
 #endif
index 4c22fdfb6faee6c2ef04d825b8906a673138f6eb..5706eeb8c0c4da6631b8e3ba87bc008632bf44f9 100644 (file)
@@ -467,6 +467,9 @@ void debug_dump_float_rgba_bmp(const char *filename,
 void
 debug_print_transfer_flags(const char *msg, unsigned usage);
 
+void
+debug_print_bind_flags(const char *msg, unsigned usage);
+
 
 #ifdef __cplusplus
 }