From 3d504ee844e3b257595e6abb79a6e3faff5406a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Sun, 1 Jun 2025 17:16:46 -0400 Subject: [PATCH] radeonsi: remove a non-trivial optimization that doesn't do much It only caused some optimized shader variants to not be compiled in very rare cases. I think it doesn't happen in practice, but if it does, it's not a big deal. The case when this was useful was when a shader wrote (0,0,0,0) or (0,0,0,1) or (1,1,1,0, or (1,1,1,1) to a shader output before PS, but PS didn't use the output. Reviewed-by: Qiang Yu Part-of: --- .../drivers/radeonsi/si_state_shaders.cpp | 36 ------------------- 1 file changed, 36 deletions(-) diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.cpp b/src/gallium/drivers/radeonsi/si_state_shaders.cpp index 5b34eb2c016..b7280294f5c 100644 --- a/src/gallium/drivers/radeonsi/si_state_shaders.cpp +++ b/src/gallium/drivers/radeonsi/si_state_shaders.cpp @@ -3483,42 +3483,6 @@ static void si_init_shader_selector_async(void *job, void *gdata, int thread_ind } *si_get_main_shader_part(sel, &shader->key, shader->wave_size) = shader; - - /* Unset "outputs_written" flags for outputs converted to - * DEFAULT_VAL, so that later inter-shader optimizations don't - * try to eliminate outputs that don't exist in the final - * shader. - * - * This is only done if non-monolithic shaders are enabled. - */ - if ((sel->stage == MESA_SHADER_VERTEX || - sel->stage == MESA_SHADER_TESS_EVAL || - sel->stage == MESA_SHADER_GEOMETRY) && - !shader->key.ge.as_ls && !shader->key.ge.as_es) { - unsigned i; - - for (i = 0; i < sel->info.num_outputs; i++) { - unsigned semantic = sel->info.output_semantic[i]; - unsigned ps_input_cntl = shader->info.vs_output_ps_input_cntl[semantic]; - - /* OFFSET=0x20 means DEFAULT_VAL, which means VS doesn't export it. */ - if (G_028644_OFFSET(ps_input_cntl) != 0x20) - continue; - - unsigned id; - - /* Remove the output from the mask. */ - if ((semantic <= VARYING_SLOT_VAR31 || semantic >= VARYING_SLOT_VAR0_16BIT) && - semantic != VARYING_SLOT_POS && - semantic != VARYING_SLOT_PSIZ && - semantic != VARYING_SLOT_CLIP_VERTEX && - semantic != VARYING_SLOT_EDGE && - semantic != VARYING_SLOT_LAYER) { - id = si_shader_io_get_unique_index(semantic); - sel->info.outputs_written_before_ps &= ~(1ull << id); - } - } - } } /* Free NIR. We only keep serialized NIR after this point. */