1include::meta/VK_EXT_blend_operation_advanced.txt[] 2 3*Last Modified Date*:: 4 2017-06-12 5*Contributors*:: 6 - Jeff Bolz, NVIDIA 7 8This extension adds a number of "`advanced`" blending operations that can: 9be used to perform new color blending operations, many of which are more 10complex than the standard blend modes provided by unextended Vulkan. 11This extension requires different styles of usage, depending on the level of 12hardware 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 27In unextended Vulkan, the set of blending operations is limited, and can: be 28expressed very simply. 29The ename:VK_BLEND_OP_MIN and ename:VK_BLEND_OP_MAX blend operations simply 30compute component-wise minimums or maximums of source and destination color 31components. 32The ename:VK_BLEND_OP_ADD, ename:VK_BLEND_OP_SUBTRACT, and 33ename:VK_BLEND_OP_REVERSE_SUBTRACT modes multiply the source and destination 34colors by source and destination factors and either add the two products 35together or subtract one from the other. 36This limited set of operations supports many common blending operations but 37precludes the use of more sophisticated transparency and blending operations 38commonly available in many dedicated imaging APIs. 39 40This extension provides a number of new "`advanced`" blending operations. 41Unlike traditional blending operations using ename:VK_BLEND_OP_ADD, these 42blending equations do not use source and destination factors specified by 43elink:VkBlendFactor. 44Instead, each blend operation specifies a complete equation based on the 45source and destination colors. 46These new blend operations are used for both RGB and alpha components; they 47must: not be used to perform separate RGB and alpha blending (via different 48values of color and alpha elink:VkBlendOp). 49 50These blending operations are performed using premultiplied colors, where 51RGB colors can: be considered premultiplied or non-premultiplied by alpha, 52according to the pname:srcPremultiplied and pname:dstPremultiplied members 53of slink:VkPipelineColorBlendAdvancedStateCreateInfoEXT. 54If a color is considered non-premultiplied, the (R,G,B) color components are 55multiplied by the alpha component prior to blending. 56For non-premultiplied color components in the range [eq]#[0,1]#, the 57corresponding premultiplied color component would have values in the range 58[eq]#[0 {times} A, 1 {times} A]#. 59 60Many of these advanced blending equations are formulated where the result of 61blending source and destination colors with partial coverage have three 62separate contributions: from the portions covered by both the source and the 63destination, from the portion covered only by the source, and from the 64portion covered only by the destination. 65The blend parameter 66slink:VkPipelineColorBlendAdvancedStateCreateInfoEXT::pname:blendOverlap 67can: be used to specify a correlation between source and destination pixel 68coverage. 69If set to ename:VK_BLEND_OVERLAP_CONJOINT_EXT, the source and destination 70are considered to have maximal overlap, as would be the case if drawing two 71objects on top of each other. 72If set to ename:VK_BLEND_OVERLAP_DISJOINT_EXT, the source and destination 73are considered to have minimal overlap, as would be the case when rendering 74a complex polygon tessellated into individual non-intersecting triangles. 75If set to ename:VK_BLEND_OVERLAP_UNCORRELATED_EXT, the source and 76destination coverage are assumed to have no spatial correlation within the 77pixel. 78 79In addition to the coherency issues on implementations not supporting 80pname:advancedBlendCoherentOperations, this extension has several 81limitations worth noting. 82First, the new blend operations have a limit on the number of color 83attachments they can: be used with, as indicated by 84slink:VkPhysicalDeviceBlendOperationAdvancedPropertiesEXT::pname:advancedBlendMaxColorAttachments. 85Additionally, blending precision may: be limited to 16-bit floating-point, 86which may: result in a loss of precision and dynamic range for framebuffer 87formats with 32-bit floating-point components, and in a loss of precision 88for formats with 12- and 16-bit signed or unsigned normalized integer 89components. 90 91=== New Object Types 92 93None. 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 165None. 166 167=== Issues 168 169None. 170 171=== Version History 172 173 * Revisions 1-2, 2017-06-12 (Jeff Bolz) 174 - Internal revisions 175