[Mesa-dev] [PATCH 2/5] st/mesa: don't check for ARB_draw_buffers_blend in update_blend

Marek Olšák maraeo at gmail.com
Wed Jan 31 19:55:12 UTC 2018


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

If the GL API is missing, different blend functions can't be set
through GL.
---
 src/mesa/state_tracker/st_atom_blend.c | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/src/mesa/state_tracker/st_atom_blend.c b/src/mesa/state_tracker/st_atom_blend.c
index f7327d6..8f644ba 100644
--- a/src/mesa/state_tracker/st_atom_blend.c
+++ b/src/mesa/state_tracker/st_atom_blend.c
@@ -138,72 +138,68 @@ blend_per_rt(const struct gl_context *ctx)
    }
    return GL_FALSE;
 }
 
 void
 st_update_blend( struct st_context *st )
 {
    struct pipe_blend_state *blend = &st->state.blend;
    const struct gl_context *ctx = st->ctx;
    unsigned num_state = 1;
-   unsigned i, j;
+   unsigned i;
 
    memset(blend, 0, sizeof(*blend));
 
    if (blend_per_rt(ctx) || colormask_per_rt(ctx)) {
       num_state = ctx->Const.MaxDrawBuffers;
       blend->independent_blend_enable = 1;
    }
    if (ctx->Color.ColorLogicOpEnabled) {
       /* logicop enabled */
       blend->logicop_enable = 1;
       blend->logicop_func = ctx->Color._LogicOp;
    }
    else if (ctx->Color.BlendEnabled && !ctx->Color._AdvancedBlendMode) {
       /* blending enabled */
-      for (i = 0, j = 0; i < num_state; i++) {
-
+      for (i = 0; i < num_state; i++) {
          blend->rt[i].blend_enable = (ctx->Color.BlendEnabled >> i) & 0x1;
 
-         if (ctx->Extensions.ARB_draw_buffers_blend)
-            j = i;
-
          blend->rt[i].rgb_func =
-            translate_blend(ctx->Color.Blend[j].EquationRGB);
+            translate_blend(ctx->Color.Blend[i].EquationRGB);
 
          if (ctx->Color.Blend[i].EquationRGB == GL_MIN ||
              ctx->Color.Blend[i].EquationRGB == GL_MAX) {
             /* Min/max are special */
             blend->rt[i].rgb_src_factor = PIPE_BLENDFACTOR_ONE;
             blend->rt[i].rgb_dst_factor = PIPE_BLENDFACTOR_ONE;
          }
          else {
             blend->rt[i].rgb_src_factor =
-               translate_blend(ctx->Color.Blend[j].SrcRGB);
+               translate_blend(ctx->Color.Blend[i].SrcRGB);
             blend->rt[i].rgb_dst_factor =
-               translate_blend(ctx->Color.Blend[j].DstRGB);
+               translate_blend(ctx->Color.Blend[i].DstRGB);
          }
 
          blend->rt[i].alpha_func =
-            translate_blend(ctx->Color.Blend[j].EquationA);
+            translate_blend(ctx->Color.Blend[i].EquationA);
 
          if (ctx->Color.Blend[i].EquationA == GL_MIN ||
              ctx->Color.Blend[i].EquationA == GL_MAX) {
             /* Min/max are special */
             blend->rt[i].alpha_src_factor = PIPE_BLENDFACTOR_ONE;
             blend->rt[i].alpha_dst_factor = PIPE_BLENDFACTOR_ONE;
          }
          else {
             blend->rt[i].alpha_src_factor =
-               translate_blend(ctx->Color.Blend[j].SrcA);
+               translate_blend(ctx->Color.Blend[i].SrcA);
             blend->rt[i].alpha_dst_factor =
-               translate_blend(ctx->Color.Blend[j].DstA);
+               translate_blend(ctx->Color.Blend[i].DstA);
          }
       }
    }
    else {
       /* no blending / logicop */
    }
 
    for (i = 0; i < num_state; i++)
       blend->rt[i].colormask = GET_COLORMASK(ctx->Color.ColorMask, i);
 
-- 
2.7.4



More information about the mesa-dev mailing list