r600g: move updating vertex buffer state into set_vertex_buffers
authorMarek Olšák <maraeo@gmail.com>
Sun, 1 Apr 2012 21:54:44 +0000 (23:54 +0200)
committerMarek Olšák <maraeo@gmail.com>
Mon, 23 Apr 2012 23:39:22 +0000 (01:39 +0200)
src/gallium/drivers/r600/r600_pipe.h
src/gallium/drivers/r600/r600_state_common.c

index 450fcc4ccfef449602a7f9a8e6325acda7ee9cd0..e17011bfb685c5f962d11b88cb63691948a43f6d 100644 (file)
@@ -349,10 +349,11 @@ struct r600_context {
         * In that case, we bind this one: */
        void                    *dummy_pixel_shader;
 
-       bool                    vertex_buffers_dirty;
        boolean                 dual_src_blend;
        unsigned color0_format;
 
+       /* Vertex and index buffers. */
+       bool                    vertex_buffers_dirty;
        struct pipe_index_buffer index_buffer;
        struct pipe_vertex_buffer vertex_buffer[PIPE_MAX_ATTRIBS];
        unsigned                nr_vertex_buffers;
index b32d89b67500d7790b1545b3fc7f3e00221cdc42..75f9cdf89b9ba73ee9ac0154d0ca506dc3e23079 100644 (file)
@@ -398,7 +398,11 @@ void r600_set_vertex_buffers(struct pipe_context *ctx, unsigned count,
        struct r600_context *rctx = (struct r600_context *)ctx;
 
        util_copy_vertex_buffers(rctx->vertex_buffer, &rctx->nr_vertex_buffers, buffers, count);
-       rctx->vertex_buffers_dirty = true;
+
+       r600_inval_vertex_cache(rctx);
+       rctx->vertex_buffer_state.num_dw = (rctx->chip_class >= EVERGREEN ? 12 : 10) *
+                                          rctx->nr_vertex_buffers;
+       r600_atom_dirty(rctx, &rctx->vertex_buffer_state);
 }
 
 void *r600_create_vertex_elements(struct pipe_context *ctx,
@@ -760,15 +764,6 @@ void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *dinfo)
 
        r600_update_derived_state(rctx);
 
-       /* Update vertex buffers. */
-       if (rctx->vertex_buffers_dirty) {
-               r600_inval_vertex_cache(rctx);
-               rctx->vertex_buffer_state.num_dw = (rctx->chip_class >= EVERGREEN ? 12 : 10) *
-                                                  rctx->nr_vertex_buffers;
-               r600_atom_dirty(rctx, &rctx->vertex_buffer_state);
-               rctx->vertex_buffers_dirty = FALSE;
-       }
-
        if (info.indexed) {
                /* Initialize the index buffer struct. */
                pipe_resource_reference(&ib.buffer, rctx->index_buffer.buffer);