diff options
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/auxiliary/tgsi/util/tgsi_parse.c | 13 | ||||
-rw-r--r-- | src/gallium/auxiliary/tgsi/util/tgsi_parse.h | 4 |
2 files changed, 17 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/tgsi/util/tgsi_parse.c b/src/gallium/auxiliary/tgsi/util/tgsi_parse.c index bf6b89ce56..c3526cb71f 100644 --- a/src/gallium/auxiliary/tgsi/util/tgsi_parse.c +++ b/src/gallium/auxiliary/tgsi/util/tgsi_parse.c @@ -317,3 +317,16 @@ 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 + + 1); + return len; + } + return 0; +} diff --git a/src/gallium/auxiliary/tgsi/util/tgsi_parse.h b/src/gallium/auxiliary/tgsi/util/tgsi_parse.h index 40083728d6..a98e88e343 100644 --- a/src/gallium/auxiliary/tgsi/util/tgsi_parse.h +++ b/src/gallium/auxiliary/tgsi/util/tgsi_parse.h @@ -113,6 +113,10 @@ void tgsi_parse_token( struct tgsi_parse_context *ctx ); +unsigned +tgsi_num_tokens(const struct tgsi_token *tokens); + + #if defined __cplusplus } #endif |