radv: clear unwritten color attachments for monolithic PS earlier

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-29 16:11:29 +02:00 committed by Marge Bot
parent 3b41fbd4b8
commit e1483d022b
2 changed files with 4 additions and 9 deletions

View file

@ -4113,15 +4113,7 @@ radv_graphics_pipeline_init(struct radv_graphics_pipeline *pipeline, struct radv
/* Make sure to clear color attachments without exports because MRT holes are removed during
* compilation for optimal performance.
*/
blend.spi_shader_col_format =
radv_compact_spi_shader_col_format(blend.spi_shader_col_format & ps->info.ps.colors_written);
/* In presence of MRT holes (ie. the FS exports MRT1 but not MRT0), the compiler will remap
* them, so that only MRT0 is exported and the driver will compact SPI_SHADER_COL_FORMAT to
* match what the FS actually exports. Though, to make sure the hw remapping works as
* expected, we should also clear color attachments without exports in CB_SHADER_MASK.
*/
blend.cb_shader_mask &= ps->info.ps.colors_written;
blend.spi_shader_col_format = radv_compact_spi_shader_col_format(blend.spi_shader_col_format);
}
unsigned custom_blend_mode = extra ? extra->custom_blend_mode : 0;

View file

@ -914,6 +914,9 @@ gather_shader_info_fs(const struct radv_device *device, const nir_shader *nir,
if (!info->has_epilog) {
info->ps.mrt0_is_dual_src = gfx_state->ps.epilog.mrt0_is_dual_src;
info->ps.spi_shader_col_format = gfx_state->ps.epilog.spi_shader_col_format;
/* 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;
}
const bool export_alpha_and_mrtz =