Merge remote branch 'origin/7.8'
[mesa.git] / src / gallium / drivers / softpipe / sp_draw_arrays.c
index 7b77eb239fd54adaf32ce72fd1698ee977d5b917..b30036e2303d85816ac8c44040ce71b69b26806d 100644 (file)
@@ -39,7 +39,7 @@
 #include "sp_context.h"
 #include "sp_query.h"
 #include "sp_state.h"
-#include "sp_buffer.h"
+#include "sp_texture.h"
 
 #include "draw/draw_context.h"
 
@@ -55,8 +55,9 @@
  */
 static void
 softpipe_draw_range_elements_instanced(struct pipe_context *pipe,
-                                       struct pipe_buffer *indexBuffer,
+                                       struct pipe_resource *indexBuffer,
                                        unsigned indexSize,
+                                       int indexBias,
                                        unsigned minIndex,
                                        unsigned maxIndex,
                                        unsigned mode,
@@ -74,6 +75,7 @@ softpipe_draw_arrays(struct pipe_context *pipe, unsigned mode,
                                           NULL,
                                           0,
                                           0,
+                                          0,
                                           0xffffffff,
                                           mode,
                                           start,
@@ -85,8 +87,9 @@ softpipe_draw_arrays(struct pipe_context *pipe, unsigned mode,
 
 void
 softpipe_draw_range_elements(struct pipe_context *pipe,
-                             struct pipe_buffer *indexBuffer,
+                             struct pipe_resource *indexBuffer,
                              unsigned indexSize,
+                             int indexBias,
                              unsigned min_index,
                              unsigned max_index,
                              unsigned mode, unsigned start, unsigned count)
@@ -94,6 +97,7 @@ softpipe_draw_range_elements(struct pipe_context *pipe,
    softpipe_draw_range_elements_instanced(pipe,
                                           indexBuffer,
                                           indexSize,
+                                          indexBias,
                                           min_index,
                                           max_index,
                                           mode,
@@ -106,13 +110,14 @@ softpipe_draw_range_elements(struct pipe_context *pipe,
 
 void
 softpipe_draw_elements(struct pipe_context *pipe,
-                       struct pipe_buffer *indexBuffer,
-                       unsigned indexSize,
+                       struct pipe_resource *indexBuffer,
+                       unsigned indexSize, int indexBias,
                        unsigned mode, unsigned start, unsigned count)
 {
    softpipe_draw_range_elements_instanced(pipe,
                                           indexBuffer,
                                           indexSize,
+                                          indexBias,
                                           0,
                                           0xffffffff,
                                           mode,
@@ -134,6 +139,7 @@ softpipe_draw_arrays_instanced(struct pipe_context *pipe,
                                           NULL,
                                           0,
                                           0,
+                                          0,
                                           0xffffffff,
                                           mode,
                                           start,
@@ -144,8 +150,9 @@ softpipe_draw_arrays_instanced(struct pipe_context *pipe,
 
 void
 softpipe_draw_elements_instanced(struct pipe_context *pipe,
-                                 struct pipe_buffer *indexBuffer,
+                                 struct pipe_resource *indexBuffer,
                                  unsigned indexSize,
+                                 int indexBias,
                                  unsigned mode,
                                  unsigned start,
                                  unsigned count,
@@ -155,6 +162,7 @@ softpipe_draw_elements_instanced(struct pipe_context *pipe,
    softpipe_draw_range_elements_instanced(pipe,
                                           indexBuffer,
                                           indexSize,
+                                          indexBias,
                                           0,
                                           0xffffffff,
                                           mode,
@@ -166,8 +174,9 @@ softpipe_draw_elements_instanced(struct pipe_context *pipe,
 
 static void
 softpipe_draw_range_elements_instanced(struct pipe_context *pipe,
-                                       struct pipe_buffer *indexBuffer,
+                                       struct pipe_resource *indexBuffer,
                                        unsigned indexSize,
+                                       int indexBias,
                                        unsigned minIndex,
                                        unsigned maxIndex,
                                        unsigned mode,
@@ -193,22 +202,23 @@ softpipe_draw_range_elements_instanced(struct pipe_context *pipe,
 
    /* Map vertex buffers */
    for (i = 0; i < sp->num_vertex_buffers; i++) {
-      void *buf = softpipe_buffer(sp->vertex_buffer[i].buffer)->data;
+      void *buf = softpipe_resource(sp->vertex_buffer[i].buffer)->data;
       draw_set_mapped_vertex_buffer(draw, i, buf);
    }
 
    /* Map index buffer, if present */
    if (indexBuffer) {
-      void *mapped_indexes = softpipe_buffer(indexBuffer)->data;
+      void *mapped_indexes = softpipe_resource(indexBuffer)->data;
       draw_set_mapped_element_buffer_range(draw,
                                            indexSize,
+                                           indexBias,
                                            minIndex,
                                            maxIndex,
                                            mapped_indexes);
    } else {
       /* no index/element buffer */
       draw_set_mapped_element_buffer_range(draw,
-                                           0,
+                                           0, 0,
                                            start,
                                            start + count - 1,
                                            NULL);
@@ -222,7 +232,7 @@ softpipe_draw_range_elements_instanced(struct pipe_context *pipe,
       draw_set_mapped_vertex_buffer(draw, i, NULL);
    }
    if (indexBuffer) {
-      draw_set_mapped_element_buffer(draw, 0, NULL);
+      draw_set_mapped_element_buffer(draw, 0, 0, NULL);
    }
 
    /*