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 operations. RGB and alpha components can use different operations. Possible values of VkBlendOp, specifying the operations, are:

typedef enum VkBlendOp {
    VK_BLEND_OP_ADD = 0,
    VK_BLEND_OP_MIN = 3,
    VK_BLEND_OP_MAX = 4,
} VkBlendOp;


The semantics of each basic blend operations is described in the table below:

Table 1. Basic Blend Operations
VkBlendOp RGB Components Alpha Component


R = Rs0 × Sr + Rd × Dr
G = Gs0 × Sg + Gd × Dg
B = Bs0 × Sb + Bd × Db

A = As0 × Sa + Ad × Da


R = Rs0 × Sr - Rd × Dr
G = Gs0 × Sg - Gd × Dg
B = Bs0 × Sb - Bd × Db

A = As0 × Sa - Ad × Da


R = Rd × Dr - Rs0 × Sr
G = Gd × Dg - Gs0 × Sg
B = Bd × Db - Bs0 × Sb

A = Ad × Da - As0 × Sa


R = min(Rs0,Rd)
G = min(Gs0,Gd)
B = min(Bs0,Bd)

A = min(As0,Ad)


R = max(Rs0,Rd)
G = max(Gs0,Gd)
B = max(Bs0,Bd)

A = max(As0,Ad)

In this table, the following conventions are used:

  • Rs0, Gs0, Bs0 and As0 represent the first source color R, G, B, and A components, respectively.

  • Rd, Gd, Bd and Ad 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.

  • Sr, Sg, Sb and Sa represent the source blend factor R, G, B, and A components, respectively.

  • Dr, Dg, Db and Da 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 Rs0, Gs0, Bs0 and As0, 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

Document Notes

For more information, see the Vulkan Specification at URL

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

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