From e1483d022b28218bd53aea1c4917739cf0398b3e Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Mon, 29 Apr 2024 16:11:29 +0200 Subject: [PATCH] radv: clear unwritten color attachments for monolithic PS earlier Signed-off-by: Samuel Pitoiset Part-of: --- src/amd/vulkan/radv_pipeline_graphics.c | 10 +--------- src/amd/vulkan/radv_shader_info.c | 3 +++ 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/amd/vulkan/radv_pipeline_graphics.c b/src/amd/vulkan/radv_pipeline_graphics.c index 033bc913e8a..5cc818535f7 100644 --- a/src/amd/vulkan/radv_pipeline_graphics.c +++ b/src/amd/vulkan/radv_pipeline_graphics.c @@ -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; diff --git a/src/amd/vulkan/radv_shader_info.c b/src/amd/vulkan/radv_shader_info.c index 6282ba838b7..344968ef893 100644 --- a/src/amd/vulkan/radv_shader_info.c +++ b/src/amd/vulkan/radv_shader_info.c @@ -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 =