diff options
author | Marek Olšák <[email protected]> | 2011-12-09 18:12:55 +0100 |
---|---|---|
committer | Christoph Bumiller <[email protected]> | 2011-12-15 18:51:48 +0100 |
commit | 8a9a37cebeff19b56afed43ae037d00950fa7594 (patch) | |
tree | 8831c98c9650d89a7bf18f89c90b55f51f164cce /src/gallium/auxiliary/tgsi | |
parent | 861a029ddb31e91bb4d8e18ab708d0d172f63aad (diff) |
gallium: utility helper functions for stream output
Diffstat (limited to 'src/gallium/auxiliary/tgsi')
-rw-r--r-- | src/gallium/auxiliary/tgsi/tgsi_ureg.c | 9 | ||||
-rw-r--r-- | src/gallium/auxiliary/tgsi/tgsi_ureg.h | 18 |
2 files changed, 21 insertions, 6 deletions
diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c b/src/gallium/auxiliary/tgsi/tgsi_ureg.c index 33d285cb64c..17f9ce25227 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c @@ -1590,14 +1590,19 @@ const struct tgsi_token *ureg_finalize( struct ureg_program *ureg ) void *ureg_create_shader( struct ureg_program *ureg, - struct pipe_context *pipe ) + struct pipe_context *pipe, + const struct pipe_stream_output_info *so ) { struct pipe_shader_state state; state.tokens = ureg_finalize(ureg); if(!state.tokens) return NULL; - memset(&state.stream_output, 0, sizeof(state.stream_output)); + + if (so) + state.stream_output = *so; + else + memset(&state.stream_output, 0, sizeof(state.stream_output)); if (ureg->processor == TGSI_PROCESSOR_VERTEX) return pipe->create_vs_state( pipe, &state ); diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.h b/src/gallium/auxiliary/tgsi/tgsi_ureg.h index a70d30f873f..bf55d54e543 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.h +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.h @@ -37,6 +37,7 @@ extern "C" { #endif struct ureg_program; +struct pipe_stream_output_info; /* Almost a tgsi_src_register, but we need to pull in the Absolute * flag from the _ext token. Indirect flag always implies ADDR[0]. @@ -97,7 +98,8 @@ ureg_finalize( struct ureg_program * ); */ void * ureg_create_shader( struct ureg_program *, - struct pipe_context *pipe ); + struct pipe_context *pipe, + const struct pipe_stream_output_info *so ); /* Alternately, return the built token stream and hand ownership of @@ -120,14 +122,22 @@ ureg_destroy( struct ureg_program * ); * Convenience routine: */ static INLINE void * -ureg_create_shader_and_destroy( struct ureg_program *p, - struct pipe_context *pipe ) +ureg_create_shader_with_so_and_destroy( struct ureg_program *p, + struct pipe_context *pipe, + const struct pipe_stream_output_info *so ) { - void *result = ureg_create_shader( p, pipe ); + void *result = ureg_create_shader( p, pipe, so ); ureg_destroy( p ); return result; } +static INLINE void * +ureg_create_shader_and_destroy( struct ureg_program *p, + struct pipe_context *pipe ) +{ + return ureg_create_shader_with_so_and_destroy(p, pipe, NULL); +} + /*********************************************************************** * Build shader properties: |