aco: extract aco_compile_shader_part from aco_compile_ps_epilog

Will be shared with radeonsi tcs epilog and other shader parts build.

Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24417>
This commit is contained in:
Qiang Yu 2023-08-02 08:23:57 +02:00 committed by Marge Bot
parent ac99fbe591
commit 572625ea6c
3 changed files with 26 additions and 9 deletions

View file

@ -11944,10 +11944,11 @@ select_vs_prolog(Program* program, const struct aco_vs_prolog_info* pinfo, ac_sh
}
void
select_ps_epilog(Program* program, const struct aco_ps_epilog_info* einfo, ac_shader_config* config,
select_ps_epilog(Program* program, void* pinfo, ac_shader_config* config,
const struct aco_compiler_options* options, const struct aco_shader_info* info,
const struct ac_shader_args* args)
{
const struct aco_ps_epilog_info* einfo = (const struct aco_ps_epilog_info*)pinfo;
isel_context ctx = setup_isel_context(program, 0, NULL, config, options, info, args, true);
ctx.block->fp_mode = program->next_fp_mode;

View file

@ -334,11 +334,17 @@ aco_compile_vs_prolog(const struct aco_compiler_options* options,
disasm.data(), disasm.size());
}
void
aco_compile_ps_epilog(const struct aco_compiler_options* options,
const struct aco_shader_info* info, const struct aco_ps_epilog_info* pinfo,
const struct ac_shader_args* args, aco_shader_part_callback* build_epilog,
void** binary)
typedef void(select_shader_part_callback)(aco::Program* program, void* pinfo,
ac_shader_config* config,
const struct aco_compiler_options* options,
const struct aco_shader_info* info,
const struct ac_shader_args* args);
static void
aco_compile_shader_part(const struct aco_compiler_options* options,
const struct aco_shader_info* info, const struct ac_shader_args* args,
select_shader_part_callback select_shader_part, void* pinfo,
aco_shader_part_callback* build_epilog, void** binary)
{
aco::init();
@ -353,7 +359,7 @@ aco_compile_ps_epilog(const struct aco_compiler_options* options,
program->debug.private_data = options->debug.private_data;
/* Instruction selection */
aco::select_ps_epilog(program.get(), pinfo, &config, options, info, args);
select_shader_part(program.get(), pinfo, &config, options, info, args);
aco_postprocess_shader(options, info, program);
@ -370,3 +376,13 @@ aco_compile_ps_epilog(const struct aco_compiler_options* options,
(*build_epilog)(binary, config.num_sgprs, config.num_vgprs, code.data(), code.size(),
disasm.data(), disasm.size());
}
void
aco_compile_ps_epilog(const struct aco_compiler_options* options,
const struct aco_shader_info* info, const struct aco_ps_epilog_info* pinfo,
const struct ac_shader_args* args, aco_shader_part_callback* build_epilog,
void** binary)
{
aco_compile_shader_part(options, info, args, aco::select_ps_epilog, (void*)pinfo, build_epilog,
binary);
}

View file

@ -2228,8 +2228,8 @@ void select_vs_prolog(Program* program, const struct aco_vs_prolog_info* pinfo,
ac_shader_config* config, const struct aco_compiler_options* options,
const struct aco_shader_info* info, const struct ac_shader_args* args);
void select_ps_epilog(Program* program, const struct aco_ps_epilog_info* epilog_info,
ac_shader_config* config, const struct aco_compiler_options* options,
void select_ps_epilog(Program* program, void* pinfo, ac_shader_config* config,
const struct aco_compiler_options* options,
const struct aco_shader_info* info, const struct ac_shader_args* args);
void lower_phis(Program* program);