From: Marek Olšák Date: Sun, 6 Sep 2020 06:10:33 +0000 (-0400) Subject: radeonsi: remove info::samplers_declared, image_buffers, msaa_images_declared X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0ac84fceb401f513ef8c49bdf05e34419220e5c8;p=mesa.git radeonsi: remove info::samplers_declared, image_buffers, msaa_images_declared They are redundant with shader_info. 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 55aebf8f606..7bb24a0df67 100644 --- a/src/gallium/drivers/radeonsi/si_compute.c +++ b/src/gallium/drivers/radeonsi/si_compute.c @@ -152,10 +152,10 @@ 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.msaa_images_declared; + unsigned non_msaa_images = sel->info.images_declared & ~sel->info.base.msaa_images; for (unsigned i = 0; i < 3 && non_msaa_images & (1 << i); i++) { - unsigned num_sgprs = sel->info.image_buffers & (1 << i) ? 4 : 8; + unsigned num_sgprs = sel->info.base.image_buffers & (1 << i) ? 4 : 8; if (align(user_sgprs, num_sgprs) + num_sgprs > 16) break; diff --git a/src/gallium/drivers/radeonsi/si_debug.c b/src/gallium/drivers/radeonsi/si_debug.c index 11b207f18ed..14f3305093a 100644 --- a/src/gallium/drivers/radeonsi/si_debug.c +++ b/src/gallium/drivers/radeonsi/si_debug.c @@ -791,7 +791,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_samplers = info->samplers_declared; + enabled_samplers = info->base.textures_used; enabled_images = info->images_declared; } else { enabled_constbuf = diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c b/src/gallium/drivers/radeonsi/si_descriptors.c index 27f2258d1f6..62bf78ea45a 100644 --- a/src/gallium/drivers/radeonsi/si_descriptors.c +++ b/src/gallium/drivers/radeonsi/si_descriptors.c @@ -2210,7 +2210,7 @@ void si_emit_compute_shader_pointers(struct si_context *sctx) unsigned num_sgprs = 8; /* Image buffers are in desc[4..7]. */ - if (shader->info.image_buffers & (1 << i)) { + if (shader->info.base.image_buffers & (1 << i)) { desc_offset += 4; num_sgprs = 4; } @@ -2803,7 +2803,7 @@ bool si_gfx_resources_check_encrypted(struct si_context *sctx) si_buffer_resources_check_encrypted(sctx, &sctx->const_and_shader_buffers[i]); use_encrypted_bo |= si_sampler_views_check_encrypted(sctx, &sctx->samplers[i], - current_shader[i]->cso->info.samplers_declared); + 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); } @@ -2857,7 +2857,7 @@ bool si_compute_resources_check_encrypted(struct si_context *sctx) * or all writable buffers are encrypted. */ return si_buffer_resources_check_encrypted(sctx, &sctx->const_and_shader_buffers[sh]) || - si_sampler_views_check_encrypted(sctx, &sctx->samplers[sh], info->samplers_declared) || + 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_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 f10195febd4..057829599af 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -715,7 +715,7 @@ void si_create_function(struct si_shader_context *ctx, bool ngg_cull_shader) } /* Images in user SGPRs. */ for (unsigned i = 0; i < shader->selector->cs_num_images_in_user_sgprs; i++) { - unsigned num_sgprs = shader->selector->info.image_buffers & (1 << i) ? 4 : 8; + unsigned num_sgprs = shader->selector->info.base.image_buffers & (1 << i) ? 4 : 8; while (ctx->args.num_sgprs_used % num_sgprs != 0) ac_add_arg(&ctx->args, AC_ARG_SGPR, 1, AC_ARG_INT, NULL); @@ -1345,7 +1345,7 @@ static bool si_build_main_function(struct si_shader_context *ctx, struct si_shad ctx->num_const_buffers = util_last_bit(info->const_buffers_declared); ctx->num_shader_buffers = util_last_bit(info->shader_buffers_declared); - ctx->num_samplers = util_last_bit(info->samplers_declared); + ctx->num_samplers = util_last_bit(info->base.textures_used); ctx->num_images = util_last_bit(info->images_declared); 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 80369a6e7e9..5def41a3593 100644 --- a/src/gallium/drivers/radeonsi/si_shader.h +++ b/src/gallium/drivers/radeonsi/si_shader.h @@ -336,7 +336,6 @@ struct si_shader_info { int constbuf0_num_slots; unsigned const_buffers_declared; /**< bitmask of declared const buffers */ - unsigned samplers_declared; /**< bitmask of declared samplers */ ubyte num_stream_output_components[4]; uint num_memory_instructions; /**< sampler, buffer, and image instructions */ @@ -389,8 +388,6 @@ struct si_shader_info { unsigned num_written_clipdistance; unsigned images_declared; /**< bitmask of declared images */ - unsigned image_buffers; /**< bitmask of images that are buffers */ - unsigned msaa_images_declared; /**< bitmask of declared MSAA images */ unsigned shader_buffers_declared; /**< bitmask of declared shader buffers */ /** Whether all codepaths write tess factors in all invocations. */ diff --git a/src/gallium/drivers/radeonsi/si_shader_nir.c b/src/gallium/drivers/radeonsi/si_shader_nir.c index 3eb3cd5ad89..067c7768dde 100644 --- a/src/gallium/drivers/radeonsi/si_shader_nir.c +++ b/src/gallium/drivers/radeonsi/si_shader_nir.c @@ -250,9 +250,7 @@ static void scan_instruction(const struct nir_shader *nir, struct si_shader_info const nir_deref_instr *deref = tex_get_texture_deref(tex); nir_variable *var = deref ? nir_deref_instr_get_variable(deref) : NULL; - if (!var) { - info->samplers_declared |= u_bit_consecutive(tex->sampler_index, 1); - } else { + if (var) { if (deref->mode != nir_var_uniform || var->data.bindless) info->uses_bindless_samplers = true; } @@ -484,9 +482,6 @@ void si_nir_scan_shader(const struct nir_shader *nir, struct si_shader_info *inf 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); - info->msaa_images_declared = nir->info.msaa_images; - info->image_buffers = nir->info.image_buffers; - info->samplers_declared = nir->info.textures_used; 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 7d87dd5f1ff..c6241866f9e 100644 --- a/src/gallium/drivers/radeonsi/si_state_draw.c +++ b/src/gallium/drivers/radeonsi/si_state_draw.c @@ -1549,8 +1549,8 @@ static bool si_all_vs_resources_read_only(struct si_context *sctx, struct pipe_r /* Samplers. */ struct si_shader_selector *vs = sctx->vs_shader.cso; - if (vs->info.samplers_declared) { - unsigned num_samplers = util_last_bit(vs->info.samplers_declared); + if (vs->info.base.textures_used) { + unsigned num_samplers = util_last_bit(vs->info.base.textures_used); for (unsigned i = 0; i < num_samplers; i++) { struct pipe_sampler_view *view = sctx->samplers[PIPE_SHADER_VERTEX].views[i]; diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c index 8e579d865f4..e601e9f577d 100644 --- a/src/gallium/drivers/radeonsi/si_state_shaders.c +++ b/src/gallium/drivers/radeonsi/si_state_shaders.c @@ -2547,8 +2547,8 @@ void si_get_active_slot_masks(const struct si_shader_info *info, uint64_t *const 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_msaa_images = align(util_last_bit(info->msaa_images_declared), 2); - num_samplers = util_last_bit(info->samplers_declared); + num_msaa_images = align(util_last_bit(info->base.msaa_images), 2); + num_samplers = util_last_bit(info->base.textures_used); /* The layout is: sb[last] ... sb[0], cb[0] ... cb[last] */ start = si_get_shaderbuf_slot(num_shaderbufs - 1);