radeonsi: start reworking inferred state handling
authorChristian König <deathsimple@vodafone.de>
Fri, 14 Sep 2012 15:05:34 +0000 (17:05 +0200)
committerChristian König <deathsimple@vodafone.de>
Wed, 26 Sep 2012 09:04:36 +0000 (11:04 +0200)
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 <deathsimple@vodafone.de>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
src/gallium/drivers/radeonsi/radeonsi_pipe.h
src/gallium/drivers/radeonsi/si_state.c
src/gallium/drivers/radeonsi/si_state.h
src/gallium/drivers/radeonsi/si_state_draw.c

index 4253dbb19ad295fd25db8c1276a5a08ad6f461ac..587cba8c841dfe8610aaaa9d9aefa5af874df975 100644 (file)
@@ -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;
index 1a5ed2fa3d90a6f9c5901956e315a5a297e02f7c..4def9a8200551f3859754fa2ff2cce6cf0ba920e 100644 (file)
@@ -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)
index d59624cd8e64304105de2bacce0324f1a326e61b..5c908a701cefe234c8953d13312f3e93a6825326 100644 (file)
@@ -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); \
index 0cb8b7180e45b190b5835e93be4d1e753331fd9c..2608ad0b360f71579274677335a44a10a3d9da3c 100644 (file)
@@ -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;
        }
 }