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/util | |
parent | 861a029ddb31e91bb4d8e18ab708d0d172f63aad (diff) |
gallium: utility helper functions for stream output
Diffstat (limited to 'src/gallium/auxiliary/util')
-rw-r--r-- | src/gallium/auxiliary/util/u_debug_describe.c | 10 | ||||
-rw-r--r-- | src/gallium/auxiliary/util/u_debug_describe.h | 2 | ||||
-rw-r--r-- | src/gallium/auxiliary/util/u_inlines.h | 12 | ||||
-rw-r--r-- | src/gallium/auxiliary/util/u_simple_shaders.c | 14 | ||||
-rw-r--r-- | src/gallium/auxiliary/util/u_simple_shaders.h | 8 |
5 files changed, 45 insertions, 1 deletions
diff --git a/src/gallium/auxiliary/util/u_debug_describe.c b/src/gallium/auxiliary/util/u_debug_describe.c index 3574accc004..df73ed83ef6 100644 --- a/src/gallium/auxiliary/util/u_debug_describe.c +++ b/src/gallium/auxiliary/util/u_debug_describe.c @@ -79,3 +79,13 @@ debug_describe_sampler_view(char* buf, const struct pipe_sampler_view *ptr) debug_describe_resource(res, ptr->texture); util_sprintf(buf, "pipe_sampler_view<%s,%s>", res, util_format_short_name(ptr->format)); } + +void +debug_describe_so_target(char* buf, + const struct pipe_stream_output_target *ptr) +{ + char res[128]; + debug_describe_resource(res, ptr->buffer); + util_sprintf(buf, "pipe_stream_output_target<%s,%u,%u>", res, + ptr->buffer_offset, ptr->buffer_size); +} diff --git a/src/gallium/auxiliary/util/u_debug_describe.h b/src/gallium/auxiliary/util/u_debug_describe.h index 26d1f803bf0..4f7882b0b37 100644 --- a/src/gallium/auxiliary/util/u_debug_describe.h +++ b/src/gallium/auxiliary/util/u_debug_describe.h @@ -41,6 +41,8 @@ void debug_describe_reference(char* buf, const struct pipe_reference*ptr); void debug_describe_resource(char* buf, const struct pipe_resource *ptr); void debug_describe_surface(char* buf, const struct pipe_surface *ptr); void debug_describe_sampler_view(char* buf, const struct pipe_sampler_view *ptr); +void debug_describe_so_target(char* buf, + const struct pipe_stream_output_target *ptr); #ifdef __cplusplus } diff --git a/src/gallium/auxiliary/util/u_inlines.h b/src/gallium/auxiliary/util/u_inlines.h index ddb81b5b957..44283909aec 100644 --- a/src/gallium/auxiliary/util/u_inlines.h +++ b/src/gallium/auxiliary/util/u_inlines.h @@ -136,6 +136,18 @@ pipe_sampler_view_reference(struct pipe_sampler_view **ptr, struct pipe_sampler_ } static INLINE void +pipe_so_target_reference(struct pipe_stream_output_target **ptr, + struct pipe_stream_output_target *target) +{ + struct pipe_stream_output_target *old = *ptr; + + if (pipe_reference_described(&(*ptr)->reference, &target->reference, + (debug_reference_descriptor)debug_describe_so_target)) + old->context->stream_output_target_destroy(old->context, old); + *ptr = target; +} + +static INLINE void pipe_surface_reset(struct pipe_context *ctx, struct pipe_surface* ps, struct pipe_resource *pt, unsigned level, unsigned layer, unsigned flags) diff --git a/src/gallium/auxiliary/util/u_simple_shaders.c b/src/gallium/auxiliary/util/u_simple_shaders.c index b0f2dd8aa29..320c0f7a830 100644 --- a/src/gallium/auxiliary/util/u_simple_shaders.c +++ b/src/gallium/auxiliary/util/u_simple_shaders.c @@ -56,6 +56,18 @@ util_make_vertex_passthrough_shader(struct pipe_context *pipe, const uint *semantic_names, const uint *semantic_indexes) { + return util_make_vertex_passthrough_shader_with_so(pipe, num_attribs, + semantic_names, + semantic_indexes, NULL); +} + +void * +util_make_vertex_passthrough_shader_with_so(struct pipe_context *pipe, + uint num_attribs, + const uint *semantic_names, + const uint *semantic_indexes, + const struct pipe_stream_output_info *so) +{ struct ureg_program *ureg; uint i; @@ -78,7 +90,7 @@ util_make_vertex_passthrough_shader(struct pipe_context *pipe, ureg_END( ureg ); - return ureg_create_shader_and_destroy( ureg, pipe ); + return ureg_create_shader_with_so_and_destroy( ureg, pipe, so ); } diff --git a/src/gallium/auxiliary/util/u_simple_shaders.h b/src/gallium/auxiliary/util/u_simple_shaders.h index 1bfec183e34..5f31b72c4d7 100644 --- a/src/gallium/auxiliary/util/u_simple_shaders.h +++ b/src/gallium/auxiliary/util/u_simple_shaders.h @@ -35,6 +35,7 @@ struct pipe_context; struct pipe_shader_state; +struct pipe_stream_output_info; #ifdef __cplusplus @@ -48,6 +49,13 @@ util_make_vertex_passthrough_shader(struct pipe_context *pipe, const uint *semantic_names, const uint *semantic_indexes); +extern void * +util_make_vertex_passthrough_shader_with_so(struct pipe_context *pipe, + uint num_attribs, + const uint *semantic_names, + const uint *semantic_indexes, + const struct pipe_stream_output_info *so); + extern void * util_make_fragment_tex_shader_writemask(struct pipe_context *pipe, |