aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main/blend.c
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/mesa/main/blend.c')
-rw-r--r--mesalib/src/mesa/main/blend.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/mesalib/src/mesa/main/blend.c b/mesalib/src/mesa/main/blend.c
index bc446edca..5bc40a028 100644
--- a/mesalib/src/mesa/main/blend.c
+++ b/mesalib/src/mesa/main/blend.c
@@ -166,6 +166,24 @@ _mesa_BlendFunc( GLenum sfactor, GLenum dfactor )
_mesa_BlendFuncSeparateEXT(sfactor, dfactor, sfactor, dfactor);
}
+static GLboolean
+blend_factor_is_dual_src(GLenum factor)
+{
+ return (factor == GL_SRC1_COLOR ||
+ factor == GL_SRC1_ALPHA ||
+ factor == GL_ONE_MINUS_SRC1_COLOR ||
+ factor == GL_ONE_MINUS_SRC1_ALPHA);
+}
+
+static void
+update_uses_dual_src(struct gl_context *ctx, int buf)
+{
+ ctx->Color.Blend[buf]._UsesDualSrc =
+ (blend_factor_is_dual_src(ctx->Color.Blend[buf].SrcRGB) ||
+ blend_factor_is_dual_src(ctx->Color.Blend[buf].DstRGB) ||
+ blend_factor_is_dual_src(ctx->Color.Blend[buf].SrcA) ||
+ blend_factor_is_dual_src(ctx->Color.Blend[buf].DstA));
+}
/**
* Set the separate blend source/dest factors for all draw buffers.
@@ -220,6 +238,7 @@ _mesa_BlendFuncSeparateEXT( GLenum sfactorRGB, GLenum dfactorRGB,
ctx->Color.Blend[buf].DstRGB = dfactorRGB;
ctx->Color.Blend[buf].SrcA = sfactorA;
ctx->Color.Blend[buf].DstA = dfactorA;
+ update_uses_dual_src(ctx, buf);
}
ctx->Color._BlendFuncPerBuffer = GL_FALSE;
@@ -282,6 +301,7 @@ _mesa_BlendFuncSeparatei(GLuint buf, GLenum sfactorRGB, GLenum dfactorRGB,
ctx->Color.Blend[buf].DstRGB = dfactorRGB;
ctx->Color.Blend[buf].SrcA = sfactorA;
ctx->Color.Blend[buf].DstA = dfactorA;
+ update_uses_dual_src(ctx, buf);
ctx->Color._BlendFuncPerBuffer = GL_TRUE;
if (ctx->Driver.BlendFuncSeparatei) {