softpipe: use any_swizzle() helper in sp_tex_sample.c
[mesa.git] / src / gallium / drivers / softpipe / sp_draw_arrays.c
index 69b5b96b4fd0b6268292ad23c094349cc36218b5..27004071f026afdf5d706141380d797e28ca22aa 100644 (file)
 
 #include "draw/draw_context.h"
 
-
-
-
-
-void
-softpipe_draw_stream_output(struct pipe_context *pipe, unsigned mode)
-{
-   struct softpipe_context *sp = softpipe_context(pipe);
-   struct draw_context *draw = sp->draw;
-   const unsigned start = 0;
-   const unsigned count = sp->so_target.so_count[0];
-   void *buf = sp->so_target.buffer[0]->data;
-   int offset = sp->so_target.offset[0];
-
-   if (!softpipe_check_render_cond(sp) ||
-       sp->so_target.num_buffers != 1)
-      return;
-
-   sp->reduced_api_prim = u_reduced_prim(mode);
-
-   if (sp->dirty) {
-      softpipe_update_derived(sp, sp->reduced_api_prim);
-   }
-
-   softpipe_map_transfers(sp);
-
-   /* Map so buffers */
-   if (offset < 0) /* we were appending so start from beginning */
-      offset = 0;
-   buf = (void*)((int32_t*)buf + offset);
-   draw_set_mapped_vertex_buffer(draw, 0, buf);
-
-   draw_set_mapped_index_buffer(draw, NULL);
-
-   /* draw! */
-   draw_arrays(draw, mode, start, count);
-
-   /* unmap vertex/index buffers - will cause draw module to flush */
-   draw_set_mapped_vertex_buffer(draw, 0, NULL);
-
-   /*
-    * TODO: Flush only when a user vertex/index buffer is present
-    * (or even better, modify draw module to do this
-    * internally when this condition is seen?)
-    */
-   draw_flush(draw);
-
-   /* Note: leave drawing surfaces mapped */
-   sp->dirty_render_cache = TRUE;
-}
-
-
 /**
  * This function handles drawing indexed and non-indexed prims,
  * instanced and non-instanced drawing, with or without min/max element
@@ -139,6 +87,14 @@ softpipe_draw_vbo(struct pipe_context *pipe,
 
    draw_set_mapped_index_buffer(draw, mapped_indices);
 
+   for (i = 0; i < sp->num_so_targets; i++) {
+      void *buf = softpipe_resource(sp->so_targets[i]->target.buffer)->data;
+      sp->so_targets[i]->mapping = buf;
+   }
+
+   draw_set_mapped_so_targets(draw, sp->num_so_targets,
+                              sp->so_targets);
+
    /* draw! */
    draw_vbo(draw, info);
 
@@ -150,6 +106,8 @@ softpipe_draw_vbo(struct pipe_context *pipe,
       draw_set_mapped_index_buffer(draw, NULL);
    }
 
+   draw_set_mapped_so_targets(draw, 0, NULL);
+
    /*
     * TODO: Flush only when a user vertex/index buffer is present
     * (or even better, modify draw module to do this