summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/trace/tr_dump.c
diff options
context:
space:
mode:
authorJosé Fonseca <[email protected]>2008-08-08 23:53:53 +0100
committerJosé Fonseca <[email protected]>2008-08-09 14:10:25 +0100
commitb65259de6c0a2e77550bbef6b291c6d09dfb5867 (patch)
tree747fdb6eda554079bee20140a11bb25e663c38d9 /src/gallium/drivers/trace/tr_dump.c
parent6c7aff209ca3b310008dd345836ebc020d2db004 (diff)
trace: Allow to dump binary data.
Diffstat (limited to 'src/gallium/drivers/trace/tr_dump.c')
-rw-r--r--src/gallium/drivers/trace/tr_dump.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/gallium/drivers/trace/tr_dump.c b/src/gallium/drivers/trace/tr_dump.c
index 359a903ab91..f545de30f4f 100644
--- a/src/gallium/drivers/trace/tr_dump.c
+++ b/src/gallium/drivers/trace/tr_dump.c
@@ -272,6 +272,25 @@ void trace_dump_float(struct trace_stream *stream,
trace_dump_writef(stream, "<float>%g</float>", value);
}
+void trace_dump_bytes(struct trace_stream *stream,
+ const void *data,
+ long unsigned size)
+{
+ static char hex_table[] = "0123456789ABCDE";
+ const uint8_t *p = data;
+ long unsigned i;
+ trace_dump_write(stream, "<bytes>");
+ for(i = 0; i < size; ++i) {
+ uint8_t byte = *p++;
+ char str[3];
+ str[0] = hex_table[byte >> 4];
+ str[1] = hex_table[byte & 0xf];
+ str[2] = 0;
+ trace_dump_write(stream, str);
+ }
+ trace_dump_write(stream, "</bytes>");
+}
+
void trace_dump_string(struct trace_stream *stream,
const char *str)
{