radeonsi: fix polygon stippling without color and Z outputs (v2)

We need to handle the fact that it kills pixels.

v2: also update si_update_ps_inputs_read_or_disabled

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16885>
This commit is contained in:
Marek Olšák 2022-05-15 02:12:18 -04:00 committed by Marge Bot
parent 56359e9f6e
commit 7cbea71aab
2 changed files with 14 additions and 4 deletions

View file

@ -1211,6 +1211,9 @@ static void si_bind_rs_state(struct pipe_context *ctx, void *state)
sctx->do_update_shaders = true;
}
if (old_rs->poly_stipple_enable != rs->poly_stipple_enable)
si_update_ps_kill_enable(sctx);
if (old_rs->line_smooth != rs->line_smooth ||
old_rs->poly_smooth != rs->poly_smooth ||
old_rs->poly_stipple_enable != rs->poly_stipple_enable ||

View file

@ -1921,7 +1921,9 @@ static void si_shader_ps(struct si_screen *sscreen, struct si_shader *shader)
* the color and Z formats to SPI_SHADER_ZERO. The hw will skip export
* instructions if any are present.
*/
if ((sscreen->info.gfx_level <= GFX9 || info->base.fs.uses_discard ||
if ((sscreen->info.gfx_level <= GFX9 ||
info->base.fs.uses_discard ||
shader->key.ps.part.prolog.poly_stipple ||
shader->key.ps.part.epilog.alpha_func != PIPE_FUNC_ALWAYS) &&
!spi_shader_col_format && !info->writes_z && !info->writes_stencil &&
!info->writes_samplemask)
@ -2123,10 +2125,13 @@ void si_update_ps_inputs_read_or_disabled(struct si_context *sctx)
/* Find out if PS is disabled. */
bool ps_disabled = true;
if (ps) {
bool ps_modifies_zs = ps->info.base.fs.uses_discard || ps->info.writes_z || ps->info.writes_stencil ||
bool ps_modifies_zs = ps->info.base.fs.uses_discard ||
ps->info.writes_z ||
ps->info.writes_stencil ||
ps->info.writes_samplemask ||
sctx->queued.named.blend->alpha_to_coverage ||
sctx->queued.named.dsa->alpha_func != PIPE_FUNC_ALWAYS;
sctx->queued.named.dsa->alpha_func != PIPE_FUNC_ALWAYS ||
sctx->queued.named.rasterizer->poly_stipple_enable;
unsigned ps_colormask = si_get_total_colormask(sctx);
ps_disabled = sctx->queued.named.rasterizer->rasterizer_discard ||
@ -3478,8 +3483,10 @@ void si_update_ps_kill_enable(struct si_context *sctx)
if (!sctx->shader.ps.cso)
return;
/* Changes to KILL_ENABLE should also update si_shader_ps. */
unsigned db_shader_control = sctx->shader.ps.cso->info.db_shader_control |
S_02880C_KILL_ENABLE(sctx->queued.named.dsa->alpha_func != PIPE_FUNC_ALWAYS);
S_02880C_KILL_ENABLE(sctx->queued.named.rasterizer->poly_stipple_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;