[Mesa-dev] [PATCH 11/17] mesa: add blend_equation_separatei() helper
Timothy Arceri
tarceri at itsqueeze.com
Mon May 15 06:19:20 UTC 2017
Will be used to add KHR_no_error support.
---
src/mesa/main/blend.c | 26 +++++++++++++++++---------
1 file changed, 17 insertions(+), 9 deletions(-)
diff --git a/src/mesa/main/blend.c b/src/mesa/main/blend.c
index 8811ef9..e91c14a 100644
--- a/src/mesa/main/blend.c
+++ b/src/mesa/main/blend.c
@@ -592,20 +592,36 @@ _mesa_BlendEquationSeparate( GLenum modeRGB, GLenum modeA )
ctx->Color.Blend[buf].EquationA = modeA;
}
ctx->Color._BlendEquationPerBuffer = GL_FALSE;
ctx->Color._AdvancedBlendMode = BLEND_NONE;
if (ctx->Driver.BlendEquationSeparate)
ctx->Driver.BlendEquationSeparate(ctx, modeRGB, modeA);
}
+static void
+blend_equation_separatei(struct gl_context *ctx, GLuint buf, GLenum modeRGB,
+ GLenum modeA)
+{
+ if (ctx->Color.Blend[buf].EquationRGB == modeRGB &&
+ ctx->Color.Blend[buf].EquationA == modeA)
+ return; /* no change */
+
+ FLUSH_VERTICES(ctx, _NEW_COLOR);
+ ctx->Color.Blend[buf].EquationRGB = modeRGB;
+ ctx->Color.Blend[buf].EquationA = modeA;
+ ctx->Color._BlendEquationPerBuffer = GL_TRUE;
+ ctx->Color._AdvancedBlendMode = BLEND_NONE;
+}
+
+
/**
* Set separate blend equations for one color buffer/target.
*/
void GLAPIENTRY
_mesa_BlendEquationSeparateiARB(GLuint buf, GLenum modeRGB, GLenum modeA)
{
GET_CURRENT_CONTEXT(ctx);
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(ctx, "glBlendEquationSeparatei(%u, %s %s)\n", buf,
@@ -627,29 +643,21 @@ _mesa_BlendEquationSeparateiARB(GLuint buf, GLenum modeRGB, GLenum modeA)
if (!legal_simple_blend_equation(ctx, modeRGB)) {
_mesa_error(ctx, GL_INVALID_ENUM, "glBlendEquationSeparatei(modeRGB)");
return;
}
if (!legal_simple_blend_equation(ctx, modeA)) {
_mesa_error(ctx, GL_INVALID_ENUM, "glBlendEquationSeparatei(modeA)");
return;
}
- if (ctx->Color.Blend[buf].EquationRGB == modeRGB &&
- ctx->Color.Blend[buf].EquationA == modeA)
- return; /* no change */
-
- FLUSH_VERTICES(ctx, _NEW_COLOR);
- ctx->Color.Blend[buf].EquationRGB = modeRGB;
- ctx->Color.Blend[buf].EquationA = modeA;
- ctx->Color._BlendEquationPerBuffer = GL_TRUE;
- ctx->Color._AdvancedBlendMode = BLEND_NONE;
+ blend_equation_separatei(ctx, buf, modeRGB, modeA);
}
/**
* Set the blending color.
*
* \param red red color component.
* \param green green color component.
* \param blue blue color component.
* \param alpha alpha color component.
--
2.9.3
More information about the mesa-dev
mailing list