}
-#define DEFINE_UTIL_DUMP_CONTINUOUS(_name) \
+#define DEFINE_UTIL_STR_CONTINUOUS(_name) \
const char * \
- util_dump_##_name(unsigned value, boolean shortened) \
+ util_str_##_name(unsigned value, boolean shortened) \
{ \
if(shortened) \
- return util_dump_enum_continuous(value, Elements(util_dump_##_name##_short_names), util_dump_##_name##_short_names); \
+ return util_dump_enum_continuous(value, ARRAY_SIZE(util_##_name##_short_names), util_##_name##_short_names); \
else \
- return util_dump_enum_continuous(value, Elements(util_dump_##_name##_names), util_dump_##_name##_names); \
+ return util_dump_enum_continuous(value, ARRAY_SIZE(util_##_name##_names), util_##_name##_names); \
+ }
+
+
+/**
+ * Same as DEFINE_UTIL_STR_CONTINUOUS but with static assertions to detect
+ * failures to update lists.
+ */
+#define DEFINE_UTIL_STR_CONTINUOUS_COUNT(_name, _count) \
+ const char * \
+ util_str_##_name(unsigned value, boolean shortened) \
+ { \
+ STATIC_ASSERT(ARRAY_SIZE(util_##_name##_names) == _count); \
+ STATIC_ASSERT(ARRAY_SIZE(util_##_name##_short_names) == _count); \
+ if(shortened) \
+ return util_dump_enum_continuous(value, ARRAY_SIZE(util_##_name##_short_names), util_##_name##_short_names); \
+ else \
+ return util_dump_enum_continuous(value, ARRAY_SIZE(util_##_name##_names), util_##_name##_names); \
}
static const char *
-util_dump_blend_factor_names[] = {
+util_blend_factor_names[] = {
UTIL_DUMP_INVALID_NAME, /* 0x0 */
"PIPE_BLENDFACTOR_ONE",
"PIPE_BLENDFACTOR_SRC_COLOR",
};
static const char *
-util_dump_blend_factor_short_names[] = {
+util_blend_factor_short_names[] = {
UTIL_DUMP_INVALID_NAME, /* 0x0 */
"one",
"src_color",
"inv_src1_alpha"
};
-DEFINE_UTIL_DUMP_CONTINUOUS(blend_factor)
+DEFINE_UTIL_STR_CONTINUOUS(blend_factor)
static const char *
-util_dump_blend_func_names[] = {
+util_blend_func_names[] = {
"PIPE_BLEND_ADD",
"PIPE_BLEND_SUBTRACT",
"PIPE_BLEND_REVERSE_SUBTRACT",
};
static const char *
-util_dump_blend_func_short_names[] = {
+util_blend_func_short_names[] = {
"add",
"sub",
"rev_sub",
"max"
};
-DEFINE_UTIL_DUMP_CONTINUOUS(blend_func)
+DEFINE_UTIL_STR_CONTINUOUS(blend_func)
static const char *
-util_dump_func_names[] = {
+util_logicop_names[] = {
+ "PIPE_LOGICOP_CLEAR",
+ "PIPE_LOGICOP_NOR",
+ "PIPE_LOGICOP_AND_INVERTED",
+ "PIPE_LOGICOP_COPY_INVERTED",
+ "PIPE_LOGICOP_AND_REVERSE",
+ "PIPE_LOGICOP_INVERT",
+ "PIPE_LOGICOP_XOR",
+ "PIPE_LOGICOP_NAND",
+ "PIPE_LOGICOP_AND",
+ "PIPE_LOGICOP_EQUIV",
+ "PIPE_LOGICOP_NOOP",
+ "PIPE_LOGICOP_OR_INVERTED",
+ "PIPE_LOGICOP_COPY",
+ "PIPE_LOGICOP_OR_REVERSE",
+ "PIPE_LOGICOP_OR",
+ "PIPE_LOGICOP_SET"
+};
+
+static const char *
+util_logicop_short_names[] = {
+ "clear",
+ "nor",
+ "and_inverted",
+ "copy_inverted",
+ "and_reverse",
+ "invert",
+ "xor",
+ "nand",
+ "and",
+ "equiv",
+ "noop",
+ "or_inverted",
+ "copy",
+ "or_reverse",
+ "or",
+ "set"
+};
+
+DEFINE_UTIL_STR_CONTINUOUS(logicop)
+
+
+static const char *
+util_func_names[] = {
"PIPE_FUNC_NEVER",
"PIPE_FUNC_LESS",
"PIPE_FUNC_EQUAL",
};
static const char *
-util_dump_func_short_names[] = {
+util_func_short_names[] = {
"never",
"less",
"equal",
"always"
};
-DEFINE_UTIL_DUMP_CONTINUOUS(func)
+DEFINE_UTIL_STR_CONTINUOUS(func)
+
+static const char *
+util_stencil_op_names[] = {
+ "PIPE_STENCIL_OP_KEEP",
+ "PIPE_STENCIL_OP_ZERO",
+ "PIPE_STENCIL_OP_REPLACE",
+ "PIPE_STENCIL_OP_INCR",
+ "PIPE_STENCIL_OP_DECR",
+ "PIPE_STENCIL_OP_INCR_WRAP",
+ "PIPE_STENCIL_OP_DECR_WRAP",
+ "PIPE_STENCIL_OP_INVERT"
+};
static const char *
-util_dump_tex_target_names[] = {
+util_stencil_op_short_names[] = {
+ "keep",
+ "zero",
+ "replace",
+ "incr",
+ "decr",
+ "incr_wrap",
+ "decr_wrap",
+ "invert"
+};
+
+DEFINE_UTIL_STR_CONTINUOUS(stencil_op)
+
+
+static const char *
+util_tex_target_names[] = {
+ "PIPE_BUFFER",
"PIPE_TEXTURE_1D",
"PIPE_TEXTURE_2D",
"PIPE_TEXTURE_3D",
- "PIPE_TEXTURE_CUBE"
+ "PIPE_TEXTURE_CUBE",
+ "PIPE_TEXTURE_RECT",
+ "PIPE_TEXTURE_1D_ARRAY",
+ "PIPE_TEXTURE_2D_ARRAY",
+ "PIPE_TEXTURE_CUBE_ARRAY",
};
static const char *
-util_dump_tex_target_short_names[] = {
+util_tex_target_short_names[] = {
+ "buffer",
"1d",
"2d",
"3d",
- "cube"
+ "cube",
+ "rect",
+ "1d_array",
+ "2d_array",
+ "cube_array",
};
-DEFINE_UTIL_DUMP_CONTINUOUS(tex_target)
+DEFINE_UTIL_STR_CONTINUOUS_COUNT(tex_target, PIPE_MAX_TEXTURE_TYPES)
static const char *
-util_dump_tex_wrap_names[] = {
+util_tex_wrap_names[] = {
"PIPE_TEX_WRAP_REPEAT",
"PIPE_TEX_WRAP_CLAMP",
"PIPE_TEX_WRAP_CLAMP_TO_EDGE",
};
static const char *
-util_dump_tex_wrap_short_names[] = {
+util_tex_wrap_short_names[] = {
"repeat",
"clamp",
"clamp_to_edge",
"mirror_clamp_to_border"
};
-DEFINE_UTIL_DUMP_CONTINUOUS(tex_wrap)
+DEFINE_UTIL_STR_CONTINUOUS(tex_wrap)
static const char *
-util_dump_tex_mipfilter_names[] = {
+util_tex_mipfilter_names[] = {
"PIPE_TEX_MIPFILTER_NEAREST",
"PIPE_TEX_MIPFILTER_LINEAR",
"PIPE_TEX_MIPFILTER_NONE"
};
static const char *
-util_dump_tex_mipfilter_short_names[] = {
+util_tex_mipfilter_short_names[] = {
"nearest",
"linear",
"none"
};
-DEFINE_UTIL_DUMP_CONTINUOUS(tex_mipfilter)
+DEFINE_UTIL_STR_CONTINUOUS(tex_mipfilter)
static const char *
-util_dump_tex_filter_names[] = {
+util_tex_filter_names[] = {
"PIPE_TEX_FILTER_NEAREST",
"PIPE_TEX_FILTER_LINEAR"
};
static const char *
-util_dump_tex_filter_short_names[] = {
+util_tex_filter_short_names[] = {
"nearest",
"linear"
};
-DEFINE_UTIL_DUMP_CONTINUOUS(tex_filter)
+DEFINE_UTIL_STR_CONTINUOUS(tex_filter)
+
+
+static const char *
+util_query_type_names[] = {
+ "PIPE_QUERY_OCCLUSION_COUNTER",
+ "PIPE_QUERY_OCCLUSION_PREDICATE",
+ "PIPE_QUERY_OCCLUSION_PREDICATE_CONSERVATIVE",
+ "PIPE_QUERY_TIMESTAMP",
+ "PIPE_QUERY_TIMESTAMP_DISJOINT",
+ "PIPE_QUERY_TIME_ELAPSED",
+ "PIPE_QUERY_PRIMITIVES_GENERATED",
+ "PIPE_QUERY_PRIMITIVES_EMITTED",
+ "PIPE_QUERY_SO_STATISTICS",
+ "PIPE_QUERY_SO_OVERFLOW_PREDICATE",
+ "PIPE_QUERY_SO_OVERFLOW_ANY_PREDICATE",
+ "PIPE_QUERY_GPU_FINISHED",
+ "PIPE_QUERY_PIPELINE_STATISTICS",
+};
+
+static const char *
+util_query_type_short_names[] = {
+ "occlusion_counter",
+ "occlusion_predicate",
+ "timestamp",
+ "timestamp_disjoint",
+ "time_elapsed",
+ "primitives_generated",
+ "primitives_emitted",
+ "so_statistics",
+ "so_overflow_predicate",
+ "gpu_finished",
+ "pipeline_statistics",
+};
+
+DEFINE_UTIL_STR_CONTINUOUS(query_type)
+
+
+static const char *
+util_query_value_type_names[] = {
+ "PIPE_QUERY_TYPE_I32",
+ "PIPE_QUERY_TYPE_U32",
+ "PIPE_QUERY_TYPE_I64",
+ "PIPE_QUERY_TYPE_U64",
+};
+
+static const char *
+util_query_value_type_short_names[] = {
+ "i32",
+ "u32",
+ "i64",
+ "u64",
+};
+
+DEFINE_UTIL_STR_CONTINUOUS(query_value_type)
+
+
+static const char *
+util_prim_mode_names[] = {
+ "PIPE_PRIM_POINTS",
+ "PIPE_PRIM_LINES",
+ "PIPE_PRIM_LINE_LOOP",
+ "PIPE_PRIM_LINE_STRIP",
+ "PIPE_PRIM_TRIANGLES",
+ "PIPE_PRIM_TRIANGLE_STRIP",
+ "PIPE_PRIM_TRIANGLE_FAN",
+ "PIPE_PRIM_QUADS",
+ "PIPE_PRIM_QUAD_STRIP",
+ "PIPE_PRIM_POLYGON",
+ "PIPE_PRIM_LINES_ADJACENCY",
+ "PIPE_PRIM_LINE_STRIP_ADJACENCY",
+ "PIPE_PRIM_TRIANGLES_ADJACENCY",
+ "PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY",
+ "PIPE_PRIM_PATCHES",
+};
+
+static const char *
+util_prim_mode_short_names[] = {
+ "points",
+ "lines",
+ "line_loop",
+ "line_strip",
+ "triangles",
+ "triangle_strip",
+ "triangle_fan",
+ "quads",
+ "quad_strip",
+ "polygon",
+ "lines_adjacency",
+ "line_strip_adjacency",
+ "triangles_adjacency",
+ "triangle_strip_adjacency",
+ "patches",
+};
+
+DEFINE_UTIL_STR_CONTINUOUS(prim_mode)
+
+void
+util_dump_query_type(FILE *stream, unsigned value)
+{
+ if (value >= PIPE_QUERY_DRIVER_SPECIFIC)
+ fprintf(stream, "PIPE_QUERY_DRIVER_SPECIFIC + %i",
+ value - PIPE_QUERY_DRIVER_SPECIFIC);
+ else
+ fprintf(stream, "%s", util_str_query_type(value, false));
+}
+
+void
+util_dump_query_value_type(FILE *stream, unsigned value)
+{
+ fprintf(stream, "%s", util_str_query_value_type(value, false));
+}