diff options
author | Samuel Pitoiset <[email protected]> | 2017-12-20 20:56:04 +0100 |
---|---|---|
committer | Samuel Pitoiset <[email protected]> | 2017-12-27 10:25:11 +0100 |
commit | f8202ef6839056b6ffa112ff4250eb113c2fa154 (patch) | |
tree | 5412bdd03153f8f5f6766c9105cb827e9c2e5c70 /src | |
parent | 9d5a1787eeadce3d3f8bf9e58413b9dd732a18b2 (diff) |
amd/common: rename radv_define_vs_user_sgprs_phase2()
... to set_vs_specific_input_locs().
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.c | 55 |
1 files changed, 33 insertions, 22 deletions
diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c index d4ddb517d40..d8289dea37b 100644 --- a/src/amd/common/ac_nir_to_llvm.c +++ b/src/amd/common/ac_nir_to_llvm.c @@ -603,25 +603,6 @@ static void allocate_user_sgprs(struct nir_to_llvm_context *ctx, } static void -radv_define_vs_user_sgprs_phase2(struct nir_to_llvm_context *ctx, - gl_shader_stage stage, - bool has_previous_stage, - gl_shader_stage previous_stage, - uint8_t *user_sgpr_idx) -{ - if (!ctx->is_gs_copy_shader && (stage == MESA_SHADER_VERTEX || (has_previous_stage && previous_stage == MESA_SHADER_VERTEX))) { - if (ctx->shader_info->info.vs.has_vertex_buffers) { - set_userdata_location_shader(ctx, AC_UD_VS_VERTEX_BUFFERS, user_sgpr_idx, 2); - } - unsigned vs_num = 2; - if (ctx->shader_info->info.vs.needs_draw_id) - vs_num++; - - set_userdata_location_shader(ctx, AC_UD_VS_BASE_VERTEX_START_INSTANCE, user_sgpr_idx, vs_num); - } -} - -static void declare_global_input_sgprs(struct nir_to_llvm_context *ctx, gl_shader_stage stage, bool has_previous_stage, @@ -746,6 +727,31 @@ set_global_input_locs(struct nir_to_llvm_context *ctx, gl_shader_stage stage, } } +static void +set_vs_specific_input_locs(struct nir_to_llvm_context *ctx, + gl_shader_stage stage, bool has_previous_stage, + gl_shader_stage previous_stage, + uint8_t *user_sgpr_idx) +{ + if (!ctx->is_gs_copy_shader && + (stage == MESA_SHADER_VERTEX || + (has_previous_stage && previous_stage == MESA_SHADER_VERTEX))) { + if (ctx->shader_info->info.vs.has_vertex_buffers) { + set_userdata_location_shader(ctx, + AC_UD_VS_VERTEX_BUFFERS, + user_sgpr_idx, 2); + } + + unsigned vs_num = 2; + if (ctx->shader_info->info.vs.needs_draw_id) + vs_num++; + + set_userdata_location_shader(ctx, + AC_UD_VS_BASE_VERTEX_START_INSTANCE, + user_sgpr_idx, vs_num); + } +} + static void create_function(struct nir_to_llvm_context *ctx, gl_shader_stage stage, bool has_previous_stage, @@ -1061,7 +1067,8 @@ static void create_function(struct nir_to_llvm_context *ctx, } break; case MESA_SHADER_VERTEX: - radv_define_vs_user_sgprs_phase2(ctx, stage, has_previous_stage, previous_stage, &user_sgpr_idx); + set_vs_specific_input_locs(ctx, stage, has_previous_stage, + previous_stage, &user_sgpr_idx); if (ctx->view_index) set_userdata_location_shader(ctx, AC_UD_VIEW_INDEX, &user_sgpr_idx, 1); if (ctx->options->key.vs.as_ls) { @@ -1071,7 +1078,8 @@ static void create_function(struct nir_to_llvm_context *ctx, ac_declare_lds_as_pointer(&ctx->ac); break; case MESA_SHADER_TESS_CTRL: - radv_define_vs_user_sgprs_phase2(ctx, stage, has_previous_stage, previous_stage, &user_sgpr_idx); + set_vs_specific_input_locs(ctx, stage, has_previous_stage, + previous_stage, &user_sgpr_idx); if (has_previous_stage) set_userdata_location_shader(ctx, AC_UD_VS_LS_TCS_IN_LAYOUT, &user_sgpr_idx, 1); set_userdata_location_shader(ctx, AC_UD_TCS_OFFCHIP_LAYOUT, &user_sgpr_idx, 4); @@ -1087,7 +1095,10 @@ static void create_function(struct nir_to_llvm_context *ctx, case MESA_SHADER_GEOMETRY: if (has_previous_stage) { if (previous_stage == MESA_SHADER_VERTEX) - radv_define_vs_user_sgprs_phase2(ctx, stage, has_previous_stage, previous_stage, &user_sgpr_idx); + set_vs_specific_input_locs(ctx, stage, + has_previous_stage, + previous_stage, + &user_sgpr_idx); else set_userdata_location_shader(ctx, AC_UD_TES_OFFCHIP_LAYOUT, &user_sgpr_idx, 1); } |