radv: store cb_shader_mask for fragment shaders and epilogs

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28976>
This commit is contained in:
Samuel Pitoiset 2024-04-30 08:50:38 +02:00 committed by Marge Bot
parent 0ce1bfc040
commit 66d4188ec5
6 changed files with 9 additions and 3 deletions

View File

@ -1885,8 +1885,7 @@ radv_emit_ps_epilog_state(struct radv_cmd_buffer *cmd_buffer, struct radv_shader
radeon_set_context_reg(cmd_buffer->cs, R_028714_SPI_SHADER_COL_FORMAT,
radv_compact_spi_shader_col_format(col_format));
radeon_set_context_reg(cmd_buffer->cs, R_02823C_CB_SHADER_MASK,
ac_get_cb_shader_mask(ps_epilog->spi_shader_col_format));
radeon_set_context_reg(cmd_buffer->cs, R_02823C_CB_SHADER_MASK, ps_epilog->cb_shader_mask);
if (ps_epilog->spi_shader_z_format)
radeon_set_context_reg(cmd_buffer->cs, R_028710_SPI_SHADER_Z_FORMAT, ps_epilog->spi_shader_z_format);

View File

@ -258,7 +258,7 @@ radv_pipeline_init_blend_state(struct radv_graphics_pipeline *pipeline)
if (!ps || ps->info.has_epilog)
return blend;
blend.cb_shader_mask = ac_get_cb_shader_mask(ps->info.ps.spi_shader_col_format);
blend.cb_shader_mask = ps->info.ps.cb_shader_mask;
blend.spi_shader_col_format = ps->info.ps.spi_shader_col_format;
return blend;

View File

@ -2289,6 +2289,7 @@ radv_shader_part_create(struct radv_device *device, struct radv_shader_part_bina
shader_part->disasm_string = binary->disasm_size ? strdup((const char *)(binary->data + binary->code_size)) : NULL;
shader_part->spi_shader_col_format = binary->info.spi_shader_col_format;
shader_part->cb_shader_mask = binary->info.cb_shader_mask;
shader_part->spi_shader_z_format = binary->info.spi_shader_z_format;
/* Allocate memory and upload. */
@ -2808,6 +2809,7 @@ radv_create_ps_epilog(struct radv_device *device, const struct radv_ps_epilog_ke
aco_compile_ps_epilog(&ac_opts, &ac_info, &ac_epilog_info, &args.ac, &radv_aco_build_shader_part, (void **)&binary);
binary->info.spi_shader_col_format = key->spi_shader_col_format;
binary->info.cb_shader_mask = ac_get_cb_shader_mask(key->spi_shader_col_format);
binary->info.spi_shader_z_format = key->spi_shader_z_format;
epilog = radv_shader_part_create(device, binary, info.wave_size);

View File

@ -354,6 +354,7 @@ struct radv_shader_binary_rtld {
struct radv_shader_part_binary {
struct {
uint32_t spi_shader_col_format;
uint32_t cb_shader_mask;
uint32_t spi_shader_z_format;
} info;
@ -452,6 +453,7 @@ struct radv_shader_part {
uint32_t rsrc1;
bool nontrivial_divisors;
uint32_t spi_shader_col_format;
uint32_t cb_shader_mask;
uint32_t spi_shader_z_format;
uint64_t upload_seq;

View File

@ -917,6 +917,8 @@ gather_shader_info_fs(const struct radv_device *device, const nir_shader *nir,
/* Clear color attachments that aren't exported by the FS to match IO shader arguments. */
info->ps.spi_shader_col_format &= info->ps.colors_written;
info->ps.cb_shader_mask = ac_get_cb_shader_mask(info->ps.spi_shader_col_format);
}
const bool export_alpha_and_mrtz =

View File

@ -203,6 +203,7 @@ struct radv_shader_info {
unsigned spi_ps_input;
unsigned colors_written;
unsigned spi_shader_col_format;
unsigned cb_shader_mask;
uint8_t color0_written;
bool load_provoking_vtx;
bool load_rasterization_prim;