aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNicolai Hähnle <[email protected]>2017-10-22 17:39:00 +0200
committerNicolai Hähnle <[email protected]>2017-11-09 14:01:03 +0100
commitba2f2b6f2aa05dab01389cf27a5001d0d43adcb4 (patch)
tree2fe2e610514ea064c35b8d7cd1c3d3759ea8281d /src
parentc9fefa062b369056eb4c3ef82b529b0acc4cc88a (diff)
ddebug: generalize print_named_xxx via a PRINT_NAMED macro
Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/ddebug/dd_draw.c25
1 files changed, 10 insertions, 15 deletions
diff --git a/src/gallium/drivers/ddebug/dd_draw.c b/src/gallium/drivers/ddebug/dd_draw.c
index 99c9c929b2e..a856d0142a1 100644
--- a/src/gallium/drivers/ddebug/dd_draw.c
+++ b/src/gallium/drivers/ddebug/dd_draw.c
@@ -134,17 +134,12 @@ dd_num_active_viewports(struct dd_draw_state *dstate)
fprintf(f, "\n"); \
} while(0)
-static void
-print_named_value(FILE *f, const char *name, int value)
-{
- fprintf(f, COLOR_STATE "%s" COLOR_RESET " = %i\n", name, value);
-}
-
-static void
-print_named_xvalue(FILE *f, const char *name, int value)
-{
- fprintf(f, COLOR_STATE "%s" COLOR_RESET " = 0x%08x\n", name, value);
-}
+#define PRINT_NAMED(type, name, value) \
+do { \
+ fprintf(f, COLOR_STATE "%s" COLOR_RESET " = ", name); \
+ util_dump_##type(f, value); \
+ fprintf(f, "\n"); \
+} while (0)
static void
util_dump_uint(FILE *f, unsigned i)
@@ -312,7 +307,7 @@ dd_dump_draw_vbo(struct dd_draw_state *dstate, struct pipe_draw_info *info, FILE
}
if (dstate->velems) {
- print_named_value(f, "num vertex elements",
+ PRINT_NAMED(uint, "num vertex elements",
dstate->velems->state.velems.count);
for (i = 0; i < dstate->velems->state.velems.count; i++) {
fprintf(f, " ");
@@ -320,7 +315,7 @@ dd_dump_draw_vbo(struct dd_draw_state *dstate, struct pipe_draw_info *info, FILE
}
}
- print_named_value(f, "num stream output targets", dstate->num_so_targets);
+ PRINT_NAMED(uint, "num stream output targets", dstate->num_so_targets);
for (i = 0; i < dstate->num_so_targets; i++)
if (dstate->so_targets[i]) {
DUMP_I(stream_output_target, dstate->so_targets[i], i);
@@ -344,8 +339,8 @@ dd_dump_draw_vbo(struct dd_draw_state *dstate, struct pipe_draw_info *info, FILE
DUMP(blend_state, &dstate->blend->state.blend);
DUMP(blend_color, &dstate->blend_color);
- print_named_value(f, "min_samples", dstate->min_samples);
- print_named_xvalue(f, "sample_mask", dstate->sample_mask);
+ PRINT_NAMED(uint, "min_samples", dstate->min_samples);
+ PRINT_NAMED(hex, "sample_mask", dstate->sample_mask);
fprintf(f, "\n");
DUMP(framebuffer_state, &dstate->framebuffer_state);