radeonsi: remove redundant si_shader_info::uses_kill
authorMarek Olšák <marek.olsak@amd.com>
Sun, 6 Sep 2020 06:40:58 +0000 (02:40 -0400)
committerVivek Pandya <vivekvpandya@gmail.com>
Mon, 7 Sep 2020 15:55:17 +0000 (21:25 +0530)
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6624>

src/gallium/drivers/radeonsi/si_shader.h
src/gallium/drivers/radeonsi/si_shader_nir.c
src/gallium/drivers/radeonsi/si_state_shaders.c

index 653547617783534ca06afa580094e61f73bc6107..bfcbfab6e25d4c9a60cec316d4702c0ab94f7f06 100644 (file)
@@ -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;
index ce05143e559e337f327a56074760cb003b910f47..369289f6fac9008b7f546551c772fb8acfa98bdd 100644 (file)
@@ -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);
    }
index 400b0de6cc6e9ffb08796bc8eb54c22bb4960434..68d82364ec98757b605be4e7bd9c516028de0262 100644 (file)
@@ -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) {