[Mesa-dev] [PATCH] st/mesa: disable alpha-test, alpha-to-coverage, alpha-to-one for integer FBs

Marek Olšák maraeo at gmail.com
Tue Oct 18 17:48:55 UTC 2016


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

v2: rebased
---
 src/mesa/state_tracker/st_atom_blend.c | 3 ++-
 src/mesa/state_tracker/st_atom_depth.c | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/mesa/state_tracker/st_atom_blend.c b/src/mesa/state_tracker/st_atom_blend.c
index 76d6a644..b8d65bd 100644
--- a/src/mesa/state_tracker/st_atom_blend.c
+++ b/src/mesa/state_tracker/st_atom_blend.c
@@ -259,21 +259,22 @@ update_blend( struct st_context *st )
          blend->rt[i].colormask |= PIPE_MASK_G;
       if (ctx->Color.ColorMask[i][2])
          blend->rt[i].colormask |= PIPE_MASK_B;
       if (ctx->Color.ColorMask[i][3])
          blend->rt[i].colormask |= PIPE_MASK_A;
    }
 
    blend->dither = ctx->Color.DitherFlag;
 
    if (ctx->Multisample.Enabled &&
-       ctx->DrawBuffer->Visual.sampleBuffers > 0) {
+       ctx->DrawBuffer->Visual.sampleBuffers > 0 &&
+       !(ctx->DrawBuffer->_IntegerBuffers & 0x1)) {
       /* Unlike in gallium/d3d10 these operations are only performed
        * if both msaa is enabled and we have a multisample buffer.
        */
       blend->alpha_to_coverage = ctx->Multisample.SampleAlphaToCoverage;
       blend->alpha_to_one = ctx->Multisample.SampleAlphaToOne;
    }
 
    cso_set_blend(st->cso_context, blend);
 
    {
diff --git a/src/mesa/state_tracker/st_atom_depth.c b/src/mesa/state_tracker/st_atom_depth.c
index 267b42c..7092c3f 100644
--- a/src/mesa/state_tracker/st_atom_depth.c
+++ b/src/mesa/state_tracker/st_atom_depth.c
@@ -142,21 +142,22 @@ update_depth_stencil_alpha(struct st_context *st)
       else {
          /* This should be unnecessary. Drivers must not expect this to
           * contain valid data, except the enabled bit
           */
          dsa->stencil[1] = dsa->stencil[0];
          dsa->stencil[1].enabled = 0;
          sr.ref_value[1] = sr.ref_value[0];
       }
    }
 
-   if (ctx->Color.AlphaEnabled) {
+   if (ctx->Color.AlphaEnabled &&
+       !(ctx->DrawBuffer->_IntegerBuffers & 0x1)) {
       dsa->alpha.enabled = 1;
       dsa->alpha.func = st_compare_func_to_pipe(ctx->Color.AlphaFunc);
       dsa->alpha.ref_value = ctx->Color.AlphaRefUnclamped;
    }
 
    cso_set_depth_stencil_alpha(st->cso_context, dsa);
    cso_set_stencil_ref(st->cso_context, &sr);
 }
 
 
-- 
2.7.4



More information about the mesa-dev mailing list