From: Samuel Pitoiset Date: Mon, 17 Jul 2017 20:31:24 +0000 (+0200) Subject: mesa: add blend_equationi() helper X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=474f4b343be9b50fbe61d5f92676a9913197a6f5;p=mesa.git mesa: add blend_equationi() helper Signed-off-by: Samuel Pitoiset Reviewed-by: Timothy Arceri --- diff --git a/src/mesa/main/blend.c b/src/mesa/main/blend.c index 32656283115..84029ac6be9 100644 --- a/src/mesa/main/blend.c +++ b/src/mesa/main/blend.c @@ -552,6 +552,23 @@ _mesa_BlendEquation( GLenum mode ) /** * Set blend equation for one color buffer/target. */ +static void +blend_equationi(struct gl_context *ctx, GLuint buf, GLenum mode, + enum gl_advanced_blend_mode advanced_mode) +{ + if (ctx->Color.Blend[buf].EquationRGB == mode && + ctx->Color.Blend[buf].EquationA == mode) + return; /* no change */ + + _mesa_flush_vertices_for_blend_state(ctx); + ctx->Color.Blend[buf].EquationRGB = mode; + ctx->Color.Blend[buf].EquationA = mode; + ctx->Color._BlendEquationPerBuffer = GL_TRUE; + + if (buf == 0) + ctx->Color._AdvancedBlendMode = advanced_mode; +} + void GLAPIENTRY _mesa_BlendEquationiARB(GLuint buf, GLenum mode) { @@ -573,17 +590,7 @@ _mesa_BlendEquationiARB(GLuint buf, GLenum mode) return; } - if (ctx->Color.Blend[buf].EquationRGB == mode && - ctx->Color.Blend[buf].EquationA == mode) - return; /* no change */ - - _mesa_flush_vertices_for_blend_state(ctx); - ctx->Color.Blend[buf].EquationRGB = mode; - ctx->Color.Blend[buf].EquationA = mode; - ctx->Color._BlendEquationPerBuffer = GL_TRUE; - - if (buf == 0) - ctx->Color._AdvancedBlendMode = advanced_mode; + blend_equationi(ctx, buf, mode, advanced_mode); }