rbug: implement streamout context functions
authorMarek Olšák <marek.olsak@amd.com>
Sat, 16 Aug 2014 23:33:46 +0000 (01:33 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Tue, 19 Aug 2014 10:20:18 +0000 (12:20 +0200)
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
src/gallium/drivers/rbug/rbug_context.c

index d6fca2e..71bc216 100644 (file)
@@ -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;