- blend->alpha_func = translate_blend(st->ctx->Color.BlendEquationA);
- if (st->ctx->Color.BlendEquationA == GL_MIN ||
- st->ctx->Color.BlendEquationA == GL_MAX) {
- /* Min/max are special */
- blend->alpha_src_factor = PIPE_BLENDFACTOR_ONE;
- blend->alpha_dst_factor = PIPE_BLENDFACTOR_ONE;
- }
- else {
- blend->alpha_src_factor = translate_blend(st->ctx->Color.BlendSrcA);
- blend->alpha_dst_factor = translate_blend(st->ctx->Color.BlendDstA);
+ if (ctx->Extensions.ARB_draw_buffers_blend)
+ j = i;
+
+ blend->rt[i].blend_enable = 1;
+ blend->rt[i].rgb_func =
+ translate_blend(ctx->Color.Blend[j].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);
+ blend->rt[i].rgb_dst_factor =
+ translate_blend(ctx->Color.Blend[j].DstRGB);
+ }
+
+ blend->rt[i].alpha_func =
+ translate_blend(ctx->Color.Blend[j].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);
+ blend->rt[i].alpha_dst_factor =
+ translate_blend(ctx->Color.Blend[j].DstA);
+ }
+
+ const struct gl_renderbuffer *rb =
+ ctx->DrawBuffer->_ColorDrawBuffers[i];
+
+ if (st->needs_rgb_dst_alpha_override && rb &&
+ (ctx->DrawBuffer->_RGBBuffers & (1 << i))) {
+ struct pipe_rt_blend_state *rt = &blend->rt[i];
+ rt->rgb_src_factor = fix_xrgb_alpha(rt->rgb_src_factor);
+ rt->rgb_dst_factor = fix_xrgb_alpha(rt->rgb_dst_factor);
+ rt->alpha_src_factor = fix_xrgb_alpha(rt->alpha_src_factor);
+ rt->alpha_dst_factor = fix_xrgb_alpha(rt->alpha_dst_factor);
+ }