r600g: optimize spi update
authorVadim Girlin <vadimgirlin@gmail.com>
Fri, 24 Jun 2011 16:29:12 +0000 (20:29 +0400)
committerJerome Glisse <jglisse@redhat.com>
Fri, 24 Jun 2011 19:23:38 +0000 (15:23 -0400)
Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
src/gallium/drivers/r600/r600_pipe.h
src/gallium/drivers/r600/r600_state_common.c

index 9941bbf0e3c01a5c1b51ad47e3863e63bc6be9e3..63ddd391dad0f6335ac2eab14bd28574a17e35da 100644 (file)
@@ -202,6 +202,7 @@ struct r600_pipe_context {
        struct pipe_query               *saved_render_cond;
        unsigned                        saved_render_cond_mode;
        /* shader information */
+       boolean                         spi_dirty;
        unsigned                        sprite_coord_enable;
        boolean                         flatshade;
        boolean                         export_16bpc;
index 30c61817a08c82754e08c42492bf691203718e8d..259f4262c268a0a1f753d7cf6d0007a470bb3b03 100644 (file)
@@ -112,7 +112,7 @@ void r600_bind_rs_state(struct pipe_context *ctx, void *state)
                r600_polygon_offset_update(rctx);
        }
        if (rctx->ps_shader && rctx->vs_shader)
-               r600_spi_update(rctx);
+               rctx->spi_dirty = true;
 }
 
 void r600_delete_rs_state(struct pipe_context *ctx, void *state)
@@ -274,7 +274,7 @@ void r600_bind_ps_shader(struct pipe_context *ctx, void *state)
                r600_context_pipe_state_set(&rctx->ctx, &rctx->ps_shader->rstate);
        }
        if (rctx->ps_shader && rctx->vs_shader) {
-               r600_spi_update(rctx);
+               rctx->spi_dirty = true;
                r600_adjust_gprs(rctx);
        }
 }
@@ -289,7 +289,7 @@ void r600_bind_vs_shader(struct pipe_context *ctx, void *state)
                r600_context_pipe_state_set(&rctx->ctx, &rctx->vs_shader->rstate);
        }
        if (rctx->ps_shader && rctx->vs_shader) {
-               r600_spi_update(rctx);
+               rctx->spi_dirty = true;
                r600_adjust_gprs(rctx);
        }
 }
@@ -391,6 +391,7 @@ static void r600_spi_update(struct r600_pipe_context *rctx)
                r600_pipe_state_mod_reg(rstate, tmp);
        }
 
+       rctx->spi_dirty = false;
        r600_context_pipe_state_set(&rctx->ctx, rstate);
 }
 
@@ -573,6 +574,9 @@ void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info)
        if (r600_conv_pipe_prim(draw.info.mode, &prim))
                return;
 
+       if (rctx->spi_dirty)
+               r600_spi_update(rctx);
+
        if (rctx->alpha_ref_dirty)
                r600_update_alpha_ref(rctx);