radv: add a function that declares PS epilog shader arguments

The PS epilog would be a "normal" compiled shader using RA, etc. It
will declare up to 8x4 VGPRs for all color exports.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17485>
This commit is contained in:
Samuel Pitoiset 2022-06-17 16:28:31 +02:00 committed by Marge Bot
parent a38db1a94e
commit 0fd3754c26
2 changed files with 28 additions and 0 deletions

View File

@ -892,3 +892,25 @@ radv_declare_shader_args(enum amd_gfx_level gfx_level, const struct radv_pipelin
args->num_user_sgprs = user_sgpr_idx;
}
void
radv_declare_ps_epilog_args(enum amd_gfx_level gfx_level, const struct radv_ps_epilog_key *key,
struct radv_shader_args *args)
{
unsigned num_inputs = 0;
ac_add_arg(&args->ac, AC_ARG_SGPR, 2, AC_ARG_CONST_DESC_PTR, &args->ring_offsets);
if (gfx_level < GFX11)
ac_add_arg(&args->ac, AC_ARG_SGPR, 1, AC_ARG_INT, &args->ac.scratch_offset);
/* Declare VGPR arguments for color exports. */
for (unsigned i = 0; i < MAX_RTS; i++) {
unsigned col_format = (key->spi_shader_col_format >> (i * 4)) & 0xf;
if (col_format == V_028714_SPI_SHADER_ZERO)
continue;
ac_add_arg(&args->ac, AC_ARG_VGPR, 4, AC_ARG_FLOAT, &args->ps_epilog_inputs[num_inputs]);
num_inputs++;
}
}

View File

@ -62,6 +62,9 @@ struct radv_shader_args {
struct ac_arg prolog_inputs;
struct ac_arg vs_inputs[MAX_VERTEX_ATTRIBS];
/* PS epilogs */
struct ac_arg ps_epilog_inputs[MAX_RTS];
struct radv_userdata_locations user_sgprs_locs;
unsigned num_user_sgprs;
@ -86,4 +89,7 @@ void radv_declare_shader_args(enum amd_gfx_level gfx_level, const struct radv_pi
bool has_previous_stage, gl_shader_stage previous_stage,
struct radv_shader_args *args);
void radv_declare_ps_epilog_args(enum amd_gfx_level gfx_level, const struct radv_ps_epilog_key *key,
struct radv_shader_args *args);
#endif