radeonsi: preserve alpha if needed in kill_ps_outputs_cb

Some features (eg: ALPHA_TEST) relies on the alpha value being
exported even if color_mask.a = false.

In these cases, override comp_mask to preserve the alpha value.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10841
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10845
Fixes: 6d2a7f53 ("radeonsi: decrease NUM_INTERP if export formats/colormask eliminated PS inputs")
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28268>
This commit is contained in:
Pierre-Eric Pelloux-Prayer
2024-03-20 16:16:24 +01:00
committed by Marge Bot
parent 4acea392af
commit 53f9cdac9b
+5
View File
@@ -1707,6 +1707,11 @@ static bool kill_ps_outputs_cb(struct nir_builder *b, nir_instr *instr, void *_k
assert(nir_intrinsic_component(intr) == 0);
unsigned cb_shader_mask = ac_get_cb_shader_mask(key->ps.part.epilog.spi_shader_col_format);
/* Preserve alpha if ALPHA_TESTING is enabled. */
if (key->ps.part.epilog.alpha_func != PIPE_FUNC_ALWAYS ||
key->ps.part.epilog.alpha_to_coverage_via_mrtz)
cb_shader_mask |= 1 << 3;
/* If COLOR is broadcasted to multiple color buffers, combine their masks. */
if (location == FRAG_RESULT_COLOR) {
for (unsigned i = 1; i <= key->ps.part.epilog.last_cbuf; i++)