From 416ca99602be2e6d875c4c344abb2513250ef455 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Sun, 6 Sep 2020 02:30:54 -0400 Subject: [PATCH] radeonsi: remove redundant si_shader_info:*(clip|cull)* fields Reviewed-by: Pierre-Eric Pelloux-Prayer Part-of: --- src/gallium/drivers/radeonsi/si_shader.h | 4 ---- src/gallium/drivers/radeonsi/si_shader_nir.c | 4 ---- src/gallium/drivers/radeonsi/si_state.c | 2 +- src/gallium/drivers/radeonsi/si_state_shaders.c | 10 ++++++---- 4 files changed, 7 insertions(+), 13 deletions(-) diff --git a/src/gallium/drivers/radeonsi/si_shader.h b/src/gallium/drivers/radeonsi/si_shader.h index a6cf898bf70..bf4d9ca6274 100644 --- a/src/gallium/drivers/radeonsi/si_shader.h +++ b/src/gallium/drivers/radeonsi/si_shader.h @@ -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; diff --git a/src/gallium/drivers/radeonsi/si_shader_nir.c b/src/gallium/drivers/radeonsi/si_shader_nir.c index 443a52bbac8..8341181dec0 100644 --- a/src/gallium/drivers/radeonsi/si_shader_nir.c +++ b/src/gallium/drivers/radeonsi/si_shader_nir.c @@ -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; diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c index dc89fc58324..da78b7ea769 100644 --- a/src/gallium/drivers/radeonsi/si_state.c +++ b/src/gallium/drivers/radeonsi/si_state.c @@ -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; } diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c index c4336191953..4fbbcf48d98 100644 --- a/src/gallium/drivers/radeonsi/si_state_shaders.c +++ b/src/gallium/drivers/radeonsi/si_state_shaders.c @@ -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) | -- 2.30.2