aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian König <[email protected]>2012-09-14 17:05:34 +0200
committerChristian König <[email protected]>2012-09-26 11:04:36 +0200
commit04473db38ade5902a6ad49dba8ca8215599d57be (patch)
tree32a45fcbaff0db2f2c42d3b49649e9cf6cbce337
parent112caa853d53467a9c0ef171f272505db0278c6a (diff)
radeonsi: start reworking inferred state handling
Instead of tracking the inferred state changes separately just check if queued and emitted states are the same. This patch just reworks the update of the SPI map between vs and ps, but there are probably more cases like this. Signed-off-by: Christian König <[email protected]> Reviewed-by: Michel Dänzer <[email protected]>
-rw-r--r--src/gallium/drivers/radeonsi/radeonsi_pipe.h1
-rw-r--r--src/gallium/drivers/radeonsi/si_state.c2
-rw-r--r--src/gallium/drivers/radeonsi/si_state.h3
-rw-r--r--src/gallium/drivers/radeonsi/si_state_draw.c4
4 files changed, 4 insertions, 6 deletions
diff --git a/src/gallium/drivers/radeonsi/radeonsi_pipe.h b/src/gallium/drivers/radeonsi/radeonsi_pipe.h
index 4253dbb19ad..587cba8c841 100644
--- a/src/gallium/drivers/radeonsi/radeonsi_pipe.h
+++ b/src/gallium/drivers/radeonsi/radeonsi_pipe.h
@@ -140,7 +140,6 @@ struct r600_context {
struct r600_textures_info ps_samplers;
struct si_resource *border_color_table;
unsigned border_color_offset;
- boolean shader_dirty;
struct u_upload_mgr *uploader;
struct util_slab_mempool pool_transfers;
diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c
index 1a5ed2fa3d9..4def9a82005 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -1969,7 +1969,6 @@ static void si_bind_vs_shader(struct pipe_context *ctx, void *state)
if (rctx->vs_shader == sel)
return;
- rctx->shader_dirty = true;
rctx->vs_shader = sel;
if (sel && sel->current)
@@ -1986,7 +1985,6 @@ static void si_bind_ps_shader(struct pipe_context *ctx, void *state)
if (rctx->ps_shader == sel)
return;
- rctx->shader_dirty = true;
rctx->ps_shader = sel;
if (sel && sel->current)
diff --git a/src/gallium/drivers/radeonsi/si_state.h b/src/gallium/drivers/radeonsi/si_state.h
index d59624cd8e6..5c908a701ce 100644
--- a/src/gallium/drivers/radeonsi/si_state.h
+++ b/src/gallium/drivers/radeonsi/si_state.h
@@ -101,6 +101,9 @@ union si_state {
#define si_pm4_block_idx(member) \
(offsetof(union si_state, named.member) / sizeof(struct si_pm4_state *))
+#define si_pm4_state_changed(rctx, member) \
+ ((rctx)->queued.named.member != (rctx)->emitted.named.member)
+
#define si_pm4_bind_state(rctx, member, value) \
do { \
(rctx)->queued.named.member = (value); \
diff --git a/src/gallium/drivers/radeonsi/si_state_draw.c b/src/gallium/drivers/radeonsi/si_state_draw.c
index 0cb8b7180e4..2608ad0b360 100644
--- a/src/gallium/drivers/radeonsi/si_state_draw.c
+++ b/src/gallium/drivers/radeonsi/si_state_draw.c
@@ -406,12 +406,10 @@ static void si_update_derived_state(struct r600_context *rctx)
if (ps_dirty) {
si_pm4_bind_state(rctx, ps, rctx->ps_shader->current->pm4);
- rctx->shader_dirty = true;
}
- if (rctx->shader_dirty) {
+ if (si_pm4_state_changed(rctx, ps) || si_pm4_state_changed(rctx, vs)) {
si_update_spi_map(rctx);
- rctx->shader_dirty = false;
}
}