From: Timothy Arceri Date: Mon, 15 May 2017 00:48:17 +0000 (+1000) Subject: mesa: add blend_equation_separatei() helper X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9aff3c605b925ad3302f392ad378198845438dfa;p=mesa.git mesa: add blend_equation_separatei() helper Will be used to add KHR_no_error support. Reviewed-by: Nicolai Hähnle --- diff --git a/src/mesa/main/blend.c b/src/mesa/main/blend.c index 8811ef9a339..e91c14aeb9d 100644 --- a/src/mesa/main/blend.c +++ b/src/mesa/main/blend.c @@ -599,6 +599,22 @@ _mesa_BlendEquationSeparate( GLenum modeRGB, GLenum 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. */ @@ -634,15 +650,7 @@ _mesa_BlendEquationSeparateiARB(GLuint buf, GLenum modeRGB, GLenum 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); }