OSDN Git Service

radeonsi: only emit line stippling and provoking vertex state when it changes
authorMarek Olšák <marek.olsak@amd.com>
Mon, 8 Dec 2014 12:35:36 +0000 (13:35 +0100)
committerMarek Olšák <marek.olsak@amd.com>
Wed, 10 Dec 2014 20:59:37 +0000 (21:59 +0100)
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
src/gallium/drivers/radeonsi/si_hw_context.c
src/gallium/drivers/radeonsi/si_pipe.h
src/gallium/drivers/radeonsi/si_state.c
src/gallium/drivers/radeonsi/si_state_draw.c
src/gallium/drivers/radeonsi/si_state_shaders.c

index b55cbf3..983a097 100644 (file)
@@ -161,4 +161,5 @@ void si_begin_new_cs(struct si_context *ctx)
        ctx->last_gs_out_prim = -1;
        ctx->last_prim = -1;
        ctx->last_multi_vgt_param = -1;
+       ctx->last_rast_prim = -1;
 }
index 8e89e4a..9ba4970 100644 (file)
@@ -185,6 +185,7 @@ struct si_context {
        int                     last_gs_out_prim;
        int                     last_prim;
        int                     last_multi_vgt_param;
+       int                     last_rast_prim;
 };
 
 /* si_blit.c */
index fe9666f..1bb1f69 100644 (file)
@@ -711,6 +711,7 @@ static void si_bind_rs_state(struct pipe_context *ctx, void *state)
        si_update_fb_rs_state(sctx);
 
        sctx->clip_regs.dirty = true;
+       sctx->last_rast_prim = -1; /* reset this so that it gets updated */
 }
 
 static void si_delete_rs_state(struct pipe_context *ctx, void *state)
index 4383da4..f3d58c3 100644 (file)
@@ -156,6 +156,9 @@ static void si_emit_rasterizer_prim_state(struct si_context *sctx, unsigned mode
        if (sctx->gs_shader)
                mode = sctx->gs_shader->gs_output_prim;
 
+       if (mode == sctx->last_rast_prim)
+               return;
+
        r600_write_context_reg(cs, R_028A0C_PA_SC_LINE_STIPPLE,
                sctx->pa_sc_line_stipple |
                S_028A0C_AUTO_RESET_CNTL(mode == PIPE_PRIM_LINES ? 1 :
@@ -166,6 +169,8 @@ static void si_emit_rasterizer_prim_state(struct si_context *sctx, unsigned mode
                S_028814_PROVOKING_VTX_LAST(mode == PIPE_PRIM_QUADS ||
                                            mode == PIPE_PRIM_QUAD_STRIP ||
                                            mode == PIPE_PRIM_POLYGON));
+
+       sctx->last_rast_prim = mode;
 }
 
 static void si_emit_draw_registers(struct si_context *sctx,
index 31d5094..3a5b0ae 100644 (file)
@@ -512,6 +512,7 @@ static void si_bind_gs_shader(struct pipe_context *ctx, void *state)
 
        sctx->gs_shader = sel;
        sctx->clip_regs.dirty = true;
+       sctx->last_rast_prim = -1; /* reset this so that it gets updated */
 }
 
 static void si_make_dummy_ps(struct si_context *sctx)