From: Marek Olšák Date: Sun, 6 Sep 2020 06:15:51 +0000 (-0400) Subject: radeonsi: remove redundant si_shader_info::shader_buffers_declared X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5fd2cfb71b6ce04af408f366af7189b89dea7a61;p=mesa.git radeonsi: remove redundant si_shader_info::shader_buffers_declared Reviewed-by: Pierre-Eric Pelloux-Prayer Part-of: --- diff --git a/src/gallium/drivers/radeonsi/si_compute.c b/src/gallium/drivers/radeonsi/si_compute.c index 7bb24a0df67..8dc73600661 100644 --- a/src/gallium/drivers/radeonsi/si_compute.c +++ b/src/gallium/drivers/radeonsi/si_compute.c @@ -143,7 +143,7 @@ static void si_create_compute_state_async(void *job, int thread_index) /* Fast path for compute shaders - some descriptors passed via user SGPRs. */ /* Shader buffers in user SGPRs. */ - for (unsigned i = 0; i < 3 && user_sgprs <= 12 && sel->info.shader_buffers_declared & (1 << i); i++) { + for (unsigned i = 0; i < MIN2(3, sel->info.base.num_ssbos) && user_sgprs <= 12; i++) { user_sgprs = align(user_sgprs, 4); if (i == 0) sel->cs_shaderbufs_sgpr_index = user_sgprs; diff --git a/src/gallium/drivers/radeonsi/si_compute_prim_discard.c b/src/gallium/drivers/radeonsi/si_compute_prim_discard.c index dd764b8dee1..d91a1e5db26 100644 --- a/src/gallium/drivers/radeonsi/si_compute_prim_discard.c +++ b/src/gallium/drivers/radeonsi/si_compute_prim_discard.c @@ -309,7 +309,7 @@ void si_build_prim_discard_compute_shader(struct si_shader_context *ctx) enum ac_arg_type const_desc_type; if (ctx->shader->selector->info.const_buffers_declared == 1 && - ctx->shader->selector->info.shader_buffers_declared == 0) + ctx->shader->selector->info.base.num_ssbos == 0) const_desc_type = AC_ARG_CONST_FLOAT_PTR; else const_desc_type = AC_ARG_CONST_DESC_PTR; diff --git a/src/gallium/drivers/radeonsi/si_debug.c b/src/gallium/drivers/radeonsi/si_debug.c index 14f3305093a..e39ce2f584d 100644 --- a/src/gallium/drivers/radeonsi/si_debug.c +++ b/src/gallium/drivers/radeonsi/si_debug.c @@ -790,7 +790,7 @@ static void si_dump_descriptors(struct si_context *sctx, gl_shader_stage stage, if (info) { enabled_constbuf = info->const_buffers_declared; - enabled_shaderbuf = info->shader_buffers_declared; + enabled_shaderbuf = u_bit_consecutive(0, info->base.num_ssbos); enabled_samplers = info->base.textures_used; enabled_images = info->images_declared; } else { diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index 057829599af..ca5e485f2c4 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -230,7 +230,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 && - ctx->shader->selector->info.shader_buffers_declared == 0) + ctx->shader->selector->info.base.num_ssbos == 0) const_shader_buf_type = AC_ARG_CONST_FLOAT_PTR; else const_shader_buf_type = AC_ARG_CONST_DESC_PTR; @@ -1343,7 +1343,7 @@ static bool si_build_main_function(struct si_shader_context *ctx, struct si_shad ctx->stage = sel->info.stage; ctx->num_const_buffers = util_last_bit(info->const_buffers_declared); - ctx->num_shader_buffers = util_last_bit(info->shader_buffers_declared); + 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); diff --git a/src/gallium/drivers/radeonsi/si_shader.h b/src/gallium/drivers/radeonsi/si_shader.h index 5def41a3593..9465729dc64 100644 --- a/src/gallium/drivers/radeonsi/si_shader.h +++ b/src/gallium/drivers/radeonsi/si_shader.h @@ -388,7 +388,6 @@ struct si_shader_info { unsigned num_written_clipdistance; unsigned images_declared; /**< bitmask of declared images */ - unsigned shader_buffers_declared; /**< bitmask of declared shader buffers */ /** 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_llvm_resources.c b/src/gallium/drivers/radeonsi/si_shader_llvm_resources.c index ebde256c9b0..c78e77b187d 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.shader_buffers_declared == 0) { + if (sel->info.const_buffers_declared == 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 067c7768dde..76c6becd271 100644 --- a/src/gallium/drivers/radeonsi/si_shader_nir.c +++ b/src/gallium/drivers/radeonsi/si_shader_nir.c @@ -479,7 +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->shader_buffers_declared = u_bit_consecutive(0, nir->info.num_ssbos); info->const_buffers_declared = u_bit_consecutive(0, nir->info.num_ubos); info->images_declared = u_bit_consecutive(0, nir->info.num_images); diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c index e601e9f577d..0d41c9726d1 100644 --- a/src/gallium/drivers/radeonsi/si_state_shaders.c +++ b/src/gallium/drivers/radeonsi/si_state_shaders.c @@ -2543,7 +2543,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 = util_last_bit(info->shader_buffers_declared); + 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);