From: Vadim Girlin Date: Fri, 24 Jun 2011 16:29:12 +0000 (+0400) Subject: r600g: optimize spi update X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d81126b714cd4de0ab036bb22bf4103f5fcec015;p=mesa.git r600g: optimize spi update Signed-off-by: Vadim Girlin --- diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h index 9941bbf0e3c..63ddd391dad 100644 --- a/src/gallium/drivers/r600/r600_pipe.h +++ b/src/gallium/drivers/r600/r600_pipe.h @@ -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; diff --git a/src/gallium/drivers/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c index 30c61817a08..259f4262c26 100644 --- a/src/gallium/drivers/r600/r600_state_common.c +++ b/src/gallium/drivers/r600/r600_state_common.c @@ -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);