From 9aff3c605b925ad3302f392ad378198845438dfa Mon Sep 17 00:00:00 2001 From: Timothy Arceri Date: Mon, 15 May 2017 10:48:17 +1000 Subject: mesa: add blend_equation_separatei() helper MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Will be used to add KHR_no_error support. Reviewed-by: Nicolai Hähnle --- src/mesa/main/blend.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) (limited to 'src/mesa/main/blend.c') 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); } -- cgit v1.2.3