Logical Operations

Atualizado em 2023/10/21
Tempos estimado de leitura: 1 min

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 members of VkPipelineColorBlendStateCreateInfo. If logicOpEnable is VK_TRUE, then a logical operation selected by 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 logicOp is selected from the following operations:

typedef enum afxLogicOp
{
    afxLogicOp_CLEAR,
    afxLogicOp_AND,
    afxLogicOp_AND_REV,
    afxLogicOp_COPY,
    afxLogicOp_AND_INV,
    afxLogicOp_NOP,
    afxLogicOp_XOR,
    afxLogicOp_OR,
    afxLogicOp_NOR,
    afxLogicOp_EQUIV,
    afxLogicOp_INV,
    afxLogicOp_OR_REV,
    afxLogicOp_COPY_INV,
    afxLogicOp_OR_INV,
    afxLogicOp_NAND,
    afxLogicOp_SET,
} afxLogicOp;

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

Referências:
Esta publicação foi útil?
Desaprovar 0
Leituras: 2

Responses

Translate »