summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/amd/common/ac_nir_to_llvm.c12
-rw-r--r--src/amd/common/ac_shader_info.c8
-rw-r--r--src/amd/common/ac_shader_info.h1
3 files changed, 11 insertions, 10 deletions
diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
index f8543563293..b3e522dd732 100644
--- a/src/amd/common/ac_nir_to_llvm.c
+++ b/src/amd/common/ac_nir_to_llvm.c
@@ -565,7 +565,6 @@ static void create_function(struct nir_to_llvm_context *ctx)
unsigned i;
unsigned num_sets = ctx->options->layout ? ctx->options->layout->num_sets : 0;
unsigned user_sgpr_idx;
- bool need_push_constants;
bool need_ring_offsets = false;
/* until we sort out scratch/global buffers always assign ring offsets for gs/vs/es */
@@ -577,13 +576,6 @@ static void create_function(struct nir_to_llvm_context *ctx)
ctx->is_gs_copy_shader)
need_ring_offsets = true;
- need_push_constants = true;
- if (!ctx->options->layout)
- need_push_constants = false;
- else if (!ctx->options->layout->push_constant_size &&
- !ctx->options->layout->dynamic_offset_count)
- need_push_constants = false;
-
if (need_ring_offsets && !ctx->options->supports_spill) {
arg_types[arg_idx++] = const_array(ctx->v16i8, 16); /* address of rings */
}
@@ -596,7 +588,7 @@ static void create_function(struct nir_to_llvm_context *ctx)
}
}
- if (need_push_constants) {
+ if (ctx->shader_info->info.needs_push_constants) {
/* 1 for push constants and dynamic descriptors */
array_params_mask |= (1 << arg_idx);
arg_types[arg_idx++] = const_array(ctx->i8, 1024 * 1024);
@@ -755,7 +747,7 @@ static void create_function(struct nir_to_llvm_context *ctx)
ctx->descriptor_sets[i] = NULL;
}
- if (need_push_constants) {
+ if (ctx->shader_info->info.needs_push_constants) {
ctx->push_constants = LLVMGetParam(ctx->main_function, arg_idx++);
set_userdata_location_shader(ctx, AC_UD_PUSH_CONSTANTS, user_sgpr_idx, 2);
user_sgpr_idx += 2;
diff --git a/src/amd/common/ac_shader_info.c b/src/amd/common/ac_shader_info.c
index ef3692563b2..79c13767f67 100644
--- a/src/amd/common/ac_shader_info.c
+++ b/src/amd/common/ac_shader_info.c
@@ -76,6 +76,14 @@ ac_nir_shader_info_pass(struct nir_shader *nir,
struct ac_shader_info *info)
{
struct nir_function *func = (struct nir_function *)exec_list_get_head(&nir->functions);
+
+ info->needs_push_constants = true;
+ if (!options->layout)
+ info->needs_push_constants = false;
+ else if (!options->layout->push_constant_size &&
+ !options->layout->dynamic_offset_count)
+ info->needs_push_constants = false;
+
nir_foreach_variable(variable, &nir->inputs)
gather_info_input_decl(nir, options, variable, info);
diff --git a/src/amd/common/ac_shader_info.h b/src/amd/common/ac_shader_info.h
index ed97d06d56b..32153fb67fc 100644
--- a/src/amd/common/ac_shader_info.h
+++ b/src/amd/common/ac_shader_info.h
@@ -28,6 +28,7 @@ struct ac_nir_compiler_options;
/* a NIR pass to gather all the info needed to optimise the alloction patterns for the RADV user sgprs */
struct ac_shader_info {
+ bool needs_push_constants;
struct {
bool has_vertex_buffers; /* needs vertex buffers and base/start */
bool needs_draw_id;