From 11f41f54cf4ce1cdc19c4b5c45ed8d2083d96831 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Sat, 12 Sep 2009 14:18:50 -0700 Subject: ureg: add a mechanism to get the built tokens rather than a full shader Previously ureg would always call the driver's create-shader function. This allows the caller the opportunity to hold onto the tokens if it needs to reuse them, eg. to create an internal draw shader. --- src/gallium/auxiliary/tgsi/tgsi_ureg.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/gallium/auxiliary/tgsi/tgsi_ureg.c') diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c b/src/gallium/auxiliary/tgsi/tgsi_ureg.c index 352cb5a1e3..9e2e7f0d19 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c @@ -978,6 +978,25 @@ void *ureg_create_shader( struct ureg_program *ureg, } +const struct tgsi_token *ureg_get_tokens( struct ureg_program *ureg, + unsigned *nr_tokens ) +{ + const struct tgsi_token *tokens; + + ureg_finalize(ureg); + + tokens = &ureg->domain[DOMAIN_DECL].tokens[0].token; + + if (nr_tokens) + *nr_tokens = ureg->domain[DOMAIN_DECL].size; + + ureg->domain[DOMAIN_DECL].tokens = 0; + ureg->domain[DOMAIN_DECL].size = 0; + ureg->domain[DOMAIN_DECL].order = 0; + ureg->domain[DOMAIN_DECL].count = 0; + + return tokens; +} struct ureg_program *ureg_create( unsigned processor ) -- cgit v1.2.3