i915g: Remove draw_flushes and state that we don't need to track
authorJakob Bornecrantz <wallbraker@gmail.com>
Mon, 24 Jan 2011 01:03:59 +0000 (02:03 +0100)
committerJakob Bornecrantz <wallbraker@gmail.com>
Mon, 24 Jan 2011 02:26:59 +0000 (03:26 +0100)
src/gallium/drivers/i915/i915_context.c
src/gallium/drivers/i915/i915_context.h
src/gallium/drivers/i915/i915_state.c

index ea3c10b5e7822b679facbf7c5e37eb12bbbd28e8..648d0090c9a5f17a3e261a6b4724e3cea8bbed17 100644 (file)
@@ -50,7 +50,6 @@ i915_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info)
    struct i915_context *i915 = i915_context(pipe);
    struct draw_context *draw = i915->draw;
    void *mapped_indices = NULL;
-   unsigned i;
    unsigned cbuf_dirty;
 
 
@@ -63,14 +62,6 @@ i915_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info)
    if (i915->dirty)
       i915_update_derived(i915);
 
-   /*
-    * Map vertex buffers
-    */
-   for (i = 0; i < i915->num_vertex_buffers; i++) {
-      void *buf = i915_buffer(i915->vertex_buffer[i].buffer)->data;
-      draw_set_mapped_vertex_buffer(draw, i, buf);
-   }
-
    /*
     * Map index buffer, if present
     */
@@ -90,13 +81,6 @@ i915_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info)
     */
    draw_vbo(i915->draw, info);
 
-   /*
-    * unmap vertex/index buffers
-    */
-   for (i = 0; i < i915->num_vertex_buffers; i++) {
-      draw_set_mapped_vertex_buffer(draw, i, NULL);
-   }
-
    if (mapped_indices)
       draw_set_mapped_index_buffer(draw, NULL);
 }
@@ -117,10 +101,6 @@ static void i915_destroy(struct pipe_context *pipe)
    if(i915->batch)
       i915->iws->batchbuffer_destroy(i915->batch);
 
-   for (i = 0; i < i915->num_vertex_buffers; i++) {
-      pipe_resource_reference(&i915->vertex_buffer[i].buffer, NULL);
-   }
-
    /* unbind framebuffer */
    for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) {
       pipe_surface_reference(&i915->framebuffer.cbufs[i], NULL);
index b7f1fb22221f1eb100f229eaace698cd1e318f8f..7f49dc96d5d8ae0b11a17834a46c8a2b1d1ddffb 100644 (file)
@@ -219,14 +219,12 @@ struct i915_context {
    struct pipe_scissor_state scissor;
    struct pipe_sampler_view *fragment_sampler_views[PIPE_MAX_SAMPLERS];
    struct pipe_viewport_state viewport;
-   struct pipe_vertex_buffer vertex_buffer[PIPE_MAX_ATTRIBS];
    struct pipe_index_buffer index_buffer;
 
    unsigned dirty;
 
    unsigned num_samplers;
    unsigned num_fragment_sampler_views;
-   unsigned num_vertex_buffers;
 
    struct i915_winsys_batchbuffer *batch;
 
index e386a3f46300c1e043f8572f86ad1ea58aad4e11..b31cc306a441469ebefffd8383cee2ac59e8078a 100644 (file)
@@ -776,17 +776,25 @@ static void i915_set_vertex_buffers(struct pipe_context *pipe,
                                     const struct pipe_vertex_buffer *buffers)
 {
    struct i915_context *i915 = i915_context(pipe);
-   /* Because we change state before the draw_set_vertex_buffers call
-    * we need a flush here, just to be sure.
-    */
-   draw_flush(i915->draw);
+   struct draw_context *draw = i915->draw;
+   int i;
 
-   util_copy_vertex_buffers(i915->vertex_buffer,
-                            &i915->num_vertex_buffers,
-                            buffers, count);
+#if 0
+   /* XXX doesn't look like this is needed */
+   /* unmap old */
+   for (i = 0; i < i915->num_vertex_buffers; i++) {
+      draw_set_mapped_vertex_buffer(draw, i, NULL);
+   }
+#endif
 
    /* pass-through to draw module */
-   draw_set_vertex_buffers(i915->draw, count, buffers);
+   draw_set_vertex_buffers(draw, count, buffers);
+
+   /* map new */
+   for (i = 0; i < count; i++) {
+      void *buf = i915_buffer(buffers[i].buffer)->data;
+      draw_set_mapped_vertex_buffer(draw, i, buf);
+   }
 }
 
 static void *
@@ -811,11 +819,6 @@ i915_bind_vertex_elements_state(struct pipe_context *pipe,
    struct i915_context *i915 = i915_context(pipe);
    struct i915_velems_state *i915_velems = (struct i915_velems_state *) velems;
 
-   /* Because we change state before the draw_set_vertex_buffers call
-    * we need a flush here, just to be sure.
-    */
-   draw_flush(i915->draw);
-
    /* pass-through to draw module */
    if (i915_velems) {
       draw_set_vertex_elements(i915->draw,