[Mesa-dev] [PATCH 04/14] mesa: add logic_op() helper

Timothy Arceri tarceri at itsqueeze.com
Wed Jun 28 06:13:42 UTC 2017


---
 src/mesa/main/blend.c | 25 ++++++++++++++++---------
 1 file changed, 16 insertions(+), 9 deletions(-)

diff --git a/src/mesa/main/blend.c b/src/mesa/main/blend.c
index 881e9c8..541c248 100644
--- a/src/mesa/main/blend.c
+++ b/src/mesa/main/blend.c
@@ -755,6 +755,21 @@ _mesa_AlphaFunc( GLenum func, GLclampf ref )
 }
 
 
+static void
+logic_op(struct gl_context *ctx, GLenum opcode)
+{
+   if (ctx->Color.LogicOp == opcode)
+      return;
+
+   FLUSH_VERTICES(ctx, ctx->DriverFlags.NewLogicOp ? 0 : _NEW_COLOR);
+   ctx->NewDriverState |= ctx->DriverFlags.NewLogicOp;
+   ctx->Color.LogicOp = opcode;
+
+   if (ctx->Driver.LogicOpcode)
+      ctx->Driver.LogicOpcode(ctx, opcode);
+}
+
+
 /**
  * Specify a logic pixel operation for color index rendering.
  *
@@ -796,15 +811,7 @@ _mesa_LogicOp( GLenum opcode )
 	 return;
    }
 
-   if (ctx->Color.LogicOp == opcode)
-      return;
-
-   FLUSH_VERTICES(ctx, ctx->DriverFlags.NewLogicOp ? 0 : _NEW_COLOR);
-   ctx->NewDriverState |= ctx->DriverFlags.NewLogicOp;
-   ctx->Color.LogicOp = opcode;
-
-   if (ctx->Driver.LogicOpcode)
-      ctx->Driver.LogicOpcode( ctx, opcode );
+   logic_op(ctx, opcode);
 }
 
 
-- 
2.9.4



More information about the mesa-dev mailing list