• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 2017-2022 The Khronos Group Inc.
2//
3// SPDX-License-Identifier: CC-BY-4.0
4
5include::{generated}/meta/{refprefix}VK_EXT_blend_operation_advanced.adoc[]
6
7=== Other Extension Metadata
8
9*Last Modified Date*::
10    2017-06-12
11*Contributors*::
12  - Jeff Bolz, NVIDIA
13
14=== Description
15
16This extension adds a number of "`advanced`" blending operations that can:
17be used to perform new color blending operations, many of which are more
18complex than the standard blend modes provided by unextended Vulkan.
19This extension requires different styles of usage, depending on the level of
20hardware support and the enabled features:
21
22  - If
23    slink:VkPhysicalDeviceBlendOperationAdvancedFeaturesEXT::pname:advancedBlendCoherentOperations
24    is ename:VK_FALSE, the new blending operations are supported, but a
25    memory dependency must: separate each advanced blend operation on a
26    given sample.
27    ename:VK_ACCESS_COLOR_ATTACHMENT_READ_NONCOHERENT_BIT_EXT is used to
28    synchronize reads using advanced blend operations.
29
30  - If
31    slink:VkPhysicalDeviceBlendOperationAdvancedFeaturesEXT::pname:advancedBlendCoherentOperations
32    is ename:VK_TRUE, advanced blend operations obey primitive order just
33    like basic blend operations.
34
35In unextended Vulkan, the set of blending operations is limited, and can: be
36expressed very simply.
37The ename:VK_BLEND_OP_MIN and ename:VK_BLEND_OP_MAX blend operations simply
38compute component-wise minimums or maximums of source and destination color
39components.
40The ename:VK_BLEND_OP_ADD, ename:VK_BLEND_OP_SUBTRACT, and
41ename:VK_BLEND_OP_REVERSE_SUBTRACT modes multiply the source and destination
42colors by source and destination factors and either add the two products
43together or subtract one from the other.
44This limited set of operations supports many common blending operations but
45precludes the use of more sophisticated transparency and blending operations
46commonly available in many dedicated imaging APIs.
47
48This extension provides a number of new "`advanced`" blending operations.
49Unlike traditional blending operations using ename:VK_BLEND_OP_ADD, these
50blending equations do not use source and destination factors specified by
51elink:VkBlendFactor.
52Instead, each blend operation specifies a complete equation based on the
53source and destination colors.
54These new blend operations are used for both RGB and alpha components; they
55must: not be used to perform separate RGB and alpha blending (via different
56values of color and alpha elink:VkBlendOp).
57
58These blending operations are performed using premultiplied colors, where
59RGB colors can: be considered premultiplied or non-premultiplied by alpha,
60according to the pname:srcPremultiplied and pname:dstPremultiplied members
61of slink:VkPipelineColorBlendAdvancedStateCreateInfoEXT.
62If a color is considered non-premultiplied, the (R,G,B) color components are
63multiplied by the alpha component prior to blending.
64For non-premultiplied color components in the range [eq]#[0,1]#, the
65corresponding premultiplied color component would have values in the range
66[eq]#[0 {times} A, 1 {times} A]#.
67
68Many of these advanced blending equations are formulated where the result of
69blending source and destination colors with partial coverage have three
70separate contributions: from the portions covered by both the source and the
71destination, from the portion covered only by the source, and from the
72portion covered only by the destination.
73The blend parameter
74slink:VkPipelineColorBlendAdvancedStateCreateInfoEXT::pname:blendOverlap
75can: be used to specify a correlation between source and destination pixel
76coverage.
77If set to ename:VK_BLEND_OVERLAP_CONJOINT_EXT, the source and destination
78are considered to have maximal overlap, as would be the case if drawing two
79objects on top of each other.
80If set to ename:VK_BLEND_OVERLAP_DISJOINT_EXT, the source and destination
81are considered to have minimal overlap, as would be the case when rendering
82a complex polygon tessellated into individual non-intersecting triangles.
83If set to ename:VK_BLEND_OVERLAP_UNCORRELATED_EXT, the source and
84destination coverage are assumed to have no spatial correlation within the
85pixel.
86
87In addition to the coherency issues on implementations not supporting
88pname:advancedBlendCoherentOperations, this extension has several
89limitations worth noting.
90First, the new blend operations have a limit on the number of color
91attachments they can: be used with, as indicated by
92slink:VkPhysicalDeviceBlendOperationAdvancedPropertiesEXT::pname:advancedBlendMaxColorAttachments.
93Additionally, blending precision may: be limited to 16-bit floating-point,
94which may: result in a loss of precision and dynamic range for framebuffer
95formats with 32-bit floating-point components, and in a loss of precision
96for formats with 12- and 16-bit signed or unsigned normalized integer
97components.
98
99include::{generated}/interfaces/VK_EXT_blend_operation_advanced.adoc[]
100
101=== Issues
102
103None.
104
105=== Version History
106
107  * Revision 1, 2017-06-12 (Jeff Bolz)
108  ** Internal revisions
109  * Revision 2, 2017-06-12 (Jeff Bolz)
110  ** Internal revisions
111