[Mesa-dev] [PATCH 06/10] mesa: move validate_blend_factors() call after no-change check

Brian Paul brianp at vmware.com
Wed Oct 14 16:24:38 PDT 2015


A redundant call to glBlendFuncSeparateiARB() is more likely than getting
invalid values, so do the no-op check first.
---
 src/mesa/main/blend.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/mesa/main/blend.c b/src/mesa/main/blend.c
index 14742d0..d225f3d 100644
--- a/src/mesa/main/blend.c
+++ b/src/mesa/main/blend.c
@@ -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;
-- 
1.9.1



More information about the mesa-dev mailing list