Vulkan-Docs/doc/specs/vulkan/man/VkLogicOp.txt

96 lines
3.3 KiB
Plaintext

// Copyright (c) 2014-2016 Khronos Group. This work is licensed under a
// Creative Commons Attribution 4.0 International License; see
// http://creativecommons.org/licenses/by/4.0/
VkLogicOp(3)
============
Name
----
VkLogicOp - framebuffer logical operations
C Specification
---------------
// refBegin VkLogicOp framebuffer logical operations
Logical operations are controlled by the pname:logicOpEnable and
pname:logicOp members of slink:VkPipelineColorBlendStateCreateInfo. If
pname:logicOpEnable is ename:VK_TRUE, then a logical operation selected by
pname:logicOp is applied between each color attachment and the fragment's
corresponding output value, and blending of all attachments is treated as if
it were disabled. Any attachments using color formats for which logical
operations are not supported simply pass through the color values
unmodified. The logical operation is applied independently for each of the
red, green, blue, and alpha components. The pname:logicOp is selected from
the following operations:
include::../api/enums/VkLogicOp.txt[]
Description
-----------
<<<
The logical operations supported by Vulkan are summarized in the
following table in which
* latexmath:[$\lnot$] is bitwise invert,
* latexmath:[$\land$] is bitwise and,
* latexmath:[$\lor$] is bitwise or,
* latexmath:[$\oplus$] is bitwise exclusive or,
* latexmath:[$s$] is the fragment's latexmath:[$R_{s0}, G_{s0}, B_{s0}$]
or latexmath:[$A_{s0}$] component value for the fragment output
corresponding to the color attachment being updated, and
* latexmath:[$d$] is the color attachment's latexmath:[$R, G, B$] or
latexmath:[$A$] component value:
.Logical Operations
[width="75%",options="header",align="center"]
|==========================================
|Mode | Operation
|ename:VK_LOGIC_OP_CLEAR | latexmath:[$0$]
|ename:VK_LOGIC_OP_AND | latexmath:[$s \land d$]
|ename:VK_LOGIC_OP_AND_REVERSE | latexmath:[$s \land \lnot d$]
|ename:VK_LOGIC_OP_COPY | latexmath:[$s$]
|ename:VK_LOGIC_OP_AND_INVERTED | latexmath:[$\lnot s \land d$]
|ename:VK_LOGIC_OP_NO_OP | latexmath:[$d$]
|ename:VK_LOGIC_OP_XOR | latexmath:[$s \oplus d$]
|ename:VK_LOGIC_OP_OR | latexmath:[$s \lor d$]
|ename:VK_LOGIC_OP_NOR | latexmath:[$\lnot (s \lor d)$]
|ename:VK_LOGIC_OP_EQUIVALENT | latexmath:[$\lnot (s \oplus d)$]
|ename:VK_LOGIC_OP_INVERT | latexmath:[$\lnot d$]
|ename:VK_LOGIC_OP_OR_REVERSE | latexmath:[$s \lor \lnot d$]
|ename:VK_LOGIC_OP_COPY_INVERTED | latexmath:[$\lnot s$]
|ename:VK_LOGIC_OP_OR_INVERTED | latexmath:[$\lnot s \lor d$]
|ename:VK_LOGIC_OP_NAND | latexmath:[$\lnot (s \land d)$]
|ename:VK_LOGIC_OP_SET | all 1s
|==========================================
The result of the logical operation is then written to the color attachment
as controlled by the component write mask, described in
<<framebuffer-blendoperations,Blend Operations>>.
// refEnd VkLogicOp
See Also
--------
slink:VkPipelineColorBlendStateCreateInfo
Document Notes
--------------
For more information, see the Vulkan Specification at URL
https://www.khronos.org/registry/vulkan/specs/1.0/xhtml/vkspec.html#VkLogicOp
This page is extracted from the Vulkan Specification.
Fixes and changes should be made to the Specification,not directly.
include::footer.txt[]