diff options
author | Nicolai Hähnle <[email protected]> | 2017-07-27 11:40:25 +0200 |
---|---|---|
committer | Nicolai Hähnle <[email protected]> | 2017-08-02 09:46:24 +0200 |
commit | 16923e42a419048b61b72f8fdae2aed32cf1212a (patch) | |
tree | ef99ab2dd714d518afe9db2b48ed7b673d5ccd90 /src/gallium/auxiliary/util | |
parent | a677799e51a8d3651a8c963dac0a09ff0b282d63 (diff) |
gallium: rename util_dump_* to util_str_* for enum-to-string conversion
This is mostly mechanical search-and-replace, plus touching up the
macros in u_dump_defines.c manually a bit.
Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/util')
-rw-r--r-- | src/gallium/auxiliary/util/u_dump.h | 26 | ||||
-rw-r--r-- | src/gallium/auxiliary/util/u_dump_defines.c | 88 | ||||
-rw-r--r-- | src/gallium/auxiliary/util/u_dump_state.c | 18 |
3 files changed, 64 insertions, 68 deletions
diff --git a/src/gallium/auxiliary/util/u_dump.h b/src/gallium/auxiliary/util/u_dump.h index 408c270040f..de7a451f77d 100644 --- a/src/gallium/auxiliary/util/u_dump.h +++ b/src/gallium/auxiliary/util/u_dump.h @@ -52,44 +52,40 @@ extern "C" { /* * p_defines.h - * - * XXX: These functions don't really dump anything -- just translate into - * strings so a verb better than "dump" should be used instead, in order to - * free up the namespace to the true dumper functions. */ const char * -util_dump_blend_factor(unsigned value, boolean shortened); +util_str_blend_factor(unsigned value, boolean shortened); const char * -util_dump_blend_func(unsigned value, boolean shortened); +util_str_blend_func(unsigned value, boolean shortened); const char * -util_dump_logicop(unsigned value, boolean shortened); +util_str_logicop(unsigned value, boolean shortened); const char * -util_dump_func(unsigned value, boolean shortened); +util_str_func(unsigned value, boolean shortened); const char * -util_dump_stencil_op(unsigned value, boolean shortened); +util_str_stencil_op(unsigned value, boolean shortened); const char * -util_dump_tex_target(unsigned value, boolean shortened); +util_str_tex_target(unsigned value, boolean shortened); const char * -util_dump_tex_wrap(unsigned value, boolean shortened); +util_str_tex_wrap(unsigned value, boolean shortened); const char * -util_dump_tex_mipfilter(unsigned value, boolean shortened); +util_str_tex_mipfilter(unsigned value, boolean shortened); const char * -util_dump_tex_filter(unsigned value, boolean shortened); +util_str_tex_filter(unsigned value, boolean shortened); const char * -util_dump_query_type(unsigned value, boolean shortened); +util_str_query_type(unsigned value, boolean shortened); const char * -util_dump_prim_mode(unsigned value, boolean shortened); +util_str_prim_mode(unsigned value, boolean shortened); /* diff --git a/src/gallium/auxiliary/util/u_dump_defines.c b/src/gallium/auxiliary/util/u_dump_defines.c index 9126febbd54..098458afb90 100644 --- a/src/gallium/auxiliary/util/u_dump_defines.c +++ b/src/gallium/auxiliary/util/u_dump_defines.c @@ -62,36 +62,36 @@ util_dump_enum_continuous(unsigned value, } -#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, ARRAY_SIZE(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, ARRAY_SIZE(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_DUMP_CONTINUOUS but with static assertions to detect + * Same as DEFINE_UTIL_STR_CONTINUOUS but with static assertions to detect * failures to update lists. */ -#define DEFINE_UTIL_DUMP_CONTINUOUS_COUNT(_name, _count) \ +#define DEFINE_UTIL_STR_CONTINUOUS_COUNT(_name, _count) \ const char * \ - util_dump_##_name(unsigned value, boolean shortened) \ + util_str_##_name(unsigned value, boolean shortened) \ { \ - STATIC_ASSERT(ARRAY_SIZE(util_dump_##_name##_names) == _count); \ - STATIC_ASSERT(ARRAY_SIZE(util_dump_##_name##_short_names) == _count); \ + 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_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, ARRAY_SIZE(util_dump_##_name##_names), util_dump_##_name##_names); \ + 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", @@ -122,7 +122,7 @@ util_dump_blend_factor_names[] = { }; static const char * -util_dump_blend_factor_short_names[] = { +util_blend_factor_short_names[] = { UTIL_DUMP_INVALID_NAME, /* 0x0 */ "one", "src_color", @@ -152,11 +152,11 @@ util_dump_blend_factor_short_names[] = { "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", @@ -165,7 +165,7 @@ util_dump_blend_func_names[] = { }; static const char * -util_dump_blend_func_short_names[] = { +util_blend_func_short_names[] = { "add", "sub", "rev_sub", @@ -173,11 +173,11 @@ util_dump_blend_func_short_names[] = { "max" }; -DEFINE_UTIL_DUMP_CONTINUOUS(blend_func) +DEFINE_UTIL_STR_CONTINUOUS(blend_func) static const char * -util_dump_logicop_names[] = { +util_logicop_names[] = { "PIPE_LOGICOP_CLEAR", "PIPE_LOGICOP_NOR", "PIPE_LOGICOP_AND_INVERTED", @@ -197,7 +197,7 @@ util_dump_logicop_names[] = { }; static const char * -util_dump_logicop_short_names[] = { +util_logicop_short_names[] = { "clear", "nor", "and_inverted", @@ -216,11 +216,11 @@ util_dump_logicop_short_names[] = { "set" }; -DEFINE_UTIL_DUMP_CONTINUOUS(logicop) +DEFINE_UTIL_STR_CONTINUOUS(logicop) static const char * -util_dump_func_names[] = { +util_func_names[] = { "PIPE_FUNC_NEVER", "PIPE_FUNC_LESS", "PIPE_FUNC_EQUAL", @@ -232,7 +232,7 @@ util_dump_func_names[] = { }; static const char * -util_dump_func_short_names[] = { +util_func_short_names[] = { "never", "less", "equal", @@ -243,11 +243,11 @@ util_dump_func_short_names[] = { "always" }; -DEFINE_UTIL_DUMP_CONTINUOUS(func) +DEFINE_UTIL_STR_CONTINUOUS(func) static const char * -util_dump_stencil_op_names[] = { +util_stencil_op_names[] = { "PIPE_STENCIL_OP_KEEP", "PIPE_STENCIL_OP_ZERO", "PIPE_STENCIL_OP_REPLACE", @@ -259,7 +259,7 @@ util_dump_stencil_op_names[] = { }; static const char * -util_dump_stencil_op_short_names[] = { +util_stencil_op_short_names[] = { "keep", "zero", "replace", @@ -270,11 +270,11 @@ util_dump_stencil_op_short_names[] = { "invert" }; -DEFINE_UTIL_DUMP_CONTINUOUS(stencil_op) +DEFINE_UTIL_STR_CONTINUOUS(stencil_op) static const char * -util_dump_tex_target_names[] = { +util_tex_target_names[] = { "PIPE_BUFFER", "PIPE_TEXTURE_1D", "PIPE_TEXTURE_2D", @@ -287,7 +287,7 @@ util_dump_tex_target_names[] = { }; static const char * -util_dump_tex_target_short_names[] = { +util_tex_target_short_names[] = { "buffer", "1d", "2d", @@ -299,11 +299,11 @@ util_dump_tex_target_short_names[] = { "cube_array", }; -DEFINE_UTIL_DUMP_CONTINUOUS_COUNT(tex_target, PIPE_MAX_TEXTURE_TYPES) +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", @@ -315,7 +315,7 @@ util_dump_tex_wrap_names[] = { }; static const char * -util_dump_tex_wrap_short_names[] = { +util_tex_wrap_short_names[] = { "repeat", "clamp", "clamp_to_edge", @@ -326,43 +326,43 @@ util_dump_tex_wrap_short_names[] = { "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_dump_query_type_names[] = { +util_query_type_names[] = { "PIPE_QUERY_OCCLUSION_COUNTER", "PIPE_QUERY_OCCLUSION_PREDICATE", "PIPE_QUERY_TIMESTAMP", @@ -378,7 +378,7 @@ util_dump_query_type_names[] = { }; static const char * -util_dump_query_type_short_names[] = { +util_query_type_short_names[] = { "occlusion_counter", "occlusion_predicate", "timestamp", @@ -392,11 +392,11 @@ util_dump_query_type_short_names[] = { "pipeline_statistics", }; -DEFINE_UTIL_DUMP_CONTINUOUS(query_type) +DEFINE_UTIL_STR_CONTINUOUS(query_type) static const char * -util_dump_prim_mode_names[] = { +util_prim_mode_names[] = { "PIPE_PRIM_POINTS", "PIPE_PRIM_LINES", "PIPE_PRIM_LINE_LOOP", @@ -415,7 +415,7 @@ util_dump_prim_mode_names[] = { }; static const char * -util_dump_prim_mode_short_names[] = { +util_prim_mode_short_names[] = { "points", "lines", "line_loop", @@ -433,4 +433,4 @@ util_dump_prim_mode_short_names[] = { "patches", }; -DEFINE_UTIL_DUMP_CONTINUOUS(prim_mode) +DEFINE_UTIL_STR_CONTINUOUS(prim_mode) diff --git a/src/gallium/auxiliary/util/u_dump_state.c b/src/gallium/auxiliary/util/u_dump_state.c index c62229a5fe1..70bbf5c9fad 100644 --- a/src/gallium/auxiliary/util/u_dump_state.c +++ b/src/gallium/auxiliary/util/u_dump_state.c @@ -232,55 +232,55 @@ util_dump_format(FILE *stream, enum pipe_format format) static void util_dump_enum_blend_factor(FILE *stream, unsigned value) { - util_dump_enum(stream, util_dump_blend_factor(value, TRUE)); + util_dump_enum(stream, util_str_blend_factor(value, TRUE)); } static void util_dump_enum_blend_func(FILE *stream, unsigned value) { - util_dump_enum(stream, util_dump_blend_func(value, TRUE)); + util_dump_enum(stream, util_str_blend_func(value, TRUE)); } static void util_dump_enum_func(FILE *stream, unsigned value) { - util_dump_enum(stream, util_dump_func(value, TRUE)); + util_dump_enum(stream, util_str_func(value, TRUE)); } static void util_dump_enum_prim_mode(FILE *stream, unsigned value) { - util_dump_enum(stream, util_dump_prim_mode(value, TRUE)); + util_dump_enum(stream, util_str_prim_mode(value, TRUE)); } static void util_dump_enum_tex_target(FILE *stream, unsigned value) { - util_dump_enum(stream, util_dump_tex_target(value, TRUE)); + util_dump_enum(stream, util_str_tex_target(value, TRUE)); } static void util_dump_enum_tex_filter(FILE *stream, unsigned value) { - util_dump_enum(stream, util_dump_tex_filter(value, TRUE)); + util_dump_enum(stream, util_str_tex_filter(value, TRUE)); } static void util_dump_enum_tex_mipfilter(FILE *stream, unsigned value) { - util_dump_enum(stream, util_dump_tex_mipfilter(value, TRUE)); + util_dump_enum(stream, util_str_tex_mipfilter(value, TRUE)); } static void util_dump_enum_tex_wrap(FILE *stream, unsigned value) { - util_dump_enum(stream, util_dump_tex_wrap(value, TRUE)); + util_dump_enum(stream, util_str_tex_wrap(value, TRUE)); } static void util_dump_enum_stencil_op(FILE *stream, unsigned value) { - util_dump_enum(stream, util_dump_stencil_op(value, TRUE)); + util_dump_enum(stream, util_str_stencil_op(value, TRUE)); } |