[Mesa-dev] [PATCH 2/3] r600g: optimize spi update
Vadim Girlin
vadimgirlin at gmail.com
Fri Jun 24 09:29:12 PDT 2011
Signed-off-by: Vadim Girlin <vadimgirlin at gmail.com>
---
src/gallium/drivers/r600/r600_pipe.h | 1 +
src/gallium/drivers/r600/r600_state_common.c | 10 +++++++---
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h
index 9941bbf..63ddd39 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 30c6181..259f426 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);
--
1.7.5.4
More information about the mesa-dev
mailing list