radeonsi: bypass alpha-test for integer colorbuffers
authorMarek Olšák <marek.olsak@amd.com>
Mon, 23 Sep 2013 19:41:34 +0000 (21:41 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Wed, 25 Sep 2013 18:45:22 +0000 (20:45 +0200)
Fixes spec/EXT_texture_integer/fbo-blending.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
src/gallium/drivers/radeonsi/si_state.c

index 8f7edafcf355c7f8d64345beb9e9515402a18064..b5d625aa7a39be63c0d08d2ace178020de631b9a 100644 (file)
@@ -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;
                }