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 <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
This commit is contained in:
Samuel Pitoiset 2017-12-14 12:51:07 +01:00
parent 97e57740d8
commit 2e58ef46a8
3 changed files with 6 additions and 5 deletions

View file

@ -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);
}

View file

@ -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;

View file

@ -42,7 +42,7 @@ struct ac_shader_info {
bool uses_input_attachments;
} ps;
struct {
uint8_t grid_components_used;
bool uses_grid_size;
} cs;
};