aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Pitoiset <[email protected]>2017-12-14 12:51:07 +0100
committerSamuel Pitoiset <[email protected]>2017-12-14 22:19:42 +0100
commit2e58ef46a8f31888b6507de81d7c48ac6e57b2e9 (patch)
tree8e59fc8af72ff05b234c0ae15a5ce85f1a159f65
parent97e57740d852aee282d5902de5a63c32071473da (diff)
radv: replace grid_components_used by uses_grid_size
Use a boolean instead because the number of needed SGPRs is always 3. Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]>
-rw-r--r--src/amd/common/ac_nir_to_llvm.c7
-rw-r--r--src/amd/common/ac_shader_info.c2
-rw-r--r--src/amd/common/ac_shader_info.h2
3 files changed, 6 insertions, 5 deletions
diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
index ce25e57eba7..0e1d7e0082f 100644
--- a/src/amd/common/ac_nir_to_llvm.c
+++ b/src/amd/common/ac_nir_to_llvm.c
@@ -576,7 +576,8 @@ static void allocate_user_sgprs(struct nir_to_llvm_context *ctx,
switch (ctx->stage) {
case MESA_SHADER_COMPUTE:
- user_sgpr_info->sgpr_count += ctx->shader_info->info.cs.grid_components_used;
+ if (ctx->shader_info->info.cs.uses_grid_size)
+ user_sgpr_info->sgpr_count += 3;
break;
case MESA_SHADER_FRAGMENT:
user_sgpr_info->sgpr_count += ctx->shader_info->info.ps.needs_sample_positions;
@@ -745,7 +746,7 @@ static void create_function(struct nir_to_llvm_context *ctx,
switch (stage) {
case MESA_SHADER_COMPUTE:
radv_define_common_user_sgprs_phase1(ctx, stage, has_previous_stage, previous_stage, &user_sgpr_info, &args, &desc_sets);
- if (ctx->shader_info->info.cs.grid_components_used) {
+ if (ctx->shader_info->info.cs.uses_grid_size) {
add_user_sgpr_argument(&args, ctx->ac.v3i32,
&ctx->num_work_groups);
}
@@ -951,7 +952,7 @@ static void create_function(struct nir_to_llvm_context *ctx,
switch (stage) {
case MESA_SHADER_COMPUTE:
- if (ctx->shader_info->info.cs.grid_components_used) {
+ if (ctx->shader_info->info.cs.uses_grid_size) {
set_userdata_location_shader(ctx, AC_UD_CS_GRID_SIZE,
&user_sgpr_idx, 3);
}
diff --git a/src/amd/common/ac_shader_info.c b/src/amd/common/ac_shader_info.c
index 53e584065ce..09dd4bbd558 100644
--- a/src/amd/common/ac_shader_info.c
+++ b/src/amd/common/ac_shader_info.c
@@ -43,7 +43,7 @@ gather_intrinsic_info(nir_intrinsic_instr *instr, struct ac_shader_info *info)
info->vs.needs_instance_id = true;
break;
case nir_intrinsic_load_num_work_groups:
- info->cs.grid_components_used = instr->num_components;
+ info->cs.uses_grid_size = true;
break;
case nir_intrinsic_load_sample_id:
info->ps.force_persample = true;
diff --git a/src/amd/common/ac_shader_info.h b/src/amd/common/ac_shader_info.h
index c1d36a667ee..3c809cce13a 100644
--- a/src/amd/common/ac_shader_info.h
+++ b/src/amd/common/ac_shader_info.h
@@ -42,7 +42,7 @@ struct ac_shader_info {
bool uses_input_attachments;
} ps;
struct {
- uint8_t grid_components_used;
+ bool uses_grid_size;
} cs;
};