summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/blend.c
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2018-01-03 11:26:41 -0800
committerIan Romanick <[email protected]>2018-01-26 11:21:46 +0800
commit9c1f010f3463d4e1ea488200390fa21f3db0b814 (patch)
tree4710a42fecfb899a5d239cc2730d25f4720b7be8 /src/mesa/main/blend.c
parent5a3404d443e0c6e8e9a44d7f8dccf96c5ac18f0f (diff)
mesa: Also track a remapped version of the color logic op
With the exception of NVIDIA hardware, these are is the values that all hardware and Gallium want. The remapping is currently implemented in at least 6 places. This starts the process of consolidating to a single place. v2: sed --in-place -e 's/color_logic_ops/gl_logicop_mode/g' $(grep -lr color_logic_ops src/) suggested by Brian. Added some comments about the selection of bit patterns for gl_logicop_mode and the GLenums. Suggested by Nicolai. Folded the GLenum_to_color_logicop macro into its only users. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Brian Paul <[email protected]> [v1] Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/mesa/main/blend.c')
-rw-r--r--src/mesa/main/blend.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/mesa/main/blend.c b/src/mesa/main/blend.c
index 01721ab615d..1c3711766ec 100644
--- a/src/mesa/main/blend.c
+++ b/src/mesa/main/blend.c
@@ -849,6 +849,24 @@ _mesa_AlphaFunc( GLenum func, GLclampf ref )
}
}
+static const enum gl_logicop_mode color_logicop_mapping[16] = {
+ COLOR_LOGICOP_CLEAR,
+ COLOR_LOGICOP_AND,
+ COLOR_LOGICOP_AND_REVERSE,
+ COLOR_LOGICOP_COPY,
+ COLOR_LOGICOP_AND_INVERTED,
+ COLOR_LOGICOP_NOOP,
+ COLOR_LOGICOP_XOR,
+ COLOR_LOGICOP_OR,
+ COLOR_LOGICOP_NOR,
+ COLOR_LOGICOP_EQUIV,
+ COLOR_LOGICOP_INVERT,
+ COLOR_LOGICOP_OR_REVERSE,
+ COLOR_LOGICOP_COPY_INVERTED,
+ COLOR_LOGICOP_OR_INVERTED,
+ COLOR_LOGICOP_NAND,
+ COLOR_LOGICOP_SET
+};
static ALWAYS_INLINE void
logic_op(struct gl_context *ctx, GLenum opcode, bool no_error)
@@ -884,6 +902,7 @@ logic_op(struct gl_context *ctx, GLenum opcode, bool no_error)
FLUSH_VERTICES(ctx, ctx->DriverFlags.NewLogicOp ? 0 : _NEW_COLOR);
ctx->NewDriverState |= ctx->DriverFlags.NewLogicOp;
ctx->Color.LogicOp = opcode;
+ ctx->Color._LogicOp = color_logicop_mapping[opcode & 0x0f];
if (ctx->Driver.LogicOpcode)
ctx->Driver.LogicOpcode(ctx, opcode);
@@ -1189,6 +1208,7 @@ void _mesa_init_color( struct gl_context * ctx )
ctx->Color.IndexLogicOpEnabled = GL_FALSE;
ctx->Color.ColorLogicOpEnabled = GL_FALSE;
ctx->Color.LogicOp = GL_COPY;
+ ctx->Color._LogicOp = COLOR_LOGICOP_COPY;
ctx->Color.DitherFlag = GL_TRUE;
/* GL_FRONT is not possible on GLES. Instead GL_BACK will render to either