aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/tgsi/tgsi_parse.c
diff options
context:
space:
mode:
authorKeith Whitwell <[email protected]>2010-08-20 14:51:57 +0100
committerKeith Whitwell <[email protected]>2010-08-25 10:29:26 +0100
commit285ea417ef5ee1027d1e8dd03b069cb157105bf7 (patch)
treea6e452c128ba637b60b846c401a1e949512a3dda /src/gallium/auxiliary/tgsi/tgsi_parse.c
parent6c0dc4bafbdbdc0cb4b6e5934fe064226dbd47ec (diff)
tgsi: helper for dumping tokens as hex
Diffstat (limited to 'src/gallium/auxiliary/tgsi/tgsi_parse.c')
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_parse.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/src/gallium/auxiliary/tgsi/tgsi_parse.c b/src/gallium/auxiliary/tgsi/tgsi_parse.c
index db9a3422203..1891203abe1 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_parse.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_parse.c
@@ -282,17 +282,6 @@ tgsi_parse_token(
}
-unsigned
-tgsi_num_tokens(const struct tgsi_token *tokens)
-{
- struct tgsi_parse_context ctx;
- if (tgsi_parse_init(&ctx, tokens) == TGSI_PARSE_OK) {
- unsigned len = (ctx.FullHeader.Header.HeaderSize +
- ctx.FullHeader.Header.BodySize);
- return len;
- }
- return 0;
-}
/**
@@ -319,3 +308,19 @@ tgsi_alloc_tokens(unsigned num_tokens)
unsigned bytes = num_tokens * sizeof(struct tgsi_token);
return (struct tgsi_token *) MALLOC(bytes);
}
+
+
+void
+tgsi_dump_tokens(const struct tgsi_token *tokens)
+{
+ const unsigned *dwords = (const unsigned *)tokens;
+ int nr = tgsi_num_tokens(tokens);
+ int i;
+
+ assert(sizeof(*tokens) == sizeof(unsigned));
+
+ debug_printf("const unsigned tokens[%d] = {\n", nr);
+ for (i = 0; i < nr; i++)
+ debug_printf("0x%08x,\n", dwords[i]);
+ debug_printf("};\n");
+}