-void
-softpipe_set_stream_output_buffers(struct pipe_context *pipe,
- struct pipe_resource **buffers,
- int *offsets,
- int num_buffers)
-{
- struct softpipe_context *softpipe = softpipe_context(pipe);
- int i;
- void *map_buffers[PIPE_MAX_SO_BUFFERS];
-
- assert(num_buffers <= PIPE_MAX_SO_BUFFERS);
- if (num_buffers > PIPE_MAX_SO_BUFFERS)
- num_buffers = PIPE_MAX_SO_BUFFERS;
-
- softpipe->dirty |= SP_NEW_SO_BUFFERS;
-
- for (i = 0; i < num_buffers; ++i) {
- void *mapped;
- struct softpipe_resource *res = softpipe_resource(buffers[i]);
-
- if (!res) {
- /* the whole call is invalid, bail out */
- softpipe->so_target.num_buffers = 0;
- draw_set_mapped_so_buffers(softpipe->draw, 0, 0);
- return;
- }
-
- softpipe->so_target.buffer[i] = res;
- softpipe->so_target.offset[i] = offsets[i];
- softpipe->so_target.so_count[i] = 0;
-
- mapped = res->data;
- if (offsets[i] >= 0)
- map_buffers[i] = ((char*)mapped) + offsets[i];
- else {
- /* this is a buffer append */
- assert(!"appending not implemented");
- map_buffers[i] = mapped;
- }
- }
- softpipe->so_target.num_buffers = num_buffers;
-
- draw_set_mapped_so_buffers(softpipe->draw, map_buffers, num_buffers);
-}