static void rbug_set_vertex_buffers(struct pipe_context *_pipe, unsigned start_slot, unsigned num_buffers, const struct pipe_vertex_buffer *_buffers) { struct rbug_context *rb_pipe = rbug_context(_pipe); struct pipe_context *pipe = rb_pipe->pipe; struct pipe_vertex_buffer unwrapped_buffers[PIPE_MAX_SHADER_INPUTS]; struct pipe_vertex_buffer *buffers = NULL; unsigned i; pipe_mutex_lock(rb_pipe->call_mutex); if (num_buffers) { memcpy(unwrapped_buffers, _buffers, num_buffers * sizeof(*_buffers)); for (i = 0; i < num_buffers; i++) unwrapped_buffers[i].buffer = rbug_resource_unwrap(_buffers[i].buffer); buffers = unwrapped_buffers; } pipe->set_vertex_buffers(pipe, start_slot, num_buffers, buffers); 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_set_index_buffer(struct pipe_context *_pipe, const struct pipe_index_buffer *_ib) { struct rbug_context *rb_pipe = rbug_context(_pipe); struct pipe_context *pipe = rb_pipe->pipe; struct pipe_index_buffer unwrapped_ib, *ib = NULL; if (_ib) { unwrapped_ib = *_ib; unwrapped_ib.buffer = rbug_resource_unwrap(_ib->buffer); ib = &unwrapped_ib; } pipe_mutex_lock(rb_pipe->call_mutex); pipe->set_index_buffer(pipe, ib); pipe_mutex_unlock(rb_pipe->call_mutex); }
static void rbug_set_constant_buffer(struct pipe_context *_pipe, uint shader, uint index, struct pipe_constant_buffer *_cb) { struct rbug_context *rb_pipe = rbug_context(_pipe); struct pipe_context *pipe = rb_pipe->pipe; struct pipe_constant_buffer cb; /* XXX hmm? unwrap the input state */ if (_cb) { cb = *_cb; cb.buffer = rbug_resource_unwrap(_cb->buffer); } pipe_mutex_lock(rb_pipe->call_mutex); pipe->set_constant_buffer(pipe, shader, index, _cb ? &cb : NULL); pipe_mutex_unlock(rb_pipe->call_mutex); }