r600g: fix alpha-test with HyperZ enabled, fixing L4D2 tree corruption
authorMarek Olšák <marek.olsak@amd.com>
Tue, 2 Sep 2014 18:38:08 +0000 (20:38 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Wed, 3 Sep 2014 09:50:21 +0000 (11:50 +0200)
*_update_db_shader_control depends on the alpha test state. The problem was
it was in a block which is only entered if the pixel shader is changed.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74863

Cc: mesa-stable@lists.freedesktop.org
Tested-by: Benjamin Bellec <b.bellec@gmail.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
src/gallium/drivers/r600/r600_state_common.c

index 028d800981d60e27defd8018b824ac1a58b02128..d9174a592305283e978c7baf8b90129b23e3e943 100644 (file)
@@ -1245,12 +1245,6 @@ static bool r600_update_derived_state(struct r600_context *rctx)
                        }
                }
 
-               if (rctx->b.chip_class >= EVERGREEN) {
-                       evergreen_update_db_shader_control(rctx);
-               } else {
-                       r600_update_db_shader_control(rctx);
-               }
-
                if (unlikely(!ps_dirty && rctx->ps_shader && rctx->rasterizer &&
                                ((rctx->rasterizer->sprite_coord_enable != rctx->ps_shader->current->sprite_coord_enable) ||
                                                (rctx->rasterizer->flatshade != rctx->ps_shader->current->flatshade)))) {
@@ -1264,6 +1258,12 @@ static bool r600_update_derived_state(struct r600_context *rctx)
                update_shader_atom(ctx, &rctx->pixel_shader, rctx->ps_shader->current);
        }
 
+       if (rctx->b.chip_class >= EVERGREEN) {
+               evergreen_update_db_shader_control(rctx);
+       } else {
+               r600_update_db_shader_control(rctx);
+       }
+
        /* on R600 we stuff masks + txq info into one constant buffer */
        /* on evergreen we only need a txq info one */
        if (rctx->b.chip_class < EVERGREEN) {