VKBLENDOP(3)

NAME
VkBlendOp - framebuffer blending operations

C SPECIFICATION

Once the source and destination blend factors have been selected, they along with the source and destination components are passed to the blending operation. The blending operations are selected from the following enum, with RGB and alpha components potentially using different blend operations:

    typedef enum VkBlendOp {
        VK_BLEND_OP_ADD = 0,
        VK_BLEND_OP_SUBTRACT = 1,
        VK_BLEND_OP_REVERSE_SUBTRACT = 2,
        VK_BLEND_OP_MIN = 3,
        VK_BLEND_OP_MAX = 4,
    } VkBlendOp;

DESCRIPTION

The semantics of each enum value is described in the table below:

Table 1. Blend Operations
VkBlendOp | RGB Components | Alpha Component
VK_BLEND_OP_ADD | [ $R=R_{s0} imes S_r+R_d imes D_r$ ] [ $G=G_{s0} imes S_g+G_d imes D_g$ ] [ $B=B_{s0} imes S_b+B_d imes D_b$ ] | [ $A=A_{s0} imes S_a+A_d imes D_a$ ]
VK_BLEND_OP_SUBTRACT | [ $R=R_{s0} imes S_r-R_d imes D_r$ ] [ $G=G_{s0} imes S_g-G_d imes D_g$ ] [ $B=B_{s0} imes S_b-B_d imes D_b$ ] | [ $A=A_{s0} imes S_a-A_d imes D_a$ ]
VK_BLEND_OP_REVERSE_SUBTRACT | [ $R=R_d imes D_r-R_{s0} imes S_r$ ] [ $G=G_d imes D_g-G_{s0} imes S_g$ ] [ $B=B_d imes D_b-B_{s0} imes S_b$ ] | [ $A=A_d imes D_a-A_{s0} imes S_a$ ]
VK_BLEND_OP_MIN | [ $R=n(R_{s0},R_d)$ ] [ $G=n(G_{s0},G_d)$ ] [ $B=n(B_{s0},B_d)$ ] | [ $A=n(A_{s0},A_d)$ ]
VK_BLEND_OP_MAX | [ $R=x(R_{s0},R_d)$ ] [ $G=x(G_{s0},G_d)$ ] [ $B=x(B_{s0},B_d)$ ] | [ $A=x(A_{s0},A_d)$ ]

In this table, the following conventions are used:

    • [ $R_{s0},G_{s0},B_{s0}$ ] and [ $A_{s0}$ ] represent the first source color R, G, B, and A components, respectively.

    • [ $R_d,G_d,B_d$ ] and [ $A_d$ ] represent the R, G, B, and A components of the destination color. That is, the color currently in the corresponding color attachment for this fragment/sample.

    • [ $S_r,S_g,S_b$ ] and [ $S_a$ ] represent the source blend factor R, G, B, and A components, respectively.

    • [ $D_r,D_g,D_b$ ] and [ $D_a$ ] represent the destination blend factor R, G, B, and A components, respectively.

The blending operation produces a new set of values [ $R, G, B$ ] and [ $A$ ], which are written to the framebuffer attachment. If blending is not enabled for this attachment, then [ $R, G, B$ ] and [ $A$ ] are assigned [ $R_{s0},G_{s0},B_{s0}$ ] and [ $A_{s0}$ ], respectively.

If the color attachment is fixed-point, the components of the source and destination values and blend factors are each clamped to [ $[0,1]$ ] or [ $[-1,1]$ ] respectively for an unsigned normalized or signed normalized color attachment prior to evaluating the blend operations. If the color attachment is floating-point, no clamping occurs.

SEE ALSO

VkPipelineColorBlendAttachmentState

DOCUMENT NOTES

For more information, see the Vulkan Specification at URL

https://www.khronos.org/registry/vulkan/specs/1.0/xhtml/vkspec.html#VkBlendOp

This page is extracted from the Vulkan Specification. Fixes and changes should be made to the Specification,not directly.

COPYRIGHT

Copyright (c) 2014-2016 Khronos Group. This work is licensed under a Creative Commons Attribution 4.0 International License.

AUTHOR

Khronos Group
    Author.