From 6a2ac18b2b0a358b4cfa3d89013c5ab818be9e72 Mon Sep 17 00:00:00 2001 From: Georg Lehmann Date: Sun, 12 Apr 2026 14:21:56 +0200 Subject: [PATCH] radv: remove radv_remove_color_exports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We do this later on lowered IO anyway, in radv_nir_trim_fs_color_exports. That pass is also per component, and not per output slot. No Foz-DB changes on Navi48. Reviewed-by: Marek Olšák Reviewed-by: Samuel Pitoiset Part-of: --- src/amd/vulkan/radv_pipeline_graphics.c | 48 ------------------------- 1 file changed, 48 deletions(-) diff --git a/src/amd/vulkan/radv_pipeline_graphics.c b/src/amd/vulkan/radv_pipeline_graphics.c index edffc081196..981a24408b6 100644 --- a/src/amd/vulkan/radv_pipeline_graphics.c +++ b/src/amd/vulkan/radv_pipeline_graphics.c @@ -1163,52 +1163,6 @@ radv_should_export_multiview(const struct radv_shader_stage *stage, const struct !(stage->nir->info.outputs_written & VARYING_BIT_LAYER); } -static void -radv_remove_color_exports(const struct radv_graphics_state_key *gfx_state, nir_shader *nir) -{ - uint8_t color_remap[MAX_RTS]; - bool fixup_derefs = false; - - /* Do not remove color exports when a PS epilog is used because the format isn't known and the color write mask can - * be dynamic. */ - if (gfx_state->ps.has_epilog) - return; - - /* Shader output locations to color attachment mappings. */ - memset(color_remap, MESA_VK_ATTACHMENT_UNUSED, sizeof(color_remap)); - for (uint32_t i = 0; i < MAX_RTS; i++) { - if (gfx_state->ps.epilog.color_map[i] != MESA_VK_ATTACHMENT_UNUSED) - color_remap[gfx_state->ps.epilog.color_map[i]] = i; - } - - nir_foreach_shader_out_variable (var, nir) { - int idx = var->data.location; - idx -= FRAG_RESULT_DATA0; - - if (idx < 0) - continue; - - const uint8_t cb_idx = color_remap[idx]; - unsigned col_format = cb_idx == MESA_VK_ATTACHMENT_UNUSED - ? V_028714_SPI_SHADER_ZERO - : (gfx_state->ps.epilog.spi_shader_col_format >> (4 * cb_idx)) & 0xf; - - if (col_format == V_028714_SPI_SHADER_ZERO) { - /* Remove the color export if it's unused or in presence of holes. */ - nir->info.outputs_written &= ~BITFIELD64_BIT(var->data.location); - var->data.location = 0; - var->data.mode = nir_var_shader_temp; - fixup_derefs = true; - } - } - - if (fixup_derefs) { - NIR_PASS(_, nir, nir_fixup_deref_modes); - NIR_PASS(_, nir, nir_remove_dead_variables, nir_var_shader_temp, NULL); - NIR_PASS(_, nir, nir_opt_dce); - } -} - static void merge_tess_info(struct shader_info *tes_info, struct shader_info *tcs_info) { @@ -1430,8 +1384,6 @@ radv_link_fs(struct radv_shader_stage *fs_stage, const struct radv_graphics_stat /* Lower the view index to map on the layer. */ NIR_PASS(_, fs_stage->nir, radv_nir_lower_view_index); - - radv_remove_color_exports(gfx_state, fs_stage->nir); } static bool