radeonsi: remove redundant si_shader_info::images_declared
authorMarek Olšák <marek.olsak@amd.com>
Sun, 6 Sep 2020 06:15:51 +0000 (02:15 -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_compute.c
src/gallium/drivers/radeonsi/si_debug.c
src/gallium/drivers/radeonsi/si_descriptors.c
src/gallium/drivers/radeonsi/si_shader.c
src/gallium/drivers/radeonsi/si_shader.h
src/gallium/drivers/radeonsi/si_shader_nir.c
src/gallium/drivers/radeonsi/si_state_draw.c
src/gallium/drivers/radeonsi/si_state_shaders.c

index 8dc7360066199ca587de3e0c16b8c8646d7f8d02..3987ecdc66d234dd8c42d4829e1b620470a0c5ef 100644 (file)
@@ -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;
index e39ce2f584d15a6ccc277b6d3f56185c7cd41d6a..8fc7e4e088e18f3aaa438d91de4c34f5ace63d70 100644 (file)
@@ -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;
index 62bf78ea45a4e3183c92d70725656a4e4d6dbebf..0d1abe19c05252dc8d0a30eed473a8f6c2bcb76c 100644 (file)
@@ -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);
 }
 
index ca5e485f2c4240cdb43ad3689ae729d620927777..08bc677bc00dcb01286a189cb5f6afa0fab3b871 100644 (file)
@@ -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);
 
index 9465729dc64dd6d71017b5391d0e87cf984fafcf..1d85d05381745c94d9c4901ca9c8f41cdb005fd4 100644 (file)
@@ -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;
 };
index 76c6becd2718a6f7ab33bd54350c907fcf25b686..dfff2d2efef475e6ccd79d62af6ac2beda6b6380 100644 (file)
@@ -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;
index c6241866f9e9488f1f53f1c09ce0fd72638a9efb..224ad8e6dae909b8574f6c305a43274e2b4ebce0 100644 (file)
@@ -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)
index 0d41c9726d1e0a14a8773c15e501d4934714ccb3..f1caca97e773d7d3c84e595082892c4fd56a30c6 100644 (file)
@@ -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);