[Mesa-dev] [PATCH 13/16] gallium/auxiliary: add dump functions for Nine
David Heidelberger
david.heidelberger at ixit.cz
Sat Oct 18 04:55:03 PDT 2014
From: Christoph Bumiller <christoph.bumiller at speed.at>
Signed-off-by: David Heidelberger <david.heidelberger at ixit.cz>
---
src/gallium/auxiliary/util/u_dump.h | 6 +++
src/gallium/auxiliary/util/u_dump_defines.c | 78 +++++++++++++++++++++++++++++
2 files changed, 84 insertions(+)
diff --git a/src/gallium/auxiliary/util/u_dump.h b/src/gallium/auxiliary/util/u_dump.h
index 58e7dfd..84ba1ed 100644
--- a/src/gallium/auxiliary/util/u_dump.h
+++ b/src/gallium/auxiliary/util/u_dump.h
@@ -88,6 +88,12 @@ util_dump_tex_filter(unsigned value, boolean shortened);
const char *
util_dump_query_type(unsigned value, boolean shortened);
+const char *
+util_dump_bind_flags(unsigned flags);
+
+const char *
+util_dump_transfer_flags(unsigned flags);
+
/*
* p_state.h, through a FILE
diff --git a/src/gallium/auxiliary/util/u_dump_defines.c b/src/gallium/auxiliary/util/u_dump_defines.c
index 03fd15d..5a3446a 100644
--- a/src/gallium/auxiliary/util/u_dump_defines.c
+++ b/src/gallium/auxiliary/util/u_dump_defines.c
@@ -61,6 +61,28 @@ util_dump_enum_continuous(unsigned value,
return names[value];
}
+static const char *
+util_dump_flags(unsigned flags, const char *prefix,
+ unsigned num_names,
+ const char **names)
+{
+ static __thread char str[256];
+ int i, pos;
+
+ if (!flags)
+ return "";
+ pos = snprintf(str, Elements(str), "%s_", prefix);
+
+ for (i = 0; (i < num_names) && flags; flags >>= 1, ++i) {
+ if (flags & 1) {
+ pos += snprintf(&str[pos], Elements(str) - pos, "%s", names[i]);
+ if (flags & ~1)
+ pos += snprintf(&str[pos], Elements(str) - pos, "|");
+ }
+ }
+ return str;
+}
+
#define DEFINE_UTIL_DUMP_CONTINUOUS(_name) \
const char * \
@@ -90,6 +112,14 @@ util_dump_enum_continuous(unsigned value,
}
+#define DEFINE_UTIL_DUMP_FLAGS(_prefix, _name) \
+ const char * \
+ util_dump_##_name##_flags(unsigned flags) \
+ { \
+ return util_dump_flags(flags, _prefix, Elements(util_dump_##_name##_flag_names), util_dump_##_name##_flag_names); \
+ }
+
+
static const char *
util_dump_blend_factor_names[] = {
UTIL_DUMP_INVALID_NAME, /* 0x0 */
@@ -392,3 +422,51 @@ util_dump_query_type_short_names[] = {
};
DEFINE_UTIL_DUMP_CONTINUOUS(query_type)
+
+
+static const char *
+util_dump_bind_flag_names[] = {
+ "DEPTH_STENCIL",
+ "RENDER_TARGET",
+ "BLENDABLE",
+ "SAMPLER_VIEW",
+ "VERTEX_BUFFER",
+ "INDEX_BUFFER",
+ "CONSTANT_BUFFER",
+ "(7)",
+ "DISPLAY_TARGET",
+ "TRANSFER_WRITE",
+ "TRANSFER_READ",
+ "STREAM_OUTPUT",
+ "(12)",
+ "(13)",
+ "(14)",
+ "(15)",
+ "CURSOR",
+ "CUSTOM",
+ "GLOBAL",
+ "SHADER_RESOURCE",
+ "COMPUTE_RESOURCE"
+};
+
+DEFINE_UTIL_DUMP_FLAGS("PIPE_BIND", bind)
+
+
+static const char *
+util_dump_transfer_flag_names[] = {
+ "READ",
+ "WRITE",
+ "MAP_DIRECTLY",
+ "(3)",
+ "(4)",
+ "(5)",
+ "(6)",
+ "(7)",
+ "DISCARD_RANGE",
+ "DONTBLOCK",
+ "UNSYNCHRONIZED",
+ "FLUSH_EXPLICIT",
+ "DISCARD_WHOLE_RESOURCE"
+};
+
+DEFINE_UTIL_DUMP_FLAGS("", transfer)
--
2.1.2
More information about the mesa-dev
mailing list