From 04473db38ade5902a6ad49dba8ca8215599d57be Mon Sep 17 00:00:00 2001 From: =?utf8?q?Christian=20K=C3=B6nig?= Date: Fri, 14 Sep 2012 17:05:34 +0200 Subject: [PATCH] radeonsi: start reworking inferred state handling MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Michel Dänzer --- src/gallium/drivers/radeonsi/radeonsi_pipe.h | 1 - src/gallium/drivers/radeonsi/si_state.c | 2 -- src/gallium/drivers/radeonsi/si_state.h | 3 +++ src/gallium/drivers/radeonsi/si_state_draw.c | 4 +--- 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; } } -- 2.30.2