From ad35e2275e7df92cff2943fe71a6cfa2dcd47796 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Sun, 6 Sep 2020 02:40:58 -0400 Subject: [PATCH] radeonsi: remove redundant si_shader_info::uses_kill Reviewed-by: Pierre-Eric Pelloux-Prayer Part-of: --- src/gallium/drivers/radeonsi/si_shader.h | 1 - src/gallium/drivers/radeonsi/si_shader_nir.c | 3 --- src/gallium/drivers/radeonsi/si_state_shaders.c | 8 ++++---- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/gallium/drivers/radeonsi/si_shader.h b/src/gallium/drivers/radeonsi/si_shader.h index 65354761778..bfcbfab6e25 100644 --- a/src/gallium/drivers/radeonsi/si_shader.h +++ b/src/gallium/drivers/radeonsi/si_shader.h @@ -348,7 +348,6 @@ struct si_shader_info { bool writes_stencil; /**< does fragment shader write stencil value? */ bool writes_samplemask; /**< does fragment shader write sample mask? */ bool writes_edgeflag; /**< vertex shader outputs edgeflag */ - bool uses_kill; /**< KILL or KILL_IF instruction used? */ bool uses_persp_center; bool uses_persp_centroid; bool uses_persp_sample; diff --git a/src/gallium/drivers/radeonsi/si_shader_nir.c b/src/gallium/drivers/radeonsi/si_shader_nir.c index ce05143e559..369289f6fac 100644 --- a/src/gallium/drivers/radeonsi/si_shader_nir.c +++ b/src/gallium/drivers/radeonsi/si_shader_nir.c @@ -467,9 +467,6 @@ void si_nir_scan_shader(const struct nir_shader *nir, struct si_shader_info *inf info->constbuf0_num_slots = nir->num_uniforms; - if (info->stage == MESA_SHADER_FRAGMENT) - info->uses_kill = nir->info.fs.uses_discard; - if (nir->info.stage == MESA_SHADER_TESS_CTRL) { info->tessfactors_are_def_in_all_invocs = ac_are_tessfactors_def_in_all_invocs(nir); } diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c index 400b0de6cc6..68d82364ec9 100644 --- a/src/gallium/drivers/radeonsi/si_state_shaders.c +++ b/src/gallium/drivers/radeonsi/si_state_shaders.c @@ -72,7 +72,7 @@ void si_get_ir_cache_key(struct si_shader_selector *sel, bool ngg, bool es, shader_variant_flags |= 1 << 1; if (si_get_wave_size(sel->screen, sel->info.stage, ngg, es, false, false) == 32) shader_variant_flags |= 1 << 2; - if (sel->info.stage == MESA_SHADER_FRAGMENT && sel->info.uses_derivatives && sel->info.uses_kill && + if (sel->info.stage == MESA_SHADER_FRAGMENT && sel->info.uses_derivatives && sel->info.base.fs.uses_discard && sel->screen->debug_flags & DBG(FS_CORRECT_DERIVS_AFTER_KILL)) shader_variant_flags |= 1 << 3; @@ -1616,7 +1616,7 @@ 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.chip_class <= GFX9 || info->uses_kill || + if ((sscreen->info.chip_class <= GFX9 || info->base.fs.uses_discard || shader->key.part.ps.epilog.alpha_func != PIPE_FUNC_ALWAYS) && !spi_shader_col_format && !info->writes_z && !info->writes_stencil && !info->writes_samplemask) @@ -1756,7 +1756,7 @@ static void si_shader_selector_key_hw_vs(struct si_context *sctx, struct si_shad /* Find out if PS is disabled. */ bool ps_disabled = true; if (ps) { - bool ps_modifies_zs = ps->info.uses_kill || 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 || si_get_alpha_test_func(sctx) != PIPE_FUNC_ALWAYS; @@ -2763,7 +2763,7 @@ static void *si_create_shader_selector(struct pipe_context *ctx, sel->db_shader_control = S_02880C_Z_EXPORT_ENABLE(sel->info.writes_z) | S_02880C_STENCIL_TEST_VAL_EXPORT_ENABLE(sel->info.writes_stencil) | S_02880C_MASK_EXPORT_ENABLE(sel->info.writes_samplemask) | - S_02880C_KILL_ENABLE(sel->info.uses_kill); + S_02880C_KILL_ENABLE(sel->info.base.fs.uses_discard); if (sel->info.stage == MESA_SHADER_FRAGMENT) { switch (sel->info.base.fs.depth_layout) { -- 2.30.2