aco, radv: Move PS epilog and VS prolog args to their info structs.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21696>
This commit is contained in:
Timur Kristóf 2023-03-03 11:35:19 -08:00 committed by Marge Bot
parent 84a2cea596
commit e9793331db
4 changed files with 28 additions and 15 deletions

View file

@ -11114,7 +11114,7 @@ create_fs_jump_to_epilog(isel_context* ctx)
}
}
Temp continue_pc = convert_pointer_to_64_bit(ctx, get_arg(ctx, ctx->args->ps_epilog_pc));
Temp continue_pc = convert_pointer_to_64_bit(ctx, get_arg(ctx, ctx->options->key.ps.epilog.pc));
aco_ptr<Pseudo_instruction> jump{create_instruction<Pseudo_instruction>(
aco_opcode::p_jump_to_epilog, Format::PSEUDO, 1 + color_exports.size(), 0)};
@ -11797,12 +11797,13 @@ load_vb_descs(Builder& bld, PhysReg dest, Operand base, unsigned start, unsigned
}
Operand
calc_nontrivial_instance_id(Builder& bld, const struct radv_shader_args* args, unsigned index,
calc_nontrivial_instance_id(Builder& bld, const struct radv_shader_args* args,
const struct aco_vs_prolog_info* pinfo, unsigned index,
Operand instance_id, Operand start_instance, PhysReg tmp_sgpr,
PhysReg tmp_vgpr0, PhysReg tmp_vgpr1)
{
bld.smem(aco_opcode::s_load_dwordx2, Definition(tmp_sgpr, s2),
get_arg_fixed(args, args->prolog_inputs), Operand::c32(8u + index * 8u));
get_arg_fixed(args, pinfo->inputs), Operand::c32(8u + index * 8u));
wait_imm lgkm_imm;
lgkm_imm.lgkm = 0;
@ -11977,7 +11978,7 @@ select_vs_prolog(Program* program, const struct aco_vs_prolog_info* pinfo, ac_sh
unsigned index =
util_bitcount(pinfo->state.nontrivial_divisors & BITFIELD_MASK(loc));
fetch_index = calc_nontrivial_instance_id(
bld, args, index, instance_id, start_instance, prolog_input,
bld, args, pinfo, index, instance_id, start_instance, prolog_input,
nontrivial_tmp_vgpr0, nontrivial_tmp_vgpr1);
} else {
fetch_index = Operand(instance_index, v1);
@ -12083,10 +12084,10 @@ select_vs_prolog(Program* program, const struct aco_vs_prolog_info* pinfo, ac_sh
block->kind |= block_kind_uniform;
/* continue on to the main shader */
Operand continue_pc = get_arg_fixed(args, args->prolog_inputs);
Operand continue_pc = get_arg_fixed(args, pinfo->inputs);
if (has_nontrivial_divisors) {
bld.smem(aco_opcode::s_load_dwordx2, Definition(prolog_input, s2),
get_arg_fixed(args, args->prolog_inputs), Operand::c32(0u));
get_arg_fixed(args, pinfo->inputs), Operand::c32(0u));
bld.sopp(aco_opcode::s_waitcnt, -1, lgkm_imm.pack(program->gfx_level));
continue_pc = Operand(prolog_input, s2);
}
@ -12133,7 +12134,7 @@ select_ps_epilog(Program* program, const struct aco_ps_epilog_info* einfo, ac_sh
out.is_int10 = (einfo->color_is_int10 >> i) & 1;
out.enable_mrt_output_nan_fixup = (einfo->enable_mrt_output_nan_fixup >> i) & 1;
Temp inputs = get_arg(&ctx, ctx.args->ps_epilog_inputs[i]);
Temp inputs = get_arg(&ctx, einfo->inputs[i]);
for (unsigned c = 0; c < 4; ++c) {
out.values[c] = Operand(emit_extract_vector(&ctx, inputs, c, v1));
}

View file

@ -27,6 +27,7 @@
#ifndef ACO_SHADER_INFO_H
#define ACO_SHADER_INFO_H
#include "ac_shader_args.h"
#include "shader_enums.h"
#ifdef __cplusplus
@ -53,6 +54,7 @@ struct aco_vs_input_state {
};
struct aco_vs_prolog_info {
struct ac_arg inputs;
struct aco_vs_input_state state;
unsigned num_attributes;
uint32_t misaligned_mask;
@ -132,6 +134,9 @@ enum aco_compiler_debug_level {
};
struct aco_ps_epilog_info {
struct ac_arg inputs[8];
struct ac_arg pc;
uint32_t spi_shader_col_format;
/* Bitmasks, each bit represents one of the 8 MRTs. */

View file

@ -97,7 +97,8 @@ radv_aco_convert_shader_info(struct aco_shader_info *aco_info,
#define ASSIGN_VS_STATE_FIELD_CP(x) memcpy(&aco_info->state.x, &radv->state->x, sizeof(radv->state->x))
static inline void
radv_aco_convert_vs_prolog_key(struct aco_vs_prolog_info *aco_info,
const struct radv_vs_prolog_key *radv)
const struct radv_vs_prolog_key *radv,
const struct radv_shader_args *radv_args)
{
ASSIGN_VS_STATE_FIELD(instance_rate_inputs);
ASSIGN_VS_STATE_FIELD(nontrivial_divisors);
@ -110,24 +111,30 @@ radv_aco_convert_vs_prolog_key(struct aco_vs_prolog_info *aco_info,
ASSIGN_FIELD(misaligned_mask);
ASSIGN_FIELD(is_ngg);
ASSIGN_FIELD(next_stage);
aco_info->inputs = radv_args->prolog_inputs;
}
static inline void
radv_aco_convert_ps_epilog_key(struct aco_ps_epilog_info *aco_info,
const struct radv_ps_epilog_key *radv)
const struct radv_ps_epilog_key *radv,
const struct radv_shader_args *radv_args)
{
ASSIGN_FIELD(spi_shader_col_format);
ASSIGN_FIELD(color_is_int8);
ASSIGN_FIELD(color_is_int10);
ASSIGN_FIELD(enable_mrt_output_nan_fixup);
ASSIGN_FIELD(mrt0_is_dual_src);
memcpy(aco_info->inputs, radv_args->ps_epilog_inputs, sizeof(aco_info->inputs));
aco_info->pc = radv_args->ps_epilog_pc;
}
static inline void
radv_aco_convert_pipe_key(struct aco_stage_input *aco_info,
const struct radv_pipeline_key *radv)
radv_aco_convert_pipe_key(struct aco_stage_input *aco_info, const struct radv_pipeline_key *radv,
const struct radv_shader_args *radv_args)
{
radv_aco_convert_ps_epilog_key(&aco_info->ps.epilog, &radv->ps.epilog);
radv_aco_convert_ps_epilog_key(&aco_info->ps.epilog, &radv->ps.epilog, radv_args);
ASSIGN_FIELD(optimisations_disabled);
ASSIGN_FIELD(image_2d_view_of_3d);
ASSIGN_FIELD(vs.instance_rate_inputs);
@ -146,7 +153,7 @@ radv_aco_convert_opts(struct aco_compiler_options *aco_info,
const struct radv_nir_compiler_options *radv,
const struct radv_shader_args *radv_args)
{
radv_aco_convert_pipe_key(&aco_info->key, &radv->key);
radv_aco_convert_pipe_key(&aco_info->key, &radv->key, radv_args);
ASSIGN_FIELD(robust_buffer_access);
ASSIGN_FIELD(dump_shader);
ASSIGN_FIELD(dump_preoptir);

View file

@ -2544,7 +2544,7 @@ radv_create_vs_prolog(struct radv_device *device, const struct radv_vs_prolog_ke
struct aco_compiler_options ac_opts;
radv_aco_convert_shader_info(&ac_info, &info, &args);
radv_aco_convert_opts(&ac_opts, &options, &args);
radv_aco_convert_vs_prolog_key(&ac_prolog_info, key);
radv_aco_convert_vs_prolog_key(&ac_prolog_info, key, &args);
aco_compile_vs_prolog(&ac_opts, &ac_info, &ac_prolog_info, &args, &radv_aco_build_shader_part,
(void **)&binary);
@ -2609,7 +2609,7 @@ radv_create_ps_epilog(struct radv_device *device, const struct radv_ps_epilog_ke
struct aco_compiler_options ac_opts;
radv_aco_convert_shader_info(&ac_info, &info, &args);
radv_aco_convert_opts(&ac_opts, &options, &args);
radv_aco_convert_ps_epilog_key(&ac_epilog_info, key);
radv_aco_convert_ps_epilog_key(&ac_epilog_info, key, &args);
aco_compile_ps_epilog(&ac_opts, &ac_info, &ac_epilog_info, &args, &radv_aco_build_shader_part,
(void **)&binary);