radeonsi: remove redundant si_shader_info::const_buffers_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_prim_discard.c
src/gallium/drivers/radeonsi/si_debug.c
src/gallium/drivers/radeonsi/si_shader.c
src/gallium/drivers/radeonsi/si_shader.h
src/gallium/drivers/radeonsi/si_shader_llvm_resources.c
src/gallium/drivers/radeonsi/si_shader_nir.c
src/gallium/drivers/radeonsi/si_state_shaders.c

index d91a1e5db262402673cbb048fe541d8c942b48eb..6cb461fbf53038a3f0f63f86753935aa98c65f51 100644 (file)
@@ -308,7 +308,7 @@ void si_build_prim_discard_compute_shader(struct si_shader_context *ctx)
    LLVMSetLinkage(vs, LLVMPrivateLinkage);
 
    enum ac_arg_type const_desc_type;
-   if (ctx->shader->selector->info.const_buffers_declared == 1 &&
+   if (ctx->shader->selector->info.base.num_ubos == 1 &&
        ctx->shader->selector->info.base.num_ssbos == 0)
       const_desc_type = AC_ARG_CONST_FLOAT_PTR;
    else
index 8fc7e4e088e18f3aaa438d91de4c34f5ace63d70..e5ae5e64d3c3048a227dbab5ea2d66b0a815566e 100644 (file)
@@ -789,7 +789,7 @@ static void si_dump_descriptors(struct si_context *sctx, gl_shader_stage stage,
    unsigned enabled_images;
 
    if (info) {
-      enabled_constbuf = info->const_buffers_declared;
+      enabled_constbuf = u_bit_consecutive(0, info->base.num_ubos);
       enabled_shaderbuf = u_bit_consecutive(0, info->base.num_ssbos);
       enabled_samplers = info->base.textures_used;
       enabled_images = u_bit_consecutive(0, info->base.num_images);
index 08bc677bc00dcb01286a189cb5f6afa0fab3b871..084ae587ae153f171b3f647f40d5923e99e04d6f 100644 (file)
@@ -229,7 +229,7 @@ static void declare_const_and_shader_buffers(struct si_shader_context *ctx, bool
 {
    enum ac_arg_type const_shader_buf_type;
 
-   if (ctx->shader->selector->info.const_buffers_declared == 1 &&
+   if (ctx->shader->selector->info.base.num_ubos == 1 &&
        ctx->shader->selector->info.base.num_ssbos == 0)
       const_shader_buf_type = AC_ARG_CONST_FLOAT_PTR;
    else
@@ -1342,7 +1342,7 @@ static bool si_build_main_function(struct si_shader_context *ctx, struct si_shad
    ctx->shader = shader;
    ctx->stage = sel->info.stage;
 
-   ctx->num_const_buffers = util_last_bit(info->const_buffers_declared);
+   ctx->num_const_buffers = info->base.num_ubos;
    ctx->num_shader_buffers = info->base.num_ssbos;
 
    ctx->num_samplers = util_last_bit(info->base.textures_used);
index 1d85d05381745c94d9c4901ca9c8f41cdb005fd4..a6cf898bf7098aaedd5771e4bbb82e9e6167dcf7 100644 (file)
@@ -335,7 +335,6 @@ struct si_shader_info {
    ubyte color_interpolate_loc[2];
 
    int constbuf0_num_slots;
-   unsigned const_buffers_declared; /**< bitmask of declared const buffers */
    ubyte num_stream_output_components[4];
 
    uint num_memory_instructions; /**< sampler, buffer, and image instructions */
index c78e77b187dfa28b2f5fbfac3b6c992d249d7ea7..9ba8e187ad04b2c60ae49d149e0fa2a643ccc29e 100644 (file)
@@ -93,7 +93,7 @@ static LLVMValueRef load_ubo(struct ac_shader_abi *abi, LLVMValueRef index)
 
    LLVMValueRef ptr = ac_get_arg(&ctx->ac, ctx->const_and_shader_buffers);
 
-   if (sel->info.const_buffers_declared == 1 && sel->info.base.num_ssbos == 0) {
+   if (sel->info.base.num_ubos == 1 && sel->info.base.num_ssbos == 0) {
       return load_const_buffer_desc_fast_path(ctx);
    }
 
index dfff2d2efef475e6ccd79d62af6ac2beda6b6380..443a52bbac8c8f48987e47267ffb1b42f313d27d 100644 (file)
@@ -479,8 +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->const_buffers_declared = u_bit_consecutive(0, nir->info.num_ubos);
-
    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);
index f1caca97e773d7d3c84e595082892c4fd56a30c6..c4336191953073b788b6f3d6af5121b5d7f3a277 100644 (file)
@@ -2544,7 +2544,7 @@ void si_get_active_slot_masks(const struct si_shader_info *info, uint64_t *const
    unsigned start, num_shaderbufs, num_constbufs, num_images, num_msaa_images, num_samplers;
 
    num_shaderbufs = info->base.num_ssbos;
-   num_constbufs = util_last_bit(info->const_buffers_declared);
+   num_constbufs = info->base.num_ubos;
    /* two 8-byte images share one 16-byte slot */
    num_images = align(info->base.num_images, 2);
    num_msaa_images = align(util_last_bit(info->base.msaa_images), 2);