iris: Fix multiple RTs with non-independent blending
authorKenneth Graunke <kenneth@whitecape.org>
Thu, 8 Nov 2018 08:15:50 +0000 (00:15 -0800)
committerKenneth Graunke <kenneth@whitecape.org>
Thu, 21 Feb 2019 18:26:09 +0000 (10:26 -0800)
rt[i] isn't filled out in this case, so we have to use rt[0]

src/gallium/drivers/iris/iris_state.c

index 67f8bb782e0a0b881fd12a0360a3f91fd44c3724..b97266f3ad306477957047cac1252ed2e2e84d37 100644 (file)
@@ -812,6 +812,8 @@ iris_create_blend_state(struct pipe_context *ctx,
    blend_state += GENX(BLEND_STATE_length);
 
    for (int i = 0; i < BRW_MAX_DRAW_BUFFERS; i++) {
+      const struct pipe_rt_blend_state *rt =
+         &state->rt[state->independent_blend_enable ? i : 0];
       iris_pack_state(GENX(BLEND_STATE_ENTRY), blend_state, be) {
          be.LogicOpEnable = state->logicop_enable;
          be.LogicOpFunction = state->logicop_func;
@@ -821,19 +823,19 @@ iris_create_blend_state(struct pipe_context *ctx,
          be.PreBlendColorClampEnable = true;
          be.PostBlendColorClampEnable = true;
 
-         be.ColorBufferBlendEnable = state->rt[i].blend_enable;
+         be.ColorBufferBlendEnable = rt->blend_enable;
 
-         be.ColorBlendFunction          = state->rt[i].rgb_func;
-         be.AlphaBlendFunction          = state->rt[i].alpha_func;
-         be.SourceBlendFactor           = state->rt[i].rgb_src_factor;
-         be.SourceAlphaBlendFactor      = state->rt[i].alpha_func;
-         be.DestinationBlendFactor      = state->rt[i].rgb_dst_factor;
-         be.DestinationAlphaBlendFactor = state->rt[i].alpha_dst_factor;
+         be.ColorBlendFunction          = rt->rgb_func;
+         be.AlphaBlendFunction          = rt->alpha_func;
+         be.SourceBlendFactor           = rt->rgb_src_factor;
+         be.SourceAlphaBlendFactor      = rt->alpha_func;
+         be.DestinationBlendFactor      = rt->rgb_dst_factor;
+         be.DestinationAlphaBlendFactor = rt->alpha_dst_factor;
 
-         be.WriteDisableRed   = !(state->rt[i].colormask & PIPE_MASK_R);
-         be.WriteDisableGreen = !(state->rt[i].colormask & PIPE_MASK_G);
-         be.WriteDisableBlue  = !(state->rt[i].colormask & PIPE_MASK_B);
-         be.WriteDisableAlpha = !(state->rt[i].colormask & PIPE_MASK_A);
+         be.WriteDisableRed   = !(rt->colormask & PIPE_MASK_R);
+         be.WriteDisableGreen = !(rt->colormask & PIPE_MASK_G);
+         be.WriteDisableBlue  = !(rt->colormask & PIPE_MASK_B);
+         be.WriteDisableAlpha = !(rt->colormask & PIPE_MASK_A);
       }
       blend_state += GENX(BLEND_STATE_ENTRY_length);
    }