The application can enable a *logical operation* between the fragment’s
color values and the existing value in the framebuffer attachment. This
logical operation is applied prior to updating the framebuffer attachment.
Logical operations are applied only for signed and unsigned integer and
normalized integer framebuffers. Logical operations are not applied to
floating-point or sRGB format color attachments.

Logical operations are controlled by the * logicOpEnable* and

`logicOp`

`VkPipelineColorBlendStateCreateInfo`

. If
`logicOpEnable`

`VK_TRUE`

, then a logical operation selected by
`logicOp`

`logicOp`

typedef enum VkLogicOp { VK_LOGIC_OP_CLEAR = 0, VK_LOGIC_OP_AND = 1, VK_LOGIC_OP_AND_REVERSE = 2, VK_LOGIC_OP_COPY = 3, VK_LOGIC_OP_AND_INVERTED = 4, VK_LOGIC_OP_NO_OP = 5, VK_LOGIC_OP_XOR = 6, VK_LOGIC_OP_OR = 7, VK_LOGIC_OP_NOR = 8, VK_LOGIC_OP_EQUIVALENT = 9, VK_LOGIC_OP_INVERT = 10, VK_LOGIC_OP_OR_REVERSE = 11, VK_LOGIC_OP_COPY_INVERTED = 12, VK_LOGIC_OP_OR_INVERTED = 13, VK_LOGIC_OP_NAND = 14, VK_LOGIC_OP_SET = 15, } VkLogicOp;

The logical operations supported by Vulkan are summarized in the following table in which

- $\lnot$ is bitwise invert,
- $\land$ is bitwise and,
- $\lor$ is bitwise or,
- $\oplus$ is bitwise exclusive or,
- $s$ is the fragment’s $R_{s0}, G_{s0}, B_{s0}$ or $A_{s0}$ component value for the fragment output corresponding to the color attachment being updated, and
- $d$ is the color attachment’s $R, G, B$ or $A$ component value:

**Table 26.3. Logical Operations**

Mode | Operation |
---|---|

| $0$ |

| $s \land d$ |

| $s \land \lnot d$ |

| $s$ |

| $\lnot s \land d$ |

| $d$ |

| $s \oplus d$ |

| $s \lor d$ |

| $\lnot (s \lor d)$ |

| $\lnot (s \oplus d)$ |

| $\lnot d$ |

| $s \lor \lnot d$ |

| $\lnot s$ |

| $\lnot s \lor d$ |

| $\lnot (s \land d)$ |

| all 1s |

The result of the logical operation is then written to the color attachment as controlled by the component write mask, described in Blend Operations.