/ appendices / VK_EXT_blend_operation_advanced.txt
VK_EXT_blend_operation_advanced.txt
  1  include::meta/VK_EXT_blend_operation_advanced.txt[]
  2  
  3  *Last Modified Date*::
  4      2017-06-12
  5  *Contributors*::
  6    - Jeff Bolz, NVIDIA
  7  
  8  This extension adds a number of "`advanced`" blending operations that can:
  9  be used to perform new color blending operations, many of which are more
 10  complex than the standard blend modes provided by unextended Vulkan.
 11  This extension requires different styles of usage, depending on the level of
 12  hardware support and the enabled features:
 13  
 14    - If
 15      slink:VkPhysicalDeviceBlendOperationAdvancedFeaturesEXT::pname:advancedBlendCoherentOperations
 16      is ename:VK_FALSE, the new blending operations are supported, but a
 17      memory dependency must: separate each advanced blend operation on a
 18      given sample.
 19      ename:VK_ACCESS_COLOR_ATTACHMENT_READ_NONCOHERENT_BIT_EXT is used to
 20      synchronize reads using advanced blend operations.
 21  
 22    - If
 23      slink:VkPhysicalDeviceBlendOperationAdvancedFeaturesEXT::pname:advancedBlendCoherentOperations
 24      is ename:VK_TRUE, advanced blend operations obey primitive order just
 25      like basic blend operations.
 26  
 27  In unextended Vulkan, the set of blending operations is limited, and can: be
 28  expressed very simply.
 29  The ename:VK_BLEND_OP_MIN and ename:VK_BLEND_OP_MAX blend operations simply
 30  compute component-wise minimums or maximums of source and destination color
 31  components.
 32  The ename:VK_BLEND_OP_ADD, ename:VK_BLEND_OP_SUBTRACT, and
 33  ename:VK_BLEND_OP_REVERSE_SUBTRACT modes multiply the source and destination
 34  colors by source and destination factors and either add the two products
 35  together or subtract one from the other.
 36  This limited set of operations supports many common blending operations but
 37  precludes the use of more sophisticated transparency and blending operations
 38  commonly available in many dedicated imaging APIs.
 39  
 40  This extension provides a number of new "`advanced`" blending operations.
 41  Unlike traditional blending operations using ename:VK_BLEND_OP_ADD, these
 42  blending equations do not use source and destination factors specified by
 43  elink:VkBlendFactor.
 44  Instead, each blend operation specifies a complete equation based on the
 45  source and destination colors.
 46  These new blend operations are used for both RGB and alpha components; they
 47  must: not be used to perform separate RGB and alpha blending (via different
 48  values of color and alpha elink:VkBlendOp).
 49  
 50  These blending operations are performed using premultiplied colors, where
 51  RGB colors can: be considered premultiplied or non-premultiplied by alpha,
 52  according to the pname:srcPremultiplied and pname:dstPremultiplied members
 53  of slink:VkPipelineColorBlendAdvancedStateCreateInfoEXT.
 54  If a color is considered non-premultiplied, the (R,G,B) color components are
 55  multiplied by the alpha component prior to blending.
 56  For non-premultiplied color components in the range [eq]#[0,1]#, the
 57  corresponding premultiplied color component would have values in the range
 58  [eq]#[0 {times} A, 1 {times} A]#.
 59  
 60  Many of these advanced blending equations are formulated where the result of
 61  blending source and destination colors with partial coverage have three
 62  separate contributions: from the portions covered by both the source and the
 63  destination, from the portion covered only by the source, and from the
 64  portion covered only by the destination.
 65  The blend parameter
 66  slink:VkPipelineColorBlendAdvancedStateCreateInfoEXT::pname:blendOverlap
 67  can: be used to specify a correlation between source and destination pixel
 68  coverage.
 69  If set to ename:VK_BLEND_OVERLAP_CONJOINT_EXT, the source and destination
 70  are considered to have maximal overlap, as would be the case if drawing two
 71  objects on top of each other.
 72  If set to ename:VK_BLEND_OVERLAP_DISJOINT_EXT, the source and destination
 73  are considered to have minimal overlap, as would be the case when rendering
 74  a complex polygon tessellated into individual non-intersecting triangles.
 75  If set to ename:VK_BLEND_OVERLAP_UNCORRELATED_EXT, the source and
 76  destination coverage are assumed to have no spatial correlation within the
 77  pixel.
 78  
 79  In addition to the coherency issues on implementations not supporting
 80  pname:advancedBlendCoherentOperations, this extension has several
 81  limitations worth noting.
 82  First, the new blend operations have a limit on the number of color
 83  attachments they can: be used with, as indicated by
 84  slink:VkPhysicalDeviceBlendOperationAdvancedPropertiesEXT::pname:advancedBlendMaxColorAttachments.
 85  Additionally, blending precision may: be limited to 16-bit floating-point,
 86  which may: result in a loss of precision and dynamic range for framebuffer
 87  formats with 32-bit floating-point components, and in a loss of precision
 88  for formats with 12- and 16-bit signed or unsigned normalized integer
 89  components.
 90  
 91  === New Object Types
 92  
 93  None.
 94  
 95  === New Enum Constants
 96  
 97    * Extending elink:VkStructureType:
 98    ** ename:VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BLEND_OPERATION_ADVANCED_FEATURES_EXT
 99    ** ename:VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BLEND_OPERATION_ADVANCED_PROPERTIES_EXT
100    ** ename:VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_ADVANCED_STATE_CREATE_INFO_EXT
101  
102    * Extending elink:VkAccessFlagBits:
103    ** ename:VK_ACCESS_COLOR_ATTACHMENT_READ_NONCOHERENT_BIT_EXT
104  
105    * Extending elink:VkBlendOp:
106    ** ename:VK_BLEND_OP_ZERO_EXT
107    ** ename:VK_BLEND_OP_SRC_EXT
108    ** ename:VK_BLEND_OP_DST_EXT
109    ** ename:VK_BLEND_OP_SRC_OVER_EXT
110    ** ename:VK_BLEND_OP_DST_OVER_EXT
111    ** ename:VK_BLEND_OP_SRC_IN_EXT
112    ** ename:VK_BLEND_OP_DST_IN_EXT
113    ** ename:VK_BLEND_OP_SRC_OUT_EXT
114    ** ename:VK_BLEND_OP_DST_OUT_EXT
115    ** ename:VK_BLEND_OP_SRC_ATOP_EXT
116    ** ename:VK_BLEND_OP_DST_ATOP_EXT
117    ** ename:VK_BLEND_OP_XOR_EXT
118    ** ename:VK_BLEND_OP_MULTIPLY_EXT
119    ** ename:VK_BLEND_OP_SCREEN_EXT
120    ** ename:VK_BLEND_OP_OVERLAY_EXT
121    ** ename:VK_BLEND_OP_DARKEN_EXT
122    ** ename:VK_BLEND_OP_LIGHTEN_EXT
123    ** ename:VK_BLEND_OP_COLORDODGE_EXT
124    ** ename:VK_BLEND_OP_COLORBURN_EXT
125    ** ename:VK_BLEND_OP_HARDLIGHT_EXT
126    ** ename:VK_BLEND_OP_SOFTLIGHT_EXT
127    ** ename:VK_BLEND_OP_DIFFERENCE_EXT
128    ** ename:VK_BLEND_OP_EXCLUSION_EXT
129    ** ename:VK_BLEND_OP_INVERT_EXT
130    ** ename:VK_BLEND_OP_INVERT_RGB_EXT
131    ** ename:VK_BLEND_OP_LINEARDODGE_EXT
132    ** ename:VK_BLEND_OP_LINEARBURN_EXT
133    ** ename:VK_BLEND_OP_VIVIDLIGHT_EXT
134    ** ename:VK_BLEND_OP_LINEARLIGHT_EXT
135    ** ename:VK_BLEND_OP_PINLIGHT_EXT
136    ** ename:VK_BLEND_OP_HARDMIX_EXT
137    ** ename:VK_BLEND_OP_HSL_HUE_EXT
138    ** ename:VK_BLEND_OP_HSL_SATURATION_EXT
139    ** ename:VK_BLEND_OP_HSL_COLOR_EXT
140    ** ename:VK_BLEND_OP_HSL_LUMINOSITY_EXT
141    ** ename:VK_BLEND_OP_PLUS_EXT
142    ** ename:VK_BLEND_OP_PLUS_CLAMPED_EXT
143    ** ename:VK_BLEND_OP_PLUS_CLAMPED_ALPHA_EXT
144    ** ename:VK_BLEND_OP_PLUS_DARKER_EXT
145    ** ename:VK_BLEND_OP_MINUS_EXT
146    ** ename:VK_BLEND_OP_MINUS_CLAMPED_EXT
147    ** ename:VK_BLEND_OP_CONTRAST_EXT
148    ** ename:VK_BLEND_OP_INVERT_OVG_EXT
149    ** ename:VK_BLEND_OP_RED_EXT
150    ** ename:VK_BLEND_OP_GREEN_EXT
151    ** ename:VK_BLEND_OP_BLUE_EXT
152  
153  === New Enums
154  
155    * elink:VkBlendOverlapEXT
156  
157  === New Structures
158  
159    * slink:VkPhysicalDeviceBlendOperationAdvancedFeaturesEXT
160    * slink:VkPhysicalDeviceBlendOperationAdvancedPropertiesEXT
161    * slink:VkPipelineColorBlendAdvancedStateCreateInfoEXT
162  
163  === New Functions
164  
165  None.
166  
167  === Issues
168  
169  None.
170  
171  === Version History
172  
173    * Revisions 1-2, 2017-06-12 (Jeff Bolz)
174      - Internal revisions