aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSamuel Pitoiset <[email protected]>2018-01-09 18:09:43 +0100
committerSamuel Pitoiset <[email protected]>2018-01-10 12:31:54 +0100
commitd43f50c00b8172abd0c9e934c3e193bdc85b5089 (patch)
tree450fbbfbe553ea95826d5fc1a24d342b5ab702f2 /src
parent4e701cf75c89dbe8dd731698f2652beb7863e69b (diff)
amd/common: do not rely on the pipeline for the push constants logic
It makes more sense to rely on nir_intrinsic_load_push_constant instead of the pipeline layout. Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/amd/common/ac_nir_to_llvm.c6
-rw-r--r--src/amd/common/ac_shader_info.c10
-rw-r--r--src/amd/common/ac_shader_info.h2
3 files changed, 9 insertions, 9 deletions
diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
index 34ab0a4a36e..840d27e7a8e 100644
--- a/src/amd/common/ac_nir_to_llvm.c
+++ b/src/amd/common/ac_nir_to_llvm.c
@@ -597,7 +597,7 @@ static void allocate_user_sgprs(struct nir_to_llvm_context *ctx,
break;
}
- if (ctx->shader_info->info.needs_push_constants)
+ if (ctx->shader_info->info.loads_push_constants)
user_sgpr_info->sgpr_count += 2;
uint32_t remaining_sgprs = 16 - user_sgpr_info->sgpr_count;
@@ -638,7 +638,7 @@ declare_global_input_sgprs(struct nir_to_llvm_context *ctx,
add_array_arg(args, const_array(type, 32), desc_sets);
}
- if (ctx->shader_info->info.needs_push_constants) {
+ if (ctx->shader_info->info.loads_push_constants) {
/* 1 for push constants and dynamic descriptors */
add_array_arg(args, type, &ctx->push_constants);
}
@@ -729,7 +729,7 @@ set_global_input_locs(struct nir_to_llvm_context *ctx, gl_shader_stage stage,
ctx->shader_info->need_indirect_descriptor_sets = true;
}
- if (ctx->shader_info->info.needs_push_constants) {
+ if (ctx->shader_info->info.loads_push_constants) {
set_loc_shader(ctx, AC_UD_PUSH_CONSTANTS, user_sgpr_idx, 2);
}
}
diff --git a/src/amd/common/ac_shader_info.c b/src/amd/common/ac_shader_info.c
index 27896a26bb4..443980c7d12 100644
--- a/src/amd/common/ac_shader_info.c
+++ b/src/amd/common/ac_shader_info.c
@@ -76,6 +76,9 @@ gather_intrinsic_info(nir_intrinsic_instr *instr, struct ac_shader_info *info)
case nir_intrinsic_load_primitive_id:
info->uses_prim_id = true;
break;
+ case nir_intrinsic_load_push_constant:
+ info->loads_push_constants = true;
+ break;
case nir_intrinsic_vulkan_resource_index:
info->desc_set_used_mask |= (1 << nir_intrinsic_desc_set(instr));
break;
@@ -154,11 +157,8 @@ ac_nir_shader_info_pass(struct nir_shader *nir,
{
struct nir_function *func = (struct nir_function *)exec_list_get_head(&nir->functions);
- info->needs_push_constants = false;
- if ((options->layout->push_constant_size &&
- options->layout->push_constant_stages & (1 << nir->info.stage)) ||
- options->layout->dynamic_offset_count)
- info->needs_push_constants = true;
+ if (options->layout->dynamic_offset_count)
+ info->loads_push_constants = true;
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 437859f8910..9c9a8473a4c 100644
--- a/src/amd/common/ac_shader_info.h
+++ b/src/amd/common/ac_shader_info.h
@@ -28,7 +28,7 @@ struct nir_shader;
struct ac_nir_compiler_options;
struct ac_shader_info {
- bool needs_push_constants;
+ bool loads_push_constants;
uint32_t desc_set_used_mask;
bool needs_multiview_view_index;
bool uses_invocation_id;