mesa: move validate_blend_factors() call after no-change check
authorBrian Paul <brianp@vmware.com>
Wed, 14 Oct 2015 15:35:53 +0000 (09:35 -0600)
committerBrian Paul <brianp@vmware.com>
Thu, 15 Oct 2015 13:21:07 +0000 (07:21 -0600)
A redundant call to glBlendFuncSeparateiARB() is more likely than getting
invalid values, so do the no-op check first.

Reviewed-by: Eric Anholt <eric@anholt.net>
src/mesa/main/blend.c

index 14742d0bb6a6867bc2dcfc0ac9e4abbc944beac3..d225f3d171c8f2a4b28f8fbc54ffffc941da0a3b 100644 (file)
@@ -296,18 +296,18 @@ _mesa_BlendFuncSeparateiARB(GLuint buf, GLenum sfactorRGB, GLenum dfactorRGB,
       return;
    }
 
-   if (!validate_blend_factors(ctx, "glBlendFuncSeparatei",
-                               sfactorRGB, dfactorRGB,
-                               sfactorA, dfactorA)) {
-      return;
-   }
-
    if (ctx->Color.Blend[buf].SrcRGB == sfactorRGB &&
        ctx->Color.Blend[buf].DstRGB == dfactorRGB &&
        ctx->Color.Blend[buf].SrcA == sfactorA &&
        ctx->Color.Blend[buf].DstA == dfactorA)
       return; /* no change */
 
+   if (!validate_blend_factors(ctx, "glBlendFuncSeparatei",
+                               sfactorRGB, dfactorRGB,
+                               sfactorA, dfactorA)) {
+      return;
+   }
+
    FLUSH_VERTICES(ctx, _NEW_COLOR);
 
    ctx->Color.Blend[buf].SrcRGB = sfactorRGB;