From 9b75061386ea52bcd1041fb7840e0121d5a883c5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Sun, 6 Sep 2020 02:15:51 -0400 Subject: [PATCH] radeonsi: remove redundant si_shader_info::images_declared Reviewed-by: Pierre-Eric Pelloux-Prayer Part-of: --- src/gallium/drivers/radeonsi/si_compute.c | 3 ++- src/gallium/drivers/radeonsi/si_debug.c | 2 +- src/gallium/drivers/radeonsi/si_descriptors.c | 4 ++-- src/gallium/drivers/radeonsi/si_shader.c | 2 +- src/gallium/drivers/radeonsi/si_shader.h | 2 -- src/gallium/drivers/radeonsi/si_shader_nir.c | 1 - src/gallium/drivers/radeonsi/si_state_draw.c | 5 ++--- src/gallium/drivers/radeonsi/si_state_shaders.c | 2 +- 8 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/gallium/drivers/radeonsi/si_compute.c b/src/gallium/drivers/radeonsi/si_compute.c index 8dc73600661..3987ecdc66d 100644 --- a/src/gallium/drivers/radeonsi/si_compute.c +++ b/src/gallium/drivers/radeonsi/si_compute.c @@ -152,7 +152,8 @@ static void si_create_compute_state_async(void *job, int thread_index) } /* Images in user SGPRs. */ - unsigned non_msaa_images = sel->info.images_declared & ~sel->info.base.msaa_images; + unsigned non_msaa_images = u_bit_consecutive(0, sel->info.base.num_images) & + ~sel->info.base.msaa_images; for (unsigned i = 0; i < 3 && non_msaa_images & (1 << i); i++) { unsigned num_sgprs = sel->info.base.image_buffers & (1 << i) ? 4 : 8; diff --git a/src/gallium/drivers/radeonsi/si_debug.c b/src/gallium/drivers/radeonsi/si_debug.c index e39ce2f584d..8fc7e4e088e 100644 --- a/src/gallium/drivers/radeonsi/si_debug.c +++ b/src/gallium/drivers/radeonsi/si_debug.c @@ -792,7 +792,7 @@ static void si_dump_descriptors(struct si_context *sctx, gl_shader_stage stage, enabled_constbuf = info->const_buffers_declared; enabled_shaderbuf = u_bit_consecutive(0, info->base.num_ssbos); enabled_samplers = info->base.textures_used; - enabled_images = info->images_declared; + enabled_images = u_bit_consecutive(0, info->base.num_images); } else { enabled_constbuf = sctx->const_and_shader_buffers[processor].enabled_mask >> SI_NUM_SHADER_BUFFERS; diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c b/src/gallium/drivers/radeonsi/si_descriptors.c index 62bf78ea45a..0d1abe19c05 100644 --- a/src/gallium/drivers/radeonsi/si_descriptors.c +++ b/src/gallium/drivers/radeonsi/si_descriptors.c @@ -2805,7 +2805,7 @@ bool si_gfx_resources_check_encrypted(struct si_context *sctx) si_sampler_views_check_encrypted(sctx, &sctx->samplers[i], current_shader[i]->cso->info.base.textures_used); use_encrypted_bo |= si_image_views_check_encrypted(sctx, &sctx->images[i], - current_shader[i]->cso->info.images_declared); + u_bit_consecutive(0, current_shader[i]->cso->info.base.num_images)); } use_encrypted_bo |= si_buffer_resources_check_encrypted(sctx, &sctx->rw_buffers); @@ -2858,7 +2858,7 @@ bool si_compute_resources_check_encrypted(struct si_context *sctx) */ return si_buffer_resources_check_encrypted(sctx, &sctx->const_and_shader_buffers[sh]) || si_sampler_views_check_encrypted(sctx, &sctx->samplers[sh], info->base.textures_used) || - si_image_views_check_encrypted(sctx, &sctx->images[sh], info->images_declared) || + si_image_views_check_encrypted(sctx, &sctx->images[sh], u_bit_consecutive(0, info->base.num_images)) || si_buffer_resources_check_encrypted(sctx, &sctx->rw_buffers); } diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index ca5e485f2c4..08bc677bc00 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -1346,7 +1346,7 @@ static bool si_build_main_function(struct si_shader_context *ctx, struct si_shad ctx->num_shader_buffers = info->base.num_ssbos; ctx->num_samplers = util_last_bit(info->base.textures_used); - ctx->num_images = util_last_bit(info->images_declared); + ctx->num_images = info->base.num_images; si_llvm_init_resource_callbacks(ctx); diff --git a/src/gallium/drivers/radeonsi/si_shader.h b/src/gallium/drivers/radeonsi/si_shader.h index 9465729dc64..1d85d053817 100644 --- a/src/gallium/drivers/radeonsi/si_shader.h +++ b/src/gallium/drivers/radeonsi/si_shader.h @@ -387,8 +387,6 @@ struct si_shader_info { unsigned num_written_culldistance; unsigned num_written_clipdistance; - unsigned images_declared; /**< bitmask of declared images */ - /** 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 76c6becd271..dfff2d2efef 100644 --- a/src/gallium/drivers/radeonsi/si_shader_nir.c +++ b/src/gallium/drivers/radeonsi/si_shader_nir.c @@ -480,7 +480,6 @@ void si_nir_scan_shader(const struct nir_shader *nir, struct si_shader_info *inf info->constbuf0_num_slots = nir->num_uniforms; info->const_buffers_declared = u_bit_consecutive(0, nir->info.num_ubos); - info->images_declared = u_bit_consecutive(0, nir->info.num_images); info->num_written_clipdistance = nir->info.clip_distance_array_size; info->num_written_culldistance = nir->info.cull_distance_array_size; diff --git a/src/gallium/drivers/radeonsi/si_state_draw.c b/src/gallium/drivers/radeonsi/si_state_draw.c index c6241866f9e..224ad8e6dae 100644 --- a/src/gallium/drivers/radeonsi/si_state_draw.c +++ b/src/gallium/drivers/radeonsi/si_state_draw.c @@ -1563,9 +1563,8 @@ static bool si_all_vs_resources_read_only(struct si_context *sctx, struct pipe_r } /* Images. */ - if (vs->info.images_declared) { - unsigned num_images = util_last_bit(vs->info.images_declared); - + unsigned num_images = vs->info.base.num_images; + if (num_images) { for (unsigned i = 0; i < num_images; i++) { struct pipe_resource *res = sctx->images[PIPE_SHADER_VERTEX].views[i].resource; if (!res) diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c index 0d41c9726d1..f1caca97e77 100644 --- a/src/gallium/drivers/radeonsi/si_state_shaders.c +++ b/src/gallium/drivers/radeonsi/si_state_shaders.c @@ -2546,7 +2546,7 @@ void si_get_active_slot_masks(const struct si_shader_info *info, uint64_t *const num_shaderbufs = info->base.num_ssbos; num_constbufs = util_last_bit(info->const_buffers_declared); /* two 8-byte images share one 16-byte slot */ - num_images = align(util_last_bit(info->images_declared), 2); + num_images = align(info->base.num_images, 2); num_msaa_images = align(util_last_bit(info->base.msaa_images), 2); num_samplers = util_last_bit(info->base.textures_used); -- 2.30.2