diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c index 3abe32afc7e..abed98ed8ae 100644 --- a/src/gallium/drivers/radeonsi/si_state.c +++ b/src/gallium/drivers/radeonsi/si_state.c @@ -1352,6 +1352,7 @@ static void si_bind_dsa_state(struct pipe_context *ctx, void *state) if (old_dsa->alpha_func != dsa->alpha_func) { si_ps_key_update_dsa(sctx); si_update_ps_inputs_read_or_disabled(sctx); + si_update_ps_kill_enable(sctx); sctx->do_update_shaders = true; } diff --git a/src/gallium/drivers/radeonsi/si_state.h b/src/gallium/drivers/radeonsi/si_state.h index f750ea4bbe1..595358067c0 100644 --- a/src/gallium/drivers/radeonsi/si_state.h +++ b/src/gallium/drivers/radeonsi/si_state.h @@ -584,6 +584,7 @@ void si_vs_key_update_inputs(struct si_context *sctx); void si_get_vs_key_inputs(struct si_context *sctx, struct si_shader_key *key, struct si_vs_prolog_bits *prolog_key); void si_update_ps_inputs_read_or_disabled(struct si_context *sctx); +void si_update_ps_kill_enable(struct si_context *sctx); unsigned si_get_input_prim(const struct si_shader_selector *gs); bool si_update_ngg(struct si_context *sctx); void si_ps_key_update_framebuffer(struct si_context *sctx); diff --git a/src/gallium/drivers/radeonsi/si_state_draw.cpp b/src/gallium/drivers/radeonsi/si_state_draw.cpp index c53c7c18a3d..1c4e6aa2aa3 100644 --- a/src/gallium/drivers/radeonsi/si_state_draw.cpp +++ b/src/gallium/drivers/radeonsi/si_state_draw.cpp @@ -203,9 +203,6 @@ static bool si_update_shaders(struct si_context *sctx) return false; si_pm4_bind_state(sctx, ps, sctx->shader.ps.current->pm4); - unsigned db_shader_control = sctx->shader.ps.cso->db_shader_control | - S_02880C_KILL_ENABLE(sctx->queued.named.dsa->alpha_func != PIPE_FUNC_ALWAYS); - if (si_pm4_state_changed(sctx, ps) || (!NGG && si_pm4_state_changed(sctx, vs)) || (NGG && si_pm4_state_changed(sctx, gs))) @@ -217,13 +214,6 @@ static bool si_update_shaders(struct si_context *sctx) sctx->shader.ps.current->key.part.ps.epilog.spi_shader_col_format)) si_mark_atom_dirty(sctx, &sctx->atoms.s.cb_render_state); - if (sctx->ps_db_shader_control != db_shader_control) { - sctx->ps_db_shader_control = db_shader_control; - si_mark_atom_dirty(sctx, &sctx->atoms.s.db_render_state); - if (sctx->screen->dpbb_allowed) - si_mark_atom_dirty(sctx, &sctx->atoms.s.dpbb_state); - } - if (sctx->smoothing_enabled != sctx->shader.ps.current->key.part.ps.epilog.poly_line_smoothing) { sctx->smoothing_enabled = sctx->shader.ps.current->key.part.ps.epilog.poly_line_smoothing; diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c index 55708b09645..b0c7751f583 100644 --- a/src/gallium/drivers/radeonsi/si_state_shaders.c +++ b/src/gallium/drivers/radeonsi/si_state_shaders.c @@ -3329,6 +3329,22 @@ static void si_bind_tes_shader(struct pipe_context *ctx, void *state) si_update_rasterized_prim(sctx); } +void si_update_ps_kill_enable(struct si_context *sctx) +{ + if (!sctx->shader.ps.cso) + return; + + unsigned db_shader_control = sctx->shader.ps.cso->db_shader_control | + S_02880C_KILL_ENABLE(sctx->queued.named.dsa->alpha_func != PIPE_FUNC_ALWAYS); + + if (sctx->ps_db_shader_control != db_shader_control) { + sctx->ps_db_shader_control = db_shader_control; + si_mark_atom_dirty(sctx, &sctx->atoms.s.db_render_state); + if (sctx->screen->dpbb_allowed) + si_mark_atom_dirty(sctx, &sctx->atoms.s.dpbb_state); + } +} + static void si_bind_ps_shader(struct pipe_context *ctx, void *state) { struct si_context *sctx = (struct si_context *)ctx; @@ -3366,6 +3382,7 @@ static void si_bind_ps_shader(struct pipe_context *ctx, void *state) si_ps_key_update_sample_shading(sctx); si_ps_key_update_framebuffer_rasterizer_sample_shading(sctx); si_update_ps_inputs_read_or_disabled(sctx); + si_update_ps_kill_enable(sctx); } static void si_delete_shader(struct si_context *sctx, struct si_shader *shader)