summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary/tgsi/tgsi_ureg.c
diff options
context:
space:
mode:
authorJosé Fonseca <jfonseca@vmware.com>2009-08-24 11:40:29 +0100
committerKeith Whitwell <keithw@vmware.com>2009-08-24 12:11:22 +0100
commitacc7da90356a96efb93bb3a6a53e0b5f67ce993a (patch)
tree645f86ef8865ab27b27621da263818ade8dd0ce5 /src/gallium/auxiliary/tgsi/tgsi_ureg.c
parentb570a7e6b6ebd05e94fd91f2df53de7d2e2e05d2 (diff)
tgsi: Pass pipe_context as a parameter to ureg_create_shader.
Simplifies migration to tgsi_ureg. (cherry picked from commit f574398c07c41cb8d31249a7186fc178ef7d552a)
Diffstat (limited to 'src/gallium/auxiliary/tgsi/tgsi_ureg.c')
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_ureg.c29
1 files changed, 20 insertions, 9 deletions
diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c b/src/gallium/auxiliary/tgsi/tgsi_ureg.c
index 7762243ef8..63ae267766 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c
@@ -788,9 +788,9 @@ emit_header( struct ureg_program *ureg )
}
-void *ureg_create_shader( struct ureg_program *ureg )
+const struct tgsi_token *ureg_finalize( struct ureg_program *ureg )
{
- struct pipe_shader_state state;
+ const struct tgsi_token *tokens;
emit_header( ureg );
emit_decls( ureg );
@@ -804,31 +804,42 @@ void *ureg_create_shader( struct ureg_program *ureg )
return NULL;
}
- state.tokens = (const struct tgsi_token *)ureg->domain[DOMAIN_DECL].tokens;
+ tokens = &ureg->domain[DOMAIN_DECL].tokens[0].token;
if (0) {
debug_printf("%s: emitted shader %d tokens:\n", __FUNCTION__,
ureg->domain[DOMAIN_DECL].count);
- tgsi_dump( state.tokens, 0 );
+ tgsi_dump( tokens, 0 );
}
+
+ return tokens;
+}
+
+
+void *ureg_create_shader( struct ureg_program *ureg,
+ struct pipe_context *pipe )
+{
+ struct pipe_shader_state state;
+
+ state.tokens = ureg_finalize(ureg);
+ if(!state.tokens)
+ return NULL;
if (ureg->processor == TGSI_PROCESSOR_VERTEX)
- return ureg->pipe->create_vs_state( ureg->pipe, &state );
+ return pipe->create_vs_state( pipe, &state );
else
- return ureg->pipe->create_fs_state( ureg->pipe, &state );
+ return pipe->create_fs_state( pipe, &state );
}
-struct ureg_program *ureg_create( struct pipe_context *pipe,
- unsigned processor )
+struct ureg_program *ureg_create( unsigned processor )
{
struct ureg_program *ureg = CALLOC_STRUCT( ureg_program );
if (ureg == NULL)
return NULL;
- ureg->pipe = pipe;
ureg->processor = processor;
return ureg;
}