From 3951bdfe5e6f4e8fc26b7b321a2ff62b2fef7648 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::const_buffers_declared Reviewed-by: Pierre-Eric Pelloux-Prayer Part-of: --- src/gallium/drivers/radeonsi/si_compute_prim_discard.c | 2 +- src/gallium/drivers/radeonsi/si_debug.c | 2 +- src/gallium/drivers/radeonsi/si_shader.c | 4 ++-- src/gallium/drivers/radeonsi/si_shader.h | 1 - src/gallium/drivers/radeonsi/si_shader_llvm_resources.c | 2 +- src/gallium/drivers/radeonsi/si_shader_nir.c | 2 -- src/gallium/drivers/radeonsi/si_state_shaders.c | 2 +- 7 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/gallium/drivers/radeonsi/si_compute_prim_discard.c b/src/gallium/drivers/radeonsi/si_compute_prim_discard.c index d91a1e5db26..6cb461fbf53 100644 --- a/src/gallium/drivers/radeonsi/si_compute_prim_discard.c +++ b/src/gallium/drivers/radeonsi/si_compute_prim_discard.c @@ -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 diff --git a/src/gallium/drivers/radeonsi/si_debug.c b/src/gallium/drivers/radeonsi/si_debug.c index 8fc7e4e088e..e5ae5e64d3c 100644 --- a/src/gallium/drivers/radeonsi/si_debug.c +++ b/src/gallium/drivers/radeonsi/si_debug.c @@ -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); diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index 08bc677bc00..084ae587ae1 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -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); diff --git a/src/gallium/drivers/radeonsi/si_shader.h b/src/gallium/drivers/radeonsi/si_shader.h index 1d85d053817..a6cf898bf70 100644 --- a/src/gallium/drivers/radeonsi/si_shader.h +++ b/src/gallium/drivers/radeonsi/si_shader.h @@ -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 */ diff --git a/src/gallium/drivers/radeonsi/si_shader_llvm_resources.c b/src/gallium/drivers/radeonsi/si_shader_llvm_resources.c index c78e77b187d..9ba8e187ad0 100644 --- a/src/gallium/drivers/radeonsi/si_shader_llvm_resources.c +++ b/src/gallium/drivers/radeonsi/si_shader_llvm_resources.c @@ -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); } diff --git a/src/gallium/drivers/radeonsi/si_shader_nir.c b/src/gallium/drivers/radeonsi/si_shader_nir.c index dfff2d2efef..443a52bbac8 100644 --- a/src/gallium/drivers/radeonsi/si_shader_nir.c +++ b/src/gallium/drivers/radeonsi/si_shader_nir.c @@ -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); diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c index f1caca97e77..c4336191953 100644 --- a/src/gallium/drivers/radeonsi/si_state_shaders.c +++ b/src/gallium/drivers/radeonsi/si_state_shaders.c @@ -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); -- 2.30.2