radv/ac: move needs_push_constants to shader info.
First step to optimising push constants. Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl> Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user