From 90d10f467f896a72f50de5ee22d8cb36cdb50ad6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Sun, 17 Aug 2014 01:33:46 +0200 Subject: [PATCH] rbug: implement streamout context functions Reviewed-by: Roland Scheidegger --- src/gallium/drivers/rbug/rbug_context.c | 46 +++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/src/gallium/drivers/rbug/rbug_context.c b/src/gallium/drivers/rbug/rbug_context.c index d6fca2e4af6..71bc2168614 100644 --- a/src/gallium/drivers/rbug/rbug_context.c +++ b/src/gallium/drivers/rbug/rbug_context.c @@ -803,6 +803,49 @@ rbug_set_sample_mask(struct pipe_context *_pipe, pipe_mutex_unlock(rb_pipe->call_mutex); } +static struct pipe_stream_output_target * +rbug_create_stream_output_target(struct pipe_context *_pipe, + struct pipe_resource *_res, + unsigned buffer_offset, unsigned buffer_size) +{ + struct rbug_context *rb_pipe = rbug_context(_pipe); + struct pipe_context *pipe = rb_pipe->pipe; + struct pipe_resource *res = rbug_resource_unwrap(_res); + struct pipe_stream_output_target *target; + + pipe_mutex_lock(rb_pipe->call_mutex); + target = pipe->create_stream_output_target(pipe, res, buffer_offset, + buffer_size); + pipe_mutex_unlock(rb_pipe->call_mutex); + return target; +} + +static void +rbug_stream_output_target_destroy(struct pipe_context *_pipe, + struct pipe_stream_output_target *target) +{ + struct rbug_context *rb_pipe = rbug_context(_pipe); + struct pipe_context *pipe = rb_pipe->pipe; + + pipe_mutex_lock(rb_pipe->call_mutex); + pipe->stream_output_target_destroy(pipe, target); + pipe_mutex_unlock(rb_pipe->call_mutex); +} + +static void +rbug_set_stream_output_targets(struct pipe_context *_pipe, + unsigned num_targets, + struct pipe_stream_output_target **targets, + const unsigned *offsets) +{ + struct rbug_context *rb_pipe = rbug_context(_pipe); + struct pipe_context *pipe = rb_pipe->pipe; + + pipe_mutex_lock(rb_pipe->call_mutex); + pipe->set_stream_output_targets(pipe, num_targets, targets, offsets); + pipe_mutex_unlock(rb_pipe->call_mutex); +} + static void rbug_resource_copy_region(struct pipe_context *_pipe, struct pipe_resource *_dst, @@ -1174,6 +1217,9 @@ rbug_context_create(struct pipe_screen *_screen, struct pipe_context *pipe) rb_pipe->base.set_vertex_buffers = rbug_set_vertex_buffers; rb_pipe->base.set_index_buffer = rbug_set_index_buffer; rb_pipe->base.set_sample_mask = rbug_set_sample_mask; + rb_pipe->base.create_stream_output_target = rbug_create_stream_output_target; + rb_pipe->base.stream_output_target_destroy = rbug_stream_output_target_destroy; + rb_pipe->base.set_stream_output_targets = rbug_set_stream_output_targets; rb_pipe->base.resource_copy_region = rbug_resource_copy_region; rb_pipe->base.blit = rbug_blit; rb_pipe->base.flush_resource = rbug_flush_resource; -- 2.30.2