radeonsi: move DB_SHADER_CONTROL update for PS out of si_update_shaders

It only depends on the pixel shader CSO and alpha test.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12343>
This commit is contained in:
Marek Olšák
2021-08-10 11:14:50 -04:00
committed by Marge Bot
parent 70220a1896
commit eed149aa7c
4 changed files with 19 additions and 10 deletions
+1
View File
@@ -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;
}
+1
View File
@@ -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);
@@ -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;
@@ -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)