Squashed commit of the following:
[mesa.git] / src / gallium / drivers / i965 / brw_draw.c
index 852fd2298281a1da5d74804a39ecfe24369d26b5..eb73ec2f272c8a382ff5742f0e331cad98b029f4 100644 (file)
@@ -26,6 +26,7 @@
  **************************************************************************/
 
 
+#include "util/u_inlines.h"
 #include "util/u_prim.h"
 #include "util/u_upload_mgr.h"
 
@@ -34,7 +35,6 @@
 #include "brw_context.h"
 #include "brw_state.h"
 #include "brw_debug.h"
-#include "brw_screen.h"
 
 #include "brw_batchbuffer.h"
 
@@ -142,7 +142,7 @@ static int brw_emit_prim(struct brw_context *brw,
  */
 static int
 try_draw_range_elements(struct brw_context *brw,
-                       struct pipe_buffer *index_buffer,
+                       struct pipe_resource *index_buffer,
                        unsigned hw_prim, 
                        unsigned start, unsigned count)
 {
@@ -176,9 +176,9 @@ try_draw_range_elements(struct brw_context *brw,
 }
 
 
-static boolean
+static void
 brw_draw_range_elements(struct pipe_context *pipe,
-                       struct pipe_buffer *index_buffer,
+                       struct pipe_resource *index_buffer,
                        unsigned index_size,
                        unsigned min_index,
                        unsigned max_index,
@@ -201,7 +201,7 @@ brw_draw_range_elements(struct pipe_context *pipe,
     */
    if (brw->curr.index_buffer != index_buffer ||
        brw->curr.index_size != index_size) {
-      pipe_buffer_reference( &brw->curr.index_buffer, index_buffer );
+      pipe_resource_reference( &brw->curr.index_buffer, index_buffer );
       brw->curr.index_size = index_size;
       brw->state.dirty.mesa |= PIPE_NEW_INDEX_BUFFER;
    }
@@ -228,29 +228,27 @@ brw_draw_range_elements(struct pipe_context *pipe,
       ret = try_draw_range_elements(brw, index_buffer, hw_prim, start, count );
       assert(ret == 0);
    }
-
-   return TRUE;
 }
 
-static boolean
+static void
 brw_draw_elements(struct pipe_context *pipe,
-                 struct pipe_buffer *index_buffer,
+                 struct pipe_resource *index_buffer,
                  unsigned index_size,
                  unsigned mode, 
                  unsigned start, unsigned count)
 {
-   return brw_draw_range_elements( pipe, index_buffer,
-                                  index_size,
-                                  0, 0xffffffff,
-                                  mode, 
-                                  start, count );
+   brw_draw_range_elements( pipe, index_buffer,
+                            index_size,
+                            0, 0xffffffff,
+                            mode, 
+                            start, count );
 }
 
-static boolean
+static void
 brw_draw_arrays(struct pipe_context *pipe, unsigned mode,
                      unsigned start, unsigned count)
 {
-   return brw_draw_elements(pipe, NULL, 0, mode, start, count);
+   brw_draw_elements(pipe, NULL, 0, mode, start, count);
 }
 
 
@@ -265,17 +263,17 @@ boolean brw_draw_init( struct brw_context *brw )
 
    /* Create helpers for uploading data in user buffers:
     */
-   brw->vb.upload_vertex = u_upload_create( brw->base.screen,
+   brw->vb.upload_vertex = u_upload_create( &brw->base,
                                            128 * 1024,
                                            64,
-                                           PIPE_BUFFER_USAGE_VERTEX );
+                                           PIPE_BIND_VERTEX_BUFFER );
    if (brw->vb.upload_vertex == NULL)
       return FALSE;
 
-   brw->vb.upload_index = u_upload_create( brw->base.screen,
+   brw->vb.upload_index = u_upload_create( &brw->base,
                                           32 * 1024,
                                           64,
-                                          PIPE_BUFFER_USAGE_INDEX );
+                                          PIPE_BIND_INDEX_BUFFER );
    if (brw->vb.upload_index == NULL)
       return FALSE;