diff options
author | Samuel Pitoiset <[email protected]> | 2017-08-02 20:47:49 +0200 |
---|---|---|
committer | Samuel Pitoiset <[email protected]> | 2017-08-03 10:56:02 +0200 |
commit | 39df62551c782fb571833e26d35c53cdcdb6ab4b (patch) | |
tree | 2e474706e147b94c0664d9a2ffd30e4adba92302 /src/mesa | |
parent | 6d8af9fd50cffae4a30a1f19a9c7927fc1c4d442 (diff) |
mesa: only check errors when the state change in glBlendEquationSeparateiARB()
When this GL call is a no-op, it should be a little faster.
Signed-off-by: Samuel Pitoiset <[email protected]>
Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/main/blend.c | 42 |
1 files changed, 22 insertions, 20 deletions
diff --git a/src/mesa/main/blend.c b/src/mesa/main/blend.c index 9ca04c1db29..af378f784da 100644 --- a/src/mesa/main/blend.c +++ b/src/mesa/main/blend.c @@ -694,14 +694,32 @@ _mesa_BlendEquationSeparate(GLenum modeRGB, GLenum modeA) } -static void +static ALWAYS_INLINE void blend_equation_separatei(struct gl_context *ctx, GLuint buf, GLenum modeRGB, - GLenum modeA) + GLenum modeA, bool no_error) { if (ctx->Color.Blend[buf].EquationRGB == modeRGB && ctx->Color.Blend[buf].EquationA == modeA) return; /* no change */ + if (!no_error) { + /* Only allow simple blending equations. + * The GL_KHR_blend_equation_advanced spec says: + * + * "NOTE: These enums are not accepted by the <modeRGB> or <modeAlpha> + * parameters of BlendEquationSeparate or BlendEquationSeparatei." + */ + 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; + } + } + _mesa_flush_vertices_for_blend_state(ctx); ctx->Color.Blend[buf].EquationRGB = modeRGB; ctx->Color.Blend[buf].EquationA = modeA; @@ -715,7 +733,7 @@ _mesa_BlendEquationSeparateiARB_no_error(GLuint buf, GLenum modeRGB, GLenum modeA) { GET_CURRENT_CONTEXT(ctx); - blend_equation_separatei(ctx, buf, modeRGB, modeA); + blend_equation_separatei(ctx, buf, modeRGB, modeA, true); } @@ -738,23 +756,7 @@ _mesa_BlendEquationSeparateiARB(GLuint buf, GLenum modeRGB, GLenum modeA) return; } - /* Only allow simple blending equations. - * The GL_KHR_blend_equation_advanced spec says: - * - * "NOTE: These enums are not accepted by the <modeRGB> or <modeAlpha> - * parameters of BlendEquationSeparate or BlendEquationSeparatei." - */ - 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; - } - - blend_equation_separatei(ctx, buf, modeRGB, modeA); + blend_equation_separatei(ctx, buf, modeRGB, modeA, false); } |