[Mesa-dev] [PATCH 2/3] radeonsi: bypass alpha-test for integer colorbuffers

maraeo at gmail.com maraeo at gmail.com
Mon Sep 23 17:37:46 PDT 2013


From: Marek Olšák <marek.olsak at amd.com>

Fixes spec/EXT_texture_integer/fbo-blending.
---
 src/gallium/drivers/radeonsi/si_state.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c
index 7d412a4..04e0caf 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -2352,7 +2352,16 @@ static INLINE void si_shader_selector_key(struct pipe_context *ctx,
 		}
 		if (rctx->queued.named.dsa) {
 			key->ps.alpha_func = rctx->queued.named.dsa->alpha_func;
-			key->ps.alpha_ref = rctx->queued.named.dsa->alpha_ref;
+
+			/* Alpha-test should be disabled if colorbuffer 0 is integer. */
+			if (rctx->framebuffer.nr_cbufs &&
+			    rctx->framebuffer.cbufs[0] &&
+			    util_format_is_pure_integer(rctx->framebuffer.cbufs[0]->texture->format))
+				key->ps.alpha_func = PIPE_FUNC_ALWAYS;
+
+			if (key->ps.alpha_func != PIPE_FUNC_ALWAYS &&
+			    key->ps.alpha_func != PIPE_FUNC_NEVER)
+				key->ps.alpha_ref = rctx->queued.named.dsa->alpha_ref;
 		} else {
 			key->ps.alpha_func = PIPE_FUNC_ALWAYS;
 		}
-- 
1.8.1.2



More information about the mesa-dev mailing list