radeonsi: don't update polygon offset state if it has no effect
authorMarek Olšák <marek.olsak@amd.com>
Thu, 3 Sep 2015 17:34:58 +0000 (19:34 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Thu, 10 Sep 2015 15:14:15 +0000 (17:14 +0200)
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
src/gallium/drivers/radeonsi/si_state.c
src/gallium/drivers/radeonsi/si_state.h

index f698c59d87a8bb7a86fb6b1faa9051644bf87cfc..d74f6e896c4c6323ca3c07db025a47689ba12762 100644 (file)
@@ -636,7 +636,7 @@ static void si_update_poly_offset_state(struct si_context *sctx)
 {
        struct si_state_rasterizer *rs = sctx->queued.named.rasterizer;
 
-       if (!rs || !sctx->framebuffer.state.zsbuf)
+       if (!rs || !rs->uses_poly_offset || !sctx->framebuffer.state.zsbuf)
                return;
 
        switch (sctx->framebuffer.state.zsbuf->texture->format) {
@@ -691,6 +691,8 @@ static void *si_create_rs_state(struct pipe_context *ctx,
        rs->poly_stipple_enable = state->poly_stipple_enable;
        rs->line_smooth = state->line_smooth;
        rs->poly_smooth = state->poly_smooth;
+       rs->uses_poly_offset = state->offset_point || state->offset_line ||
+                              state->offset_tri;
 
        rs->flatshade = state->flatshade;
        rs->sprite_coord_enable = state->sprite_coord_enable;
index 3718e05f3b39fdad49fbba3ac92ed63436349e12..900b70f804cc05d936a391976441dabb82e93dec 100644 (file)
@@ -58,6 +58,7 @@ struct si_state_rasterizer {
        bool                    poly_stipple_enable;
        bool                    line_smooth;
        bool                    poly_smooth;
+       bool                    uses_poly_offset;
 };
 
 struct si_dsa_stencil_ref_part {