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 b55cbf349486c3b1331bfcbfd995fe4f816388ae..983a0976b044ce344acf4154ef6a2090181b9c62 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 8e89e4a2ef0c0d84014be22124e9019c8a5bcaed..9ba4970b3ff0534c4f9e297e11b2b2d308df42ff 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 fe9666f5f99a350afeb3e766f939aaaaa1814f89..1bb1f69044c7268084953f8e4e98462f5e7be925 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 4383da4ad0922853f24732efc79ac3f5fe77c10a..f3d58c3e2ab0e23880709a24590649a2f4bf1e8c 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 31d5094d008a594ca5ce972d5822e84dd8c2f93b..3a5b0ae5fee4098a0dde6cbff630bf157e748951 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)