radeonsi: remove redundant si_shader_info:*(clip|cull)* fields
authorMarek Olšák <marek.olsak@amd.com>
Sun, 6 Sep 2020 06:30:54 +0000 (02:30 -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.c
src/gallium/drivers/radeonsi/si_state_shaders.c

index a6cf898bf7098aaedd5771e4bbb82e9e6167dcf7..bf4d9ca6274e2fd3bc333e76ea86b01e04b2852e 100644 (file)
@@ -381,10 +381,6 @@ struct si_shader_info {
    bool uses_bindless_samplers;
    bool uses_bindless_images;
    bool uses_fbfetch;
-   unsigned clipdist_writemask;
-   unsigned culldist_writemask;
-   unsigned num_written_culldistance;
-   unsigned num_written_clipdistance;
 
    /** Whether all codepaths write tess factors in all invocations. */
    bool tessfactors_are_def_in_all_invocs;
index 443a52bbac8c8f48987e47267ffb1b42f313d27d..8341181dec0372baa8acb37354aac388a16107e8 100644 (file)
@@ -479,10 +479,6 @@ void si_nir_scan_shader(const struct nir_shader *nir, struct si_shader_info *inf
    }
 
    info->constbuf0_num_slots = nir->num_uniforms;
-   info->num_written_clipdistance = nir->info.clip_distance_array_size;
-   info->num_written_culldistance = nir->info.cull_distance_array_size;
-   info->clipdist_writemask = u_bit_consecutive(0, info->num_written_clipdistance);
-   info->culldist_writemask = u_bit_consecutive(0, info->num_written_culldistance);
 
    if (info->stage == MESA_SHADER_FRAGMENT)
       info->uses_kill = nir->info.fs.uses_discard;
index dc89fc583240d2ab29acd9a25c12a4136cdac6ec..da78b7ea769f5043678eefaa73b3c210354415b9 100644 (file)
@@ -740,7 +740,7 @@ static void si_emit_clip_regs(struct si_context *sctx)
    unsigned total_mask;
 
    if (vs->key.opt.clip_disable) {
-      assert(!info->culldist_writemask);
+      assert(!info->base.cull_distance_array_size);
       clipdist_mask = 0;
       culldist_mask = 0;
    }
index c4336191953073b788b6f3d6af5121b5d7f3a277..4fbbcf48d981df876e25495d88e26066f46b3d0f 100644 (file)
@@ -1750,8 +1750,8 @@ static void si_shader_selector_key_hw_vs(struct si_context *sctx, struct si_shad
    struct si_shader_selector *ps = sctx->ps_shader.cso;
 
    key->opt.clip_disable = sctx->queued.named.rasterizer->clip_plane_enable == 0 &&
-                           (vs->info.clipdist_writemask || vs->info.writes_clipvertex) &&
-                           !vs->info.culldist_writemask;
+                           (vs->info.base.clip_distance_array_size || vs->info.writes_clipvertex) &&
+                           !vs->info.base.cull_distance_array_size;
 
    /* Find out if PS is disabled. */
    bool ps_disabled = true;
@@ -2755,8 +2755,10 @@ static void *si_create_shader_selector(struct pipe_context *ctx,
    if (sctx->chip_class <= GFX9)
       sel->pa_cl_vs_out_cntl = si_get_vs_out_cntl(sel, false);
 
-   sel->clipdist_mask = sel->info.writes_clipvertex ? SIX_BITS : sel->info.clipdist_writemask;
-   sel->culldist_mask = sel->info.culldist_writemask << sel->info.num_written_clipdistance;
+   sel->clipdist_mask = sel->info.writes_clipvertex ? SIX_BITS :
+                           u_bit_consecutive(0, sel->info.base.clip_distance_array_size);
+   sel->culldist_mask = u_bit_consecutive(0, sel->info.base.cull_distance_array_size) <<
+                        sel->info.base.clip_distance_array_size;
 
    /* DB_SHADER_CONTROL */
    sel->db_shader_control = S_02880C_Z_EXPORT_ENABLE(sel->info.writes_z) |