From dcbe4b89eaa6218bfed15a54c0d025372d2e27e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Wed, 3 May 2023 11:24:41 -0400 Subject: [PATCH] radeonsi/gfx11: fix alpha-to-coverage with blending Bug: https://gitlab.freedesktop.org/mesa/mesa/-/issues/8222 Reviewed-by: Pierre-Eric Pelloux-Prayer Part-of: --- src/gallium/drivers/radeonsi/si_state.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c index 9f8c512877a..9c93df00b32 100644 --- a/src/gallium/drivers/radeonsi/si_state.c +++ b/src/gallium/drivers/radeonsi/si_state.c @@ -567,6 +567,16 @@ static void *si_create_blend_state_mode(struct pipe_context *ctx, S_028760_ALPHA_SRC_OPT(srcA_opt) | S_028760_ALPHA_DST_OPT(dstA_opt) | S_028760_ALPHA_COMB_FCN(si_translate_blend_opt_function(eqA)); + /* Alpha-to-coverage with blending enabled, depth writes enabled, and having no MRTZ export + * should disable SX blend optimizations. + * + * TODO: Add a piglit test for this. It should fail on gfx11 without this. + */ + if (sctx->gfx_level >= GFX11 && state->alpha_to_coverage && i == 0) { + sx_mrt_blend_opt[0] = S_028760_COLOR_COMB_FCN(V_028760_OPT_COMB_NONE) | + S_028760_ALPHA_COMB_FCN(V_028760_OPT_COMB_NONE); + } + /* Set blend state. */ blend_cntl |= S_028780_ENABLE(1); blend_cntl |= S_028780_COLOR_COMB_FCN(si_translate_blend_function(eqRGB));