From: Timothy Arceri Date: Wed, 28 Jun 2017 03:40:09 +0000 (+1000) Subject: mesa: add logic_op() helper X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ccbcb3ca17d68358f1c75a9440e4062785723f90;p=mesa.git mesa: add logic_op() helper Reviewed-by: Samuel Pitoiset --- diff --git a/src/mesa/main/blend.c b/src/mesa/main/blend.c index 881e9c8a79f..541c24852d5 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); }