[Mesa-dev] [PATCH] radeonsi: fix alpha-to-coverage if color writes are disabled

Józef Kucia joseph.kucia at gmail.com
Sun Dec 31 09:19:15 UTC 2017


If alpha-to-coverage is enabled, we have to compute alpha
even if color writes are disabled.

Signed-off-by: Józef Kucia <joseph.kucia at gmail.com>
---

Found while running The Witness under Wine.

---
 src/gallium/drivers/radeonsi/si_state_shaders.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c
index 9143f61fcdf2..eaf72e8ee684 100644
--- a/src/gallium/drivers/radeonsi/si_state_shaders.c
+++ b/src/gallium/drivers/radeonsi/si_state_shaders.c
@@ -1173,6 +1173,8 @@ static void si_shader_selector_key_hw_vs(struct si_context *sctx,
 				      ps->info.writes_stencil ||
 				      ps->info.writes_samplemask ||
 				      si_get_alpha_test_func(sctx) != PIPE_FUNC_ALWAYS;
+		const struct si_state_blend *blend = sctx->queued.named.blend;
+		bool alpha_to_coverage = blend && blend->alpha_to_coverage;
 
 		unsigned ps_colormask = sctx->framebuffer.colorbuf_enabled_4bit &
 					sctx->queued.named.blend->cb_target_mask;
@@ -1182,7 +1184,8 @@ static void si_shader_selector_key_hw_vs(struct si_context *sctx,
 		ps_disabled = sctx->queued.named.rasterizer->rasterizer_discard ||
 			      (!ps_colormask &&
 			       !ps_modifies_zs &&
-			       !ps->info.writes_memory);
+			       !ps->info.writes_memory &&
+			       !alpha_to_coverage);
 	}
 
 	/* Find out which VS outputs aren't used by the PS. */
-- 
2.15.1



More information about the mesa-dev mailing list