1e5c31af7Sopenharmony_ci// Copyright 2015-2024 The Khronos Group Inc.
2e5c31af7Sopenharmony_ci//
3e5c31af7Sopenharmony_ci// SPDX-License-Identifier: CC-BY-4.0
4e5c31af7Sopenharmony_ci
5e5c31af7Sopenharmony_ci[[framebuffer]]
6e5c31af7Sopenharmony_ci= The Framebuffer
7e5c31af7Sopenharmony_ci
8e5c31af7Sopenharmony_ci
9e5c31af7Sopenharmony_ci[[framebuffer-blending]]
10e5c31af7Sopenharmony_ci== Blending
11e5c31af7Sopenharmony_ci
12e5c31af7Sopenharmony_ciBlending combines the incoming _source_ fragment's R, G, B, and A values
13e5c31af7Sopenharmony_ciwith the _destination_ R, G, B, and A values of each sample stored in the
14e5c31af7Sopenharmony_ciframebuffer at the fragment's [eq]#(x~f~,y~f~)# location.
15e5c31af7Sopenharmony_ciBlending is performed for each color sample covered by the fragment, rather
16e5c31af7Sopenharmony_cithan just once for each fragment.
17e5c31af7Sopenharmony_ci
18e5c31af7Sopenharmony_ciSource and destination values are combined according to the
19e5c31af7Sopenharmony_ci<<framebuffer-blendoperations,blend operation>>, quadruplets of source and
20e5c31af7Sopenharmony_cidestination weighting factors determined by the <<framebuffer-blendfactors,
21e5c31af7Sopenharmony_ciblend factors>>, and a <<framebuffer-blendconstants,blend constant>>, to
22e5c31af7Sopenharmony_ciobtain a new set of R, G, B, and A values, as described below.
23e5c31af7Sopenharmony_ci
24e5c31af7Sopenharmony_ciBlending is computed and applied separately to each color attachment used by
25e5c31af7Sopenharmony_cithe subpass, with separate controls for each attachment.
26e5c31af7Sopenharmony_ci
27e5c31af7Sopenharmony_ciPrior to performing the blend operation, signed and unsigned normalized
28e5c31af7Sopenharmony_cifixed-point color components undergo an implied conversion to floating-point
29e5c31af7Sopenharmony_cias specified by <<fundamentals-fixedfpconv,Conversion from Normalized
30e5c31af7Sopenharmony_ciFixed-Point to Floating-Point>>.
31e5c31af7Sopenharmony_ciBlending computations are treated as if carried out in floating-point, and
32e5c31af7Sopenharmony_cibasic blend operations are performed with a precision and dynamic range no
33e5c31af7Sopenharmony_cilower than that used to represent destination components.
34e5c31af7Sopenharmony_ciifdef::VK_EXT_blend_operation_advanced[]
35e5c31af7Sopenharmony_ci<<framebuffer-blend-advanced,Advanced blending operations>> are performed
36e5c31af7Sopenharmony_ciwith a precision and dynamic range no lower than the smaller of that used to
37e5c31af7Sopenharmony_cirepresent destination components or that used to represent 16-bit
38e5c31af7Sopenharmony_cifloating-point values.
39e5c31af7Sopenharmony_ciendif::VK_EXT_blend_operation_advanced[]
40e5c31af7Sopenharmony_ci
41e5c31af7Sopenharmony_ci[NOTE]
42e5c31af7Sopenharmony_ci.Note
43e5c31af7Sopenharmony_ci====
44e5c31af7Sopenharmony_ciBlending is only defined for floating-point, UNORM, SNORM, and sRGB formats.
45e5c31af7Sopenharmony_ciWithin those formats, the implementation may only support blending on some
46e5c31af7Sopenharmony_cisubset of them.
47e5c31af7Sopenharmony_ciWhich formats support blending is indicated by
48e5c31af7Sopenharmony_ciename:VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT.
49e5c31af7Sopenharmony_ci====
50e5c31af7Sopenharmony_ci
51e5c31af7Sopenharmony_ciThe pipeline blend state is included in the
52e5c31af7Sopenharmony_cisname:VkPipelineColorBlendStateCreateInfo structure during graphics pipeline
53e5c31af7Sopenharmony_cicreation:
54e5c31af7Sopenharmony_ci
55e5c31af7Sopenharmony_ci[open,refpage='VkPipelineColorBlendStateCreateInfo',desc='Structure specifying parameters of a newly created pipeline color blend state',type='structs']
56e5c31af7Sopenharmony_ci--
57e5c31af7Sopenharmony_ciThe sname:VkPipelineColorBlendStateCreateInfo structure is defined as:
58e5c31af7Sopenharmony_ci
59e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkPipelineColorBlendStateCreateInfo.adoc[]
60e5c31af7Sopenharmony_ci
61e5c31af7Sopenharmony_ci  * pname:sType is a elink:VkStructureType value identifying this structure.
62e5c31af7Sopenharmony_ci  * pname:pNext is `NULL` or a pointer to a structure extending this
63e5c31af7Sopenharmony_ci    structure.
64e5c31af7Sopenharmony_ciifndef::VK_EXT_rasterization_order_attachment_access,VK_ARM_rasterization_order_attachment_access[]
65e5c31af7Sopenharmony_ci  * pname:flags is reserved for future use.
66e5c31af7Sopenharmony_ciendif::VK_EXT_rasterization_order_attachment_access,VK_ARM_rasterization_order_attachment_access[]
67e5c31af7Sopenharmony_ciifdef::VK_EXT_rasterization_order_attachment_access,VK_ARM_rasterization_order_attachment_access[]
68e5c31af7Sopenharmony_ci  * pname:flags is a bitmask of
69e5c31af7Sopenharmony_ci    elink:VkPipelineColorBlendStateCreateFlagBits specifying additional
70e5c31af7Sopenharmony_ci    color blending information.
71e5c31af7Sopenharmony_ciendif::VK_EXT_rasterization_order_attachment_access,VK_ARM_rasterization_order_attachment_access[]
72e5c31af7Sopenharmony_ci  * pname:logicOpEnable controls whether to apply <<framebuffer-logicop,
73e5c31af7Sopenharmony_ci    Logical Operations>>.
74e5c31af7Sopenharmony_ci  * pname:logicOp selects which logical operation to apply.
75e5c31af7Sopenharmony_ci  * pname:attachmentCount is the number of
76e5c31af7Sopenharmony_ci    slink:VkPipelineColorBlendAttachmentState elements in
77e5c31af7Sopenharmony_ci    pname:pAttachments.
78e5c31af7Sopenharmony_ciifdef::VK_EXT_extended_dynamic_state3[]
79e5c31af7Sopenharmony_ci    It is ignored if the pipeline is created with
80e5c31af7Sopenharmony_ci    ename:VK_DYNAMIC_STATE_COLOR_BLEND_ENABLE_EXT,
81e5c31af7Sopenharmony_ci    ename:VK_DYNAMIC_STATE_COLOR_BLEND_EQUATION_EXT, and
82e5c31af7Sopenharmony_ci    ename:VK_DYNAMIC_STATE_COLOR_WRITE_MASK_EXT dynamic states set, and
83e5c31af7Sopenharmony_ci    either ename:VK_DYNAMIC_STATE_COLOR_BLEND_ADVANCED_EXT set or
84e5c31af7Sopenharmony_ci    <<features-advancedBlendCoherentOperations,advancedBlendCoherentOperations>>
85e5c31af7Sopenharmony_ci    is not enabled on the device.
86e5c31af7Sopenharmony_ciendif::VK_EXT_extended_dynamic_state3[]
87e5c31af7Sopenharmony_ci  * pname:pAttachments is a pointer to an array of
88e5c31af7Sopenharmony_ci    slink:VkPipelineColorBlendAttachmentState structures defining blend
89e5c31af7Sopenharmony_ci    state for each color attachment.
90e5c31af7Sopenharmony_ciifdef::VK_EXT_extended_dynamic_state3[]
91e5c31af7Sopenharmony_ci    It is ignored if the pipeline is created with
92e5c31af7Sopenharmony_ci    ename:VK_DYNAMIC_STATE_COLOR_BLEND_ENABLE_EXT,
93e5c31af7Sopenharmony_ci    ename:VK_DYNAMIC_STATE_COLOR_BLEND_EQUATION_EXT, and
94e5c31af7Sopenharmony_ci    ename:VK_DYNAMIC_STATE_COLOR_WRITE_MASK_EXT dynamic states set, and
95e5c31af7Sopenharmony_ci    either ename:VK_DYNAMIC_STATE_COLOR_BLEND_ADVANCED_EXT set or
96e5c31af7Sopenharmony_ci    <<features-advancedBlendCoherentOperations,advancedBlendCoherentOperations>>
97e5c31af7Sopenharmony_ci    is not enabled on the device.
98e5c31af7Sopenharmony_ciendif::VK_EXT_extended_dynamic_state3[]
99e5c31af7Sopenharmony_ci  * pname:blendConstants is a pointer to an array of four values used as the
100e5c31af7Sopenharmony_ci    R, G, B, and A components of the blend constant that are used in
101e5c31af7Sopenharmony_ci    blending, depending on the <<framebuffer-blendfactors,blend factor>>.
102e5c31af7Sopenharmony_ci
103e5c31af7Sopenharmony_ci.Valid Usage
104e5c31af7Sopenharmony_ci****
105e5c31af7Sopenharmony_ci  * [[VUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605]]
106e5c31af7Sopenharmony_ci    If the <<features-independentBlend, pname:independentBlend>> feature is
107e5c31af7Sopenharmony_ci    not enabled, all elements of pname:pAttachments must: be identical
108e5c31af7Sopenharmony_ci  * [[VUID-VkPipelineColorBlendStateCreateInfo-logicOpEnable-00606]]
109e5c31af7Sopenharmony_ci    If the <<features-logicOp, pname:logicOp>> feature is not enabled,
110e5c31af7Sopenharmony_ci    pname:logicOpEnable must: be ename:VK_FALSE
111e5c31af7Sopenharmony_ci  * [[VUID-VkPipelineColorBlendStateCreateInfo-logicOpEnable-00607]]
112e5c31af7Sopenharmony_ci    If pname:logicOpEnable is ename:VK_TRUE, pname:logicOp must: be a valid
113e5c31af7Sopenharmony_ci    elink:VkLogicOp value
114e5c31af7Sopenharmony_ciifdef::VK_EXT_rasterization_order_attachment_access,VK_ARM_rasterization_order_attachment_access[]
115e5c31af7Sopenharmony_ci  * [[VUID-VkPipelineColorBlendStateCreateInfo-rasterizationOrderColorAttachmentAccess-06465]]
116e5c31af7Sopenharmony_ci    If the <<features-rasterizationOrderColorAttachmentAccess,
117e5c31af7Sopenharmony_ci    pname:rasterizationOrderColorAttachmentAccess>> feature is not enabled,
118e5c31af7Sopenharmony_ci    pname:flags must: not include
119e5c31af7Sopenharmony_ci    ename:VK_PIPELINE_COLOR_BLEND_STATE_CREATE_RASTERIZATION_ORDER_ATTACHMENT_ACCESS_BIT_EXT
120e5c31af7Sopenharmony_ciendif::VK_EXT_rasterization_order_attachment_access,VK_ARM_rasterization_order_attachment_access[]
121e5c31af7Sopenharmony_ci  * [[VUID-VkPipelineColorBlendStateCreateInfo-pAttachments-07353]]
122e5c31af7Sopenharmony_ci    If pname:attachmentCount is not `0`
123e5c31af7Sopenharmony_ciifdef::VK_EXT_extended_dynamic_state3[]
124e5c31af7Sopenharmony_ci    , and any of ename:VK_DYNAMIC_STATE_COLOR_BLEND_ADVANCED_EXT,
125e5c31af7Sopenharmony_ci    ename:VK_DYNAMIC_STATE_COLOR_BLEND_ENABLE_EXT,
126e5c31af7Sopenharmony_ci    ename:VK_DYNAMIC_STATE_COLOR_BLEND_EQUATION_EXT, or
127e5c31af7Sopenharmony_ci    ename:VK_DYNAMIC_STATE_COLOR_WRITE_MASK_EXT are not set,
128e5c31af7Sopenharmony_ciendif::VK_EXT_extended_dynamic_state3[]
129e5c31af7Sopenharmony_ci    pname:pAttachments must: be a valid pointer to an array of
130e5c31af7Sopenharmony_ci    pname:attachmentCount valid slink:VkPipelineColorBlendAttachmentState
131e5c31af7Sopenharmony_ci    structures
132e5c31af7Sopenharmony_ci****
133e5c31af7Sopenharmony_ci
134e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkPipelineColorBlendStateCreateInfo.adoc[]
135e5c31af7Sopenharmony_ci--
136e5c31af7Sopenharmony_ci
137e5c31af7Sopenharmony_ci[open,refpage='VkPipelineColorBlendStateCreateFlags',desc='Bitmask of VkPipelineColorBlendStateCreateFlagBits',type='flags']
138e5c31af7Sopenharmony_ci--
139e5c31af7Sopenharmony_ciinclude::{generated}/api/flags/VkPipelineColorBlendStateCreateFlags.adoc[]
140e5c31af7Sopenharmony_ci
141e5c31af7Sopenharmony_ciifndef::VK_EXT_rasterization_order_attachment_access,VK_ARM_rasterization_order_attachment_access[]
142e5c31af7Sopenharmony_citname:VkPipelineColorBlendStateCreateFlags is a bitmask type for setting a
143e5c31af7Sopenharmony_cimask, but is currently reserved for future use.
144e5c31af7Sopenharmony_ciendif::VK_EXT_rasterization_order_attachment_access,VK_ARM_rasterization_order_attachment_access[]
145e5c31af7Sopenharmony_ciifdef::VK_EXT_rasterization_order_attachment_access,VK_ARM_rasterization_order_attachment_access[]
146e5c31af7Sopenharmony_citname:VkPipelineColorBlendStateCreateFlags is a bitmask type for setting a
147e5c31af7Sopenharmony_cimask of zero or more elink:VkPipelineColorBlendStateCreateFlagBits.
148e5c31af7Sopenharmony_ciendif::VK_EXT_rasterization_order_attachment_access,VK_ARM_rasterization_order_attachment_access[]
149e5c31af7Sopenharmony_ci--
150e5c31af7Sopenharmony_ci
151e5c31af7Sopenharmony_ciifdef::VK_EXT_rasterization_order_attachment_access,VK_ARM_rasterization_order_attachment_access[]
152e5c31af7Sopenharmony_ci[open,refpage='VkPipelineColorBlendStateCreateFlagBits',desc='Bitmask specifying additional parameters of an image',type='enums']
153e5c31af7Sopenharmony_ci--
154e5c31af7Sopenharmony_ciBits which can: be set in the
155e5c31af7Sopenharmony_cislink:VkPipelineColorBlendStateCreateInfo::pname:flags parameter are:
156e5c31af7Sopenharmony_ci
157e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VkPipelineColorBlendStateCreateFlagBits.adoc[]
158e5c31af7Sopenharmony_ci
159e5c31af7Sopenharmony_ci  * ename:VK_PIPELINE_COLOR_BLEND_STATE_CREATE_RASTERIZATION_ORDER_ATTACHMENT_ACCESS_BIT_EXT
160e5c31af7Sopenharmony_ci    indicates that access to color and input attachments will have implicit
161e5c31af7Sopenharmony_ci    framebuffer-local memory dependencies, allowing applications to express
162e5c31af7Sopenharmony_ci    custom blending operations in a fragment shader.
163e5c31af7Sopenharmony_ci
164e5c31af7Sopenharmony_ciWhen
165e5c31af7Sopenharmony_ciename:VK_PIPELINE_COLOR_BLEND_STATE_CREATE_RASTERIZATION_ORDER_ATTACHMENT_ACCESS_BIT_EXT
166e5c31af7Sopenharmony_ciis included in a pipeline, it forms a framebuffer-local memory dependency
167e5c31af7Sopenharmony_cifor each fragment generated by draw commands for that pipeline with the
168e5c31af7Sopenharmony_cifollowing scopes:
169e5c31af7Sopenharmony_ci
170e5c31af7Sopenharmony_ci  * The first <<synchronization-dependencies-scopes, synchronization scope>>
171e5c31af7Sopenharmony_ci    includes the ename:VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT
172e5c31af7Sopenharmony_ci    pipeline stage executed by all previous fragments (as defined by
173e5c31af7Sopenharmony_ci    <<drawing-primitive-order, primitive order>>) in the corresponding
174e5c31af7Sopenharmony_ci    <<synchronization-framebuffer-regions, framebuffer regions>> including
175e5c31af7Sopenharmony_ci    those generated by the same draw command.
176e5c31af7Sopenharmony_ci  * The second <<synchronization-dependencies-scopes, synchronization
177e5c31af7Sopenharmony_ci    scope>> includes the ename:VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT
178e5c31af7Sopenharmony_ci    pipeline stage executed by the generated fragment.
179e5c31af7Sopenharmony_ci  * The first <<synchronization-dependencies-access-scopes, access scope>>
180e5c31af7Sopenharmony_ci    includes all writes to color attachments.
181e5c31af7Sopenharmony_ci  * The second <<synchronization-dependencies-access-scopes, access scope>>
182e5c31af7Sopenharmony_ci    includes all reads from input attachments.
183e5c31af7Sopenharmony_ci--
184e5c31af7Sopenharmony_ciendif::VK_EXT_rasterization_order_attachment_access,VK_ARM_rasterization_order_attachment_access[]
185e5c31af7Sopenharmony_ci
186e5c31af7Sopenharmony_ci[open,refpage='VkPipelineColorBlendAttachmentState',desc='Structure specifying a pipeline color blend attachment state',type='structs']
187e5c31af7Sopenharmony_ci--
188e5c31af7Sopenharmony_ciThe sname:VkPipelineColorBlendAttachmentState structure is defined as:
189e5c31af7Sopenharmony_ci
190e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkPipelineColorBlendAttachmentState.adoc[]
191e5c31af7Sopenharmony_ci
192e5c31af7Sopenharmony_ci  * pname:blendEnable controls whether blending is enabled for the
193e5c31af7Sopenharmony_ci    corresponding color attachment.
194e5c31af7Sopenharmony_ci    If blending is not enabled, the source fragment's color for that
195e5c31af7Sopenharmony_ci    attachment is passed through unmodified.
196e5c31af7Sopenharmony_ci  * pname:srcColorBlendFactor selects which blend factor is used to
197e5c31af7Sopenharmony_ci    determine the source factors [eq]#(S~r~,S~g~,S~b~)#.
198e5c31af7Sopenharmony_ci  * pname:dstColorBlendFactor selects which blend factor is used to
199e5c31af7Sopenharmony_ci    determine the destination factors [eq]#(D~r~,D~g~,D~b~)#.
200e5c31af7Sopenharmony_ci  * pname:colorBlendOp selects which blend operation is used to calculate
201e5c31af7Sopenharmony_ci    the RGB values to write to the color attachment.
202e5c31af7Sopenharmony_ci  * pname:srcAlphaBlendFactor selects which blend factor is used to
203e5c31af7Sopenharmony_ci    determine the source factor [eq]#S~a~#.
204e5c31af7Sopenharmony_ci  * pname:dstAlphaBlendFactor selects which blend factor is used to
205e5c31af7Sopenharmony_ci    determine the destination factor [eq]#D~a~#.
206e5c31af7Sopenharmony_ci  * pname:alphaBlendOp selects which blend operation is used to calculate
207e5c31af7Sopenharmony_ci    the alpha values to write to the color attachment.
208e5c31af7Sopenharmony_ci  * pname:colorWriteMask is a bitmask of elink:VkColorComponentFlagBits
209e5c31af7Sopenharmony_ci    specifying which of the R, G, B, and/or A components are enabled for
210e5c31af7Sopenharmony_ci    writing, as described for the <<framebuffer-color-write-mask,Color Write
211e5c31af7Sopenharmony_ci    Mask>>.
212e5c31af7Sopenharmony_ci
213e5c31af7Sopenharmony_ci.Valid Usage
214e5c31af7Sopenharmony_ci****
215e5c31af7Sopenharmony_ci  * [[VUID-VkPipelineColorBlendAttachmentState-srcColorBlendFactor-00608]]
216e5c31af7Sopenharmony_ci    If the <<features-dualSrcBlend, pname:dualSrcBlend>> feature is not
217e5c31af7Sopenharmony_ci    enabled, pname:srcColorBlendFactor must: not be
218e5c31af7Sopenharmony_ci    ename:VK_BLEND_FACTOR_SRC1_COLOR,
219e5c31af7Sopenharmony_ci    ename:VK_BLEND_FACTOR_ONE_MINUS_SRC1_COLOR,
220e5c31af7Sopenharmony_ci    ename:VK_BLEND_FACTOR_SRC1_ALPHA, or
221e5c31af7Sopenharmony_ci    ename:VK_BLEND_FACTOR_ONE_MINUS_SRC1_ALPHA
222e5c31af7Sopenharmony_ci  * [[VUID-VkPipelineColorBlendAttachmentState-dstColorBlendFactor-00609]]
223e5c31af7Sopenharmony_ci    If the <<features-dualSrcBlend, pname:dualSrcBlend>> feature is not
224e5c31af7Sopenharmony_ci    enabled, pname:dstColorBlendFactor must: not be
225e5c31af7Sopenharmony_ci    ename:VK_BLEND_FACTOR_SRC1_COLOR,
226e5c31af7Sopenharmony_ci    ename:VK_BLEND_FACTOR_ONE_MINUS_SRC1_COLOR,
227e5c31af7Sopenharmony_ci    ename:VK_BLEND_FACTOR_SRC1_ALPHA, or
228e5c31af7Sopenharmony_ci    ename:VK_BLEND_FACTOR_ONE_MINUS_SRC1_ALPHA
229e5c31af7Sopenharmony_ci  * [[VUID-VkPipelineColorBlendAttachmentState-srcAlphaBlendFactor-00610]]
230e5c31af7Sopenharmony_ci    If the <<features-dualSrcBlend, pname:dualSrcBlend>> feature is not
231e5c31af7Sopenharmony_ci    enabled, pname:srcAlphaBlendFactor must: not be
232e5c31af7Sopenharmony_ci    ename:VK_BLEND_FACTOR_SRC1_COLOR,
233e5c31af7Sopenharmony_ci    ename:VK_BLEND_FACTOR_ONE_MINUS_SRC1_COLOR,
234e5c31af7Sopenharmony_ci    ename:VK_BLEND_FACTOR_SRC1_ALPHA, or
235e5c31af7Sopenharmony_ci    ename:VK_BLEND_FACTOR_ONE_MINUS_SRC1_ALPHA
236e5c31af7Sopenharmony_ci  * [[VUID-VkPipelineColorBlendAttachmentState-dstAlphaBlendFactor-00611]]
237e5c31af7Sopenharmony_ci    If the <<features-dualSrcBlend, pname:dualSrcBlend>> feature is not
238e5c31af7Sopenharmony_ci    enabled, pname:dstAlphaBlendFactor must: not be
239e5c31af7Sopenharmony_ci    ename:VK_BLEND_FACTOR_SRC1_COLOR,
240e5c31af7Sopenharmony_ci    ename:VK_BLEND_FACTOR_ONE_MINUS_SRC1_COLOR,
241e5c31af7Sopenharmony_ci    ename:VK_BLEND_FACTOR_SRC1_ALPHA, or
242e5c31af7Sopenharmony_ci    ename:VK_BLEND_FACTOR_ONE_MINUS_SRC1_ALPHA
243e5c31af7Sopenharmony_ciifdef::VK_EXT_blend_operation_advanced[]
244e5c31af7Sopenharmony_ci  * [[VUID-VkPipelineColorBlendAttachmentState-colorBlendOp-01406]]
245e5c31af7Sopenharmony_ci    If either of pname:colorBlendOp or pname:alphaBlendOp is an
246e5c31af7Sopenharmony_ci    <<framebuffer-blend-advanced,advanced blend operation>>, then
247e5c31af7Sopenharmony_ci    pname:colorBlendOp must: equal pname:alphaBlendOp
248e5c31af7Sopenharmony_ci  * [[VUID-VkPipelineColorBlendAttachmentState-advancedBlendIndependentBlend-01407]]
249e5c31af7Sopenharmony_ci    If
250e5c31af7Sopenharmony_ci    slink:VkPhysicalDeviceBlendOperationAdvancedPropertiesEXT::pname:advancedBlendIndependentBlend
251e5c31af7Sopenharmony_ci    is ename:VK_FALSE and pname:colorBlendOp is an
252e5c31af7Sopenharmony_ci    <<framebuffer-blend-advanced,advanced blend operation>>, then
253e5c31af7Sopenharmony_ci    pname:colorBlendOp must: be the same for all attachments
254e5c31af7Sopenharmony_ci  * [[VUID-VkPipelineColorBlendAttachmentState-advancedBlendIndependentBlend-01408]]
255e5c31af7Sopenharmony_ci    If
256e5c31af7Sopenharmony_ci    slink:VkPhysicalDeviceBlendOperationAdvancedPropertiesEXT::pname:advancedBlendIndependentBlend
257e5c31af7Sopenharmony_ci    is ename:VK_FALSE and pname:alphaBlendOp is an
258e5c31af7Sopenharmony_ci    <<framebuffer-blend-advanced,advanced blend operation>>, then
259e5c31af7Sopenharmony_ci    pname:alphaBlendOp must: be the same for all attachments
260e5c31af7Sopenharmony_ci  * [[VUID-VkPipelineColorBlendAttachmentState-advancedBlendAllOperations-01409]]
261e5c31af7Sopenharmony_ci    If
262e5c31af7Sopenharmony_ci    slink:VkPhysicalDeviceBlendOperationAdvancedPropertiesEXT::pname:advancedBlendAllOperations
263e5c31af7Sopenharmony_ci    is ename:VK_FALSE, then pname:colorBlendOp must: not be
264e5c31af7Sopenharmony_ci    ename:VK_BLEND_OP_ZERO_EXT, ename:VK_BLEND_OP_SRC_EXT,
265e5c31af7Sopenharmony_ci    ename:VK_BLEND_OP_DST_EXT, ename:VK_BLEND_OP_SRC_OVER_EXT,
266e5c31af7Sopenharmony_ci    ename:VK_BLEND_OP_DST_OVER_EXT, ename:VK_BLEND_OP_SRC_IN_EXT,
267e5c31af7Sopenharmony_ci    ename:VK_BLEND_OP_DST_IN_EXT, ename:VK_BLEND_OP_SRC_OUT_EXT,
268e5c31af7Sopenharmony_ci    ename:VK_BLEND_OP_DST_OUT_EXT, ename:VK_BLEND_OP_SRC_ATOP_EXT,
269e5c31af7Sopenharmony_ci    ename:VK_BLEND_OP_DST_ATOP_EXT, ename:VK_BLEND_OP_XOR_EXT,
270e5c31af7Sopenharmony_ci    ename:VK_BLEND_OP_INVERT_EXT, ename:VK_BLEND_OP_INVERT_RGB_EXT,
271e5c31af7Sopenharmony_ci    ename:VK_BLEND_OP_LINEARDODGE_EXT, ename:VK_BLEND_OP_LINEARBURN_EXT,
272e5c31af7Sopenharmony_ci    ename:VK_BLEND_OP_VIVIDLIGHT_EXT, ename:VK_BLEND_OP_LINEARLIGHT_EXT,
273e5c31af7Sopenharmony_ci    ename:VK_BLEND_OP_PINLIGHT_EXT, ename:VK_BLEND_OP_HARDMIX_EXT,
274e5c31af7Sopenharmony_ci    ename:VK_BLEND_OP_PLUS_EXT, ename:VK_BLEND_OP_PLUS_CLAMPED_EXT,
275e5c31af7Sopenharmony_ci    ename:VK_BLEND_OP_PLUS_CLAMPED_ALPHA_EXT,
276e5c31af7Sopenharmony_ci    ename:VK_BLEND_OP_PLUS_DARKER_EXT, ename:VK_BLEND_OP_MINUS_EXT,
277e5c31af7Sopenharmony_ci    ename:VK_BLEND_OP_MINUS_CLAMPED_EXT, ename:VK_BLEND_OP_CONTRAST_EXT,
278e5c31af7Sopenharmony_ci    ename:VK_BLEND_OP_INVERT_OVG_EXT, ename:VK_BLEND_OP_RED_EXT,
279e5c31af7Sopenharmony_ci    ename:VK_BLEND_OP_GREEN_EXT, or ename:VK_BLEND_OP_BLUE_EXT
280e5c31af7Sopenharmony_ci  * [[VUID-VkPipelineColorBlendAttachmentState-colorBlendOp-01410]]
281e5c31af7Sopenharmony_ci    If pname:colorBlendOp or pname:alphaBlendOp is an
282e5c31af7Sopenharmony_ci    <<framebuffer-blend-advanced,advanced blend operation>>, then
283e5c31af7Sopenharmony_ci    pname:colorAttachmentCount of the subpass this pipeline is compiled
284e5c31af7Sopenharmony_ci    against must: be less than or equal to
285e5c31af7Sopenharmony_ci    slink:VkPhysicalDeviceBlendOperationAdvancedPropertiesEXT::pname:advancedBlendMaxColorAttachments
286e5c31af7Sopenharmony_ciendif::VK_EXT_blend_operation_advanced[]
287e5c31af7Sopenharmony_ciifdef::VK_KHR_portability_subset[]
288e5c31af7Sopenharmony_ci  * [[VUID-VkPipelineColorBlendAttachmentState-constantAlphaColorBlendFactors-04454]]
289e5c31af7Sopenharmony_ci    If the `apiext:VK_KHR_portability_subset` extension is enabled, and
290e5c31af7Sopenharmony_ci    slink:VkPhysicalDevicePortabilitySubsetFeaturesKHR::pname:constantAlphaColorBlendFactors
291e5c31af7Sopenharmony_ci    is ename:VK_FALSE, pname:srcColorBlendFactor must: not be
292e5c31af7Sopenharmony_ci    ename:VK_BLEND_FACTOR_CONSTANT_ALPHA or
293e5c31af7Sopenharmony_ci    ename:VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA
294e5c31af7Sopenharmony_ci  * [[VUID-VkPipelineColorBlendAttachmentState-constantAlphaColorBlendFactors-04455]]
295e5c31af7Sopenharmony_ci    If the `apiext:VK_KHR_portability_subset` extension is enabled, and
296e5c31af7Sopenharmony_ci    slink:VkPhysicalDevicePortabilitySubsetFeaturesKHR::pname:constantAlphaColorBlendFactors
297e5c31af7Sopenharmony_ci    is ename:VK_FALSE, pname:dstColorBlendFactor must: not be
298e5c31af7Sopenharmony_ci    ename:VK_BLEND_FACTOR_CONSTANT_ALPHA or
299e5c31af7Sopenharmony_ci    ename:VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA
300e5c31af7Sopenharmony_ciendif::VK_KHR_portability_subset[]
301e5c31af7Sopenharmony_ci****
302e5c31af7Sopenharmony_ci
303e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkPipelineColorBlendAttachmentState.adoc[]
304e5c31af7Sopenharmony_ci--
305e5c31af7Sopenharmony_ci
306e5c31af7Sopenharmony_ciifdef::VK_EXT_extended_dynamic_state3,VK_EXT_shader_object[]
307e5c31af7Sopenharmony_ci
308e5c31af7Sopenharmony_ci[open,refpage='vkCmdSetColorBlendEnableEXT',desc='Specify the pname:blendEnable for each attachment dynamically for a command buffer',type='protos']
309e5c31af7Sopenharmony_ci--
310e5c31af7Sopenharmony_ciTo <<pipelines-dynamic-state, dynamically set>> pname:blendEnable, call:
311e5c31af7Sopenharmony_ci
312e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdSetColorBlendEnableEXT.adoc[]
313e5c31af7Sopenharmony_ci
314e5c31af7Sopenharmony_ci  * pname:commandBuffer is the command buffer into which the command will be
315e5c31af7Sopenharmony_ci    recorded.
316e5c31af7Sopenharmony_ci  * pname:firstAttachment the first color attachment the color blending
317e5c31af7Sopenharmony_ci    enable applies.
318e5c31af7Sopenharmony_ci  * pname:attachmentCount the number of color blending enables in the
319e5c31af7Sopenharmony_ci    pname:pColorBlendEnables array.
320e5c31af7Sopenharmony_ci  * pname:pColorBlendEnables an array of booleans to indicate whether color
321e5c31af7Sopenharmony_ci    blending is enabled for the corresponding attachment.
322e5c31af7Sopenharmony_ci
323e5c31af7Sopenharmony_ciThis command sets the color blending enable of the specified color
324e5c31af7Sopenharmony_ciattachments for subsequent drawing commands
325e5c31af7Sopenharmony_ciifdef::VK_EXT_shader_object[]
326e5c31af7Sopenharmony_ciifdef::VK_EXT_extended_dynamic_state3[when drawing using <<shaders-objects, shader objects>>, or]
327e5c31af7Sopenharmony_ciifndef::VK_EXT_extended_dynamic_state3[when drawing using <<shaders-objects, shader objects>>.]
328e5c31af7Sopenharmony_ciendif::VK_EXT_shader_object[]
329e5c31af7Sopenharmony_ciifdef::VK_EXT_extended_dynamic_state3[]
330e5c31af7Sopenharmony_ciwhen the graphics pipeline is created with
331e5c31af7Sopenharmony_ciename:VK_DYNAMIC_STATE_COLOR_BLEND_ENABLE_EXT set in
332e5c31af7Sopenharmony_cislink:VkPipelineDynamicStateCreateInfo::pname:pDynamicStates.
333e5c31af7Sopenharmony_ciendif::VK_EXT_extended_dynamic_state3[]
334e5c31af7Sopenharmony_ciOtherwise, this state is specified by the
335e5c31af7Sopenharmony_cislink:VkPipelineColorBlendAttachmentState::pname:blendEnable values used to
336e5c31af7Sopenharmony_cicreate the currently active pipeline.
337e5c31af7Sopenharmony_ci
338e5c31af7Sopenharmony_ci:refpage: vkCmdSetColorBlendEnableEXT
339e5c31af7Sopenharmony_ci:requiredfeature: extendedDynamicState3ColorBlendEnable
340e5c31af7Sopenharmony_ci
341e5c31af7Sopenharmony_ci.Valid Usage
342e5c31af7Sopenharmony_ci****
343e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/dynamic_state3_feature_common.adoc[]
344e5c31af7Sopenharmony_ci****
345e5c31af7Sopenharmony_ci
346e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdSetColorBlendEnableEXT.adoc[]
347e5c31af7Sopenharmony_ci--
348e5c31af7Sopenharmony_ci
349e5c31af7Sopenharmony_ci[open,refpage='vkCmdSetColorBlendEquationEXT',desc='Specify the blend factors and operations dynamically for a command buffer',type='protos']
350e5c31af7Sopenharmony_ci--
351e5c31af7Sopenharmony_ciTo <<pipelines-dynamic-state, dynamically set>> color blend factors and
352e5c31af7Sopenharmony_cioperations, call:
353e5c31af7Sopenharmony_ci
354e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdSetColorBlendEquationEXT.adoc[]
355e5c31af7Sopenharmony_ci
356e5c31af7Sopenharmony_ci  * pname:commandBuffer is the command buffer into which the command will be
357e5c31af7Sopenharmony_ci    recorded.
358e5c31af7Sopenharmony_ci  * pname:firstAttachment the first color attachment the color blend factors
359e5c31af7Sopenharmony_ci    and operations apply to.
360e5c31af7Sopenharmony_ci  * pname:attachmentCount the number of slink:VkColorBlendEquationEXT
361e5c31af7Sopenharmony_ci    elements in the pname:pColorBlendEquations array.
362e5c31af7Sopenharmony_ci  * pname:pColorBlendEquations an array of slink:VkColorBlendEquationEXT
363e5c31af7Sopenharmony_ci    structs that specify the color blend factors and operations for the
364e5c31af7Sopenharmony_ci    corresponding attachments.
365e5c31af7Sopenharmony_ci
366e5c31af7Sopenharmony_ciThis command sets the color blending factors and operations of the specified
367e5c31af7Sopenharmony_ciattachments for subsequent drawing commands
368e5c31af7Sopenharmony_ciifdef::VK_EXT_shader_object[]
369e5c31af7Sopenharmony_ciifdef::VK_EXT_extended_dynamic_state3[when drawing using <<shaders-objects, shader objects>>, or]
370e5c31af7Sopenharmony_ciifndef::VK_EXT_extended_dynamic_state3[when drawing using <<shaders-objects, shader objects>>.]
371e5c31af7Sopenharmony_ciendif::VK_EXT_shader_object[]
372e5c31af7Sopenharmony_ciifdef::VK_EXT_extended_dynamic_state3[]
373e5c31af7Sopenharmony_ciwhen the graphics pipeline is created with
374e5c31af7Sopenharmony_ciename:VK_DYNAMIC_STATE_COLOR_BLEND_EQUATION_EXT set in
375e5c31af7Sopenharmony_cislink:VkPipelineDynamicStateCreateInfo::pname:pDynamicStates.
376e5c31af7Sopenharmony_ciendif::VK_EXT_extended_dynamic_state3[]
377e5c31af7Sopenharmony_ciOtherwise, this state is specified by the
378e5c31af7Sopenharmony_cislink:VkPipelineColorBlendAttachmentState::pname:srcColorBlendFactor,
379e5c31af7Sopenharmony_cislink:VkPipelineColorBlendAttachmentState::pname:dstColorBlendFactor,
380e5c31af7Sopenharmony_cislink:VkPipelineColorBlendAttachmentState::pname:colorBlendOp,
381e5c31af7Sopenharmony_cislink:VkPipelineColorBlendAttachmentState::pname:srcAlphaBlendFactor,
382e5c31af7Sopenharmony_cislink:VkPipelineColorBlendAttachmentState::pname:dstAlphaBlendFactor, and
383e5c31af7Sopenharmony_cislink:VkPipelineColorBlendAttachmentState::pname:alphaBlendOp values used to
384e5c31af7Sopenharmony_cicreate the currently active pipeline.
385e5c31af7Sopenharmony_ci
386e5c31af7Sopenharmony_ci:refpage: vkCmdSetColorBlendEquationEXT
387e5c31af7Sopenharmony_ci:requiredfeature: extendedDynamicState3ColorBlendEquation
388e5c31af7Sopenharmony_ci
389e5c31af7Sopenharmony_ci.Valid Usage
390e5c31af7Sopenharmony_ci****
391e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/dynamic_state3_feature_common.adoc[]
392e5c31af7Sopenharmony_ci****
393e5c31af7Sopenharmony_ci
394e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdSetColorBlendEquationEXT.adoc[]
395e5c31af7Sopenharmony_ci--
396e5c31af7Sopenharmony_ci
397e5c31af7Sopenharmony_ci[open,refpage='VkColorBlendEquationEXT',desc='Structure specifying the color blend factors and operations for an attachment',type='structs']
398e5c31af7Sopenharmony_ci--
399e5c31af7Sopenharmony_ciThe sname:VkColorBlendEquationEXT structure is defined as:
400e5c31af7Sopenharmony_ci
401e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkColorBlendEquationEXT.adoc[]
402e5c31af7Sopenharmony_ci
403e5c31af7Sopenharmony_ci  * pname:srcColorBlendFactor selects which blend factor is used to
404e5c31af7Sopenharmony_ci    determine the source factors [eq]#(S~r~,S~g~,S~b~)#.
405e5c31af7Sopenharmony_ci  * pname:dstColorBlendFactor selects which blend factor is used to
406e5c31af7Sopenharmony_ci    determine the destination factors [eq]#(D~r~,D~g~,D~b~)#.
407e5c31af7Sopenharmony_ci  * pname:colorBlendOp selects which blend operation is used to calculate
408e5c31af7Sopenharmony_ci    the RGB values to write to the color attachment.
409e5c31af7Sopenharmony_ci  * pname:srcAlphaBlendFactor selects which blend factor is used to
410e5c31af7Sopenharmony_ci    determine the source factor [eq]#S~a~#.
411e5c31af7Sopenharmony_ci  * pname:dstAlphaBlendFactor selects which blend factor is used to
412e5c31af7Sopenharmony_ci    determine the destination factor [eq]#D~a~#.
413e5c31af7Sopenharmony_ci  * pname:alphaBlendOp selects which blend operation is use to calculate the
414e5c31af7Sopenharmony_ci    alpha values to write to the color attachment.
415e5c31af7Sopenharmony_ci
416e5c31af7Sopenharmony_ci.Valid Usage
417e5c31af7Sopenharmony_ci****
418e5c31af7Sopenharmony_ci  * [[VUID-VkColorBlendEquationEXT-dualSrcBlend-07357]]
419e5c31af7Sopenharmony_ci    If the <<features-dualSrcBlend, pname:dualSrcBlend>> feature is not
420e5c31af7Sopenharmony_ci    enabled, pname:srcColorBlendFactor must: not be
421e5c31af7Sopenharmony_ci    ename:VK_BLEND_FACTOR_SRC1_COLOR,
422e5c31af7Sopenharmony_ci    ename:VK_BLEND_FACTOR_ONE_MINUS_SRC1_COLOR,
423e5c31af7Sopenharmony_ci    ename:VK_BLEND_FACTOR_SRC1_ALPHA, or
424e5c31af7Sopenharmony_ci    ename:VK_BLEND_FACTOR_ONE_MINUS_SRC1_ALPHA
425e5c31af7Sopenharmony_ci  * [[VUID-VkColorBlendEquationEXT-dualSrcBlend-07358]]
426e5c31af7Sopenharmony_ci    If the <<features-dualSrcBlend, pname:dualSrcBlend>> feature is not
427e5c31af7Sopenharmony_ci    enabled, pname:dstColorBlendFactor must: not be
428e5c31af7Sopenharmony_ci    ename:VK_BLEND_FACTOR_SRC1_COLOR,
429e5c31af7Sopenharmony_ci    ename:VK_BLEND_FACTOR_ONE_MINUS_SRC1_COLOR,
430e5c31af7Sopenharmony_ci    ename:VK_BLEND_FACTOR_SRC1_ALPHA, or
431e5c31af7Sopenharmony_ci    ename:VK_BLEND_FACTOR_ONE_MINUS_SRC1_ALPHA
432e5c31af7Sopenharmony_ci  * [[VUID-VkColorBlendEquationEXT-dualSrcBlend-07359]]
433e5c31af7Sopenharmony_ci    If the <<features-dualSrcBlend, pname:dualSrcBlend>> feature is not
434e5c31af7Sopenharmony_ci    enabled, pname:srcAlphaBlendFactor must: not be
435e5c31af7Sopenharmony_ci    ename:VK_BLEND_FACTOR_SRC1_COLOR,
436e5c31af7Sopenharmony_ci    ename:VK_BLEND_FACTOR_ONE_MINUS_SRC1_COLOR,
437e5c31af7Sopenharmony_ci    ename:VK_BLEND_FACTOR_SRC1_ALPHA, or
438e5c31af7Sopenharmony_ci    ename:VK_BLEND_FACTOR_ONE_MINUS_SRC1_ALPHA
439e5c31af7Sopenharmony_ci  * [[VUID-VkColorBlendEquationEXT-dualSrcBlend-07360]]
440e5c31af7Sopenharmony_ci    If the <<features-dualSrcBlend, pname:dualSrcBlend>> feature is not
441e5c31af7Sopenharmony_ci    enabled, pname:dstAlphaBlendFactor must: not be
442e5c31af7Sopenharmony_ci    ename:VK_BLEND_FACTOR_SRC1_COLOR,
443e5c31af7Sopenharmony_ci    ename:VK_BLEND_FACTOR_ONE_MINUS_SRC1_COLOR,
444e5c31af7Sopenharmony_ci    ename:VK_BLEND_FACTOR_SRC1_ALPHA, or
445e5c31af7Sopenharmony_ci    ename:VK_BLEND_FACTOR_ONE_MINUS_SRC1_ALPHA
446e5c31af7Sopenharmony_ciifdef::VK_EXT_blend_operation_advanced[]
447e5c31af7Sopenharmony_ci  * [[VUID-VkColorBlendEquationEXT-colorBlendOp-07361]]
448e5c31af7Sopenharmony_ci    pname:colorBlendOp and pname:alphaBlendOp must: not be
449e5c31af7Sopenharmony_ci    ename:VK_BLEND_OP_ZERO_EXT, ename:VK_BLEND_OP_SRC_EXT,
450e5c31af7Sopenharmony_ci    ename:VK_BLEND_OP_DST_EXT, ename:VK_BLEND_OP_SRC_OVER_EXT,
451e5c31af7Sopenharmony_ci    ename:VK_BLEND_OP_DST_OVER_EXT, ename:VK_BLEND_OP_SRC_IN_EXT,
452e5c31af7Sopenharmony_ci    ename:VK_BLEND_OP_DST_IN_EXT, ename:VK_BLEND_OP_SRC_OUT_EXT,
453e5c31af7Sopenharmony_ci    ename:VK_BLEND_OP_DST_OUT_EXT, ename:VK_BLEND_OP_SRC_ATOP_EXT,
454e5c31af7Sopenharmony_ci    ename:VK_BLEND_OP_DST_ATOP_EXT, ename:VK_BLEND_OP_XOR_EXT,
455e5c31af7Sopenharmony_ci    ename:VK_BLEND_OP_MULTIPLY_EXT, ename:VK_BLEND_OP_SCREEN_EXT,
456e5c31af7Sopenharmony_ci    ename:VK_BLEND_OP_OVERLAY_EXT, ename:VK_BLEND_OP_DARKEN_EXT,
457e5c31af7Sopenharmony_ci    ename:VK_BLEND_OP_LIGHTEN_EXT, ename:VK_BLEND_OP_COLORDODGE_EXT,
458e5c31af7Sopenharmony_ci    ename:VK_BLEND_OP_COLORBURN_EXT, ename:VK_BLEND_OP_HARDLIGHT_EXT,
459e5c31af7Sopenharmony_ci    ename:VK_BLEND_OP_SOFTLIGHT_EXT, ename:VK_BLEND_OP_DIFFERENCE_EXT,
460e5c31af7Sopenharmony_ci    ename:VK_BLEND_OP_EXCLUSION_EXT, ename:VK_BLEND_OP_INVERT_EXT,
461e5c31af7Sopenharmony_ci    ename:VK_BLEND_OP_INVERT_RGB_EXT, ename:VK_BLEND_OP_LINEARDODGE_EXT,
462e5c31af7Sopenharmony_ci    ename:VK_BLEND_OP_LINEARBURN_EXT, ename:VK_BLEND_OP_VIVIDLIGHT_EXT,
463e5c31af7Sopenharmony_ci    ename:VK_BLEND_OP_LINEARLIGHT_EXT, ename:VK_BLEND_OP_PINLIGHT_EXT,
464e5c31af7Sopenharmony_ci    ename:VK_BLEND_OP_HARDMIX_EXT, ename:VK_BLEND_OP_HSL_HUE_EXT,
465e5c31af7Sopenharmony_ci    ename:VK_BLEND_OP_HSL_SATURATION_EXT, ename:VK_BLEND_OP_HSL_COLOR_EXT,
466e5c31af7Sopenharmony_ci    ename:VK_BLEND_OP_HSL_LUMINOSITY_EXT, ename:VK_BLEND_OP_PLUS_EXT,
467e5c31af7Sopenharmony_ci    ename:VK_BLEND_OP_PLUS_CLAMPED_EXT,
468e5c31af7Sopenharmony_ci    ename:VK_BLEND_OP_PLUS_CLAMPED_ALPHA_EXT,
469e5c31af7Sopenharmony_ci    ename:VK_BLEND_OP_PLUS_DARKER_EXT, ename:VK_BLEND_OP_MINUS_EXT,
470e5c31af7Sopenharmony_ci    ename:VK_BLEND_OP_MINUS_CLAMPED_EXT, ename:VK_BLEND_OP_CONTRAST_EXT,
471e5c31af7Sopenharmony_ci    ename:VK_BLEND_OP_INVERT_OVG_EXT, ename:VK_BLEND_OP_RED_EXT,
472e5c31af7Sopenharmony_ci    ename:VK_BLEND_OP_GREEN_EXT, or ename:VK_BLEND_OP_BLUE_EXT
473e5c31af7Sopenharmony_ciendif::VK_EXT_blend_operation_advanced[]
474e5c31af7Sopenharmony_ciifdef::VK_KHR_portability_subset[]
475e5c31af7Sopenharmony_ci  * [[VUID-VkColorBlendEquationEXT-constantAlphaColorBlendFactors-07362]]
476e5c31af7Sopenharmony_ci    If the `apiext:VK_KHR_portability_subset` extension is enabled, and
477e5c31af7Sopenharmony_ci    slink:VkPhysicalDevicePortabilitySubsetFeaturesKHR::pname:constantAlphaColorBlendFactors
478e5c31af7Sopenharmony_ci    is ename:VK_FALSE, pname:srcColorBlendFactor must: not be
479e5c31af7Sopenharmony_ci    ename:VK_BLEND_FACTOR_CONSTANT_ALPHA or
480e5c31af7Sopenharmony_ci    ename:VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA
481e5c31af7Sopenharmony_ci  * [[VUID-VkColorBlendEquationEXT-constantAlphaColorBlendFactors-07363]]
482e5c31af7Sopenharmony_ci    If the `apiext:VK_KHR_portability_subset` extension is enabled, and
483e5c31af7Sopenharmony_ci    slink:VkPhysicalDevicePortabilitySubsetFeaturesKHR::pname:constantAlphaColorBlendFactors
484e5c31af7Sopenharmony_ci    is ename:VK_FALSE, pname:dstColorBlendFactor must: not be
485e5c31af7Sopenharmony_ci    ename:VK_BLEND_FACTOR_CONSTANT_ALPHA or
486e5c31af7Sopenharmony_ci    ename:VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA
487e5c31af7Sopenharmony_ciendif::VK_KHR_portability_subset[]
488e5c31af7Sopenharmony_ci****
489e5c31af7Sopenharmony_ci
490e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkColorBlendEquationEXT.adoc[]
491e5c31af7Sopenharmony_ci--
492e5c31af7Sopenharmony_ci
493e5c31af7Sopenharmony_ci[open,refpage='vkCmdSetColorWriteMaskEXT',desc='Specify the color write masks for each attachment dynamically for a command buffer',type='protos']
494e5c31af7Sopenharmony_ci--
495e5c31af7Sopenharmony_ciTo <<pipelines-dynamic-state, dynamically set>> the color write masks, call:
496e5c31af7Sopenharmony_ci
497e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdSetColorWriteMaskEXT.adoc[]
498e5c31af7Sopenharmony_ci
499e5c31af7Sopenharmony_ci  * pname:commandBuffer is the command buffer into which the command will be
500e5c31af7Sopenharmony_ci    recorded.
501e5c31af7Sopenharmony_ci  * pname:firstAttachment the first color attachment the color write masks
502e5c31af7Sopenharmony_ci    apply to.
503e5c31af7Sopenharmony_ci  * pname:attachmentCount the number of tlink:VkColorComponentFlags values
504e5c31af7Sopenharmony_ci    in the pname:pColorWriteMasks array.
505e5c31af7Sopenharmony_ci  * pname:pColorWriteMasks an array of tlink:VkColorComponentFlags values
506e5c31af7Sopenharmony_ci    that specify the color write masks of the corresponding attachments.
507e5c31af7Sopenharmony_ci
508e5c31af7Sopenharmony_ciThis command sets the color write masks of the specified attachments for
509e5c31af7Sopenharmony_cisubsequent drawing commands
510e5c31af7Sopenharmony_ciifdef::VK_EXT_shader_object[]
511e5c31af7Sopenharmony_ciifdef::VK_EXT_extended_dynamic_state3[when drawing using <<shaders-objects, shader objects>>, or]
512e5c31af7Sopenharmony_ciifndef::VK_EXT_extended_dynamic_state3[when drawing using <<shaders-objects, shader objects>>.]
513e5c31af7Sopenharmony_ciendif::VK_EXT_shader_object[]
514e5c31af7Sopenharmony_ciifdef::VK_EXT_extended_dynamic_state3[]
515e5c31af7Sopenharmony_ciwhen the graphics pipeline is created with
516e5c31af7Sopenharmony_ciename:VK_DYNAMIC_STATE_COLOR_WRITE_MASK_EXT set in
517e5c31af7Sopenharmony_cislink:VkPipelineDynamicStateCreateInfo::pname:pDynamicStates.
518e5c31af7Sopenharmony_ciendif::VK_EXT_extended_dynamic_state3[]
519e5c31af7Sopenharmony_ciOtherwise, this state is specified by the
520e5c31af7Sopenharmony_cislink:VkPipelineColorBlendAttachmentState::pname:colorWriteMask values used
521e5c31af7Sopenharmony_cito create the currently active pipeline.
522e5c31af7Sopenharmony_ci
523e5c31af7Sopenharmony_ci[NOTE]
524e5c31af7Sopenharmony_ci.Note
525e5c31af7Sopenharmony_ci====
526e5c31af7Sopenharmony_ciFormats with bits that are shared between components specified by
527e5c31af7Sopenharmony_cielink:VkColorComponentFlagBits, such as
528e5c31af7Sopenharmony_ciename:VK_FORMAT_E5B9G9R9_UFLOAT_PACK32, cannot have their channels
529e5c31af7Sopenharmony_ciindividually masked by this functionality; either all components that share
530e5c31af7Sopenharmony_cibits have to be enabled, or none of them.
531e5c31af7Sopenharmony_ci====
532e5c31af7Sopenharmony_ci
533e5c31af7Sopenharmony_ci:refpage: vkCmdSetColorWriteMaskEXT
534e5c31af7Sopenharmony_ci:requiredfeature: extendedDynamicState3ColorWriteMask
535e5c31af7Sopenharmony_ci
536e5c31af7Sopenharmony_ci.Valid Usage
537e5c31af7Sopenharmony_ci****
538e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/dynamic_state3_feature_common.adoc[]
539e5c31af7Sopenharmony_ci****
540e5c31af7Sopenharmony_ci
541e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdSetColorWriteMaskEXT.adoc[]
542e5c31af7Sopenharmony_ci--
543e5c31af7Sopenharmony_ci
544e5c31af7Sopenharmony_ciendif::VK_EXT_extended_dynamic_state3,VK_EXT_shader_object[]
545e5c31af7Sopenharmony_ci
546e5c31af7Sopenharmony_ci
547e5c31af7Sopenharmony_ci[[framebuffer-blendfactors]]
548e5c31af7Sopenharmony_ci=== Blend Factors
549e5c31af7Sopenharmony_ci
550e5c31af7Sopenharmony_ci[open,refpage='VkBlendFactor',desc='Framebuffer blending factors',type='enums']
551e5c31af7Sopenharmony_ci--
552e5c31af7Sopenharmony_ciThe source and destination color and alpha blending factors are selected
553e5c31af7Sopenharmony_cifrom the enum:
554e5c31af7Sopenharmony_ci
555e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VkBlendFactor.adoc[]
556e5c31af7Sopenharmony_ci
557e5c31af7Sopenharmony_ciThe semantics of the enum values are described in the table below:
558e5c31af7Sopenharmony_ci
559e5c31af7Sopenharmony_ci.Blend Factors
560e5c31af7Sopenharmony_ci[width="100%",options="header",align="center",cols="59%,28%,13%"]
561e5c31af7Sopenharmony_ci|====
562e5c31af7Sopenharmony_ci|elink:VkBlendFactor                            | RGB Blend Factors [eq]#(S~r~,S~g~,S~b~)# or [eq]#(D~r~,D~g~,D~b~)# | Alpha Blend Factor ([eq]#S~a~# or [eq]#D~a~#)
563e5c31af7Sopenharmony_ci|ename:VK_BLEND_FACTOR_ZERO                     | [eq]#(0,0,0)#                              | [eq]#0#
564e5c31af7Sopenharmony_ci|ename:VK_BLEND_FACTOR_ONE                      | [eq]#(1,1,1)#                              | [eq]#1#
565e5c31af7Sopenharmony_ci|ename:VK_BLEND_FACTOR_SRC_COLOR                | [eq]#(R~s0~,G~s0~,B~s0~)#                  | [eq]#A~s0~#
566e5c31af7Sopenharmony_ci|ename:VK_BLEND_FACTOR_ONE_MINUS_SRC_COLOR      | [eq]#(1-R~s0~,1-G~s0~,1-B~s0~)#            | [eq]#1-A~s0~#
567e5c31af7Sopenharmony_ci|ename:VK_BLEND_FACTOR_DST_COLOR                | [eq]#(R~d~,G~d~,B~d~)#                     | [eq]#A~d~#
568e5c31af7Sopenharmony_ci|ename:VK_BLEND_FACTOR_ONE_MINUS_DST_COLOR      | [eq]#(1-R~d~,1-G~d~,1-B~d~)#               | [eq]#1-A~d~#
569e5c31af7Sopenharmony_ci|ename:VK_BLEND_FACTOR_SRC_ALPHA                | [eq]#(A~s0~,A~s0~,A~s0~)#                  | [eq]#A~s0~#
570e5c31af7Sopenharmony_ci|ename:VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA      | [eq]#(1-A~s0~,1-A~s0~,1-A~s0~)#            | [eq]#1-A~s0~#
571e5c31af7Sopenharmony_ci|ename:VK_BLEND_FACTOR_DST_ALPHA                | [eq]#(A~d~,A~d~,A~d~)#                     | [eq]#A~d~#
572e5c31af7Sopenharmony_ci|ename:VK_BLEND_FACTOR_ONE_MINUS_DST_ALPHA      | [eq]#(1-A~d~,1-A~d~,1-A~d~)#               | [eq]#1-A~d~#
573e5c31af7Sopenharmony_ci|ename:VK_BLEND_FACTOR_CONSTANT_COLOR           | [eq]#(R~c~,G~c~,B~c~)#                     | [eq]#A~c~#
574e5c31af7Sopenharmony_ci|ename:VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR | [eq]#(1-R~c~,1-G~c~,1-B~c~)#               | [eq]#1-A~c~#
575e5c31af7Sopenharmony_ci|ename:VK_BLEND_FACTOR_CONSTANT_ALPHA           | [eq]#(A~c~,A~c~,A~c~)#                     | [eq]#A~c~#
576e5c31af7Sopenharmony_ci|ename:VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA | [eq]#(1-A~c~,1-A~c~,1-A~c~)#               | [eq]#1-A~c~#
577e5c31af7Sopenharmony_ci|ename:VK_BLEND_FACTOR_SRC_ALPHA_SATURATE       | [eq]#(f,f,f)#; [eq]#f = min(A~s0~,1-A~d~)# | [eq]#1#
578e5c31af7Sopenharmony_ci|ename:VK_BLEND_FACTOR_SRC1_COLOR               | [eq]#(R~s1~,G~s1~,B~s1~)#                  | [eq]#A~s1~#
579e5c31af7Sopenharmony_ci|ename:VK_BLEND_FACTOR_ONE_MINUS_SRC1_COLOR     | [eq]#(1-R~s1~,1-G~s1~,1-B~s1~)#            | [eq]#1-A~s1~#
580e5c31af7Sopenharmony_ci|ename:VK_BLEND_FACTOR_SRC1_ALPHA               | [eq]#(A~s1~,A~s1~,A~s1~)#                  | [eq]#A~s1~#
581e5c31af7Sopenharmony_ci|ename:VK_BLEND_FACTOR_ONE_MINUS_SRC1_ALPHA     | [eq]#(1-A~s1~,1-A~s1~,1-A~s1~)#            | [eq]#1-A~s1~#
582e5c31af7Sopenharmony_ci|====
583e5c31af7Sopenharmony_ci
584e5c31af7Sopenharmony_ciIn this table, the following conventions are used:
585e5c31af7Sopenharmony_ci
586e5c31af7Sopenharmony_ci  * [eq]#R~s0~,G~s0~,B~s0~# and [eq]#A~s0~# represent the first source color
587e5c31af7Sopenharmony_ci    R, G, B, and A components, respectively, for the fragment output
588e5c31af7Sopenharmony_ci    location corresponding to the color attachment being blended.
589e5c31af7Sopenharmony_ci  * [eq]#R~s1~,G~s1~,B~s1~# and [eq]#A~s1~# represent the second source
590e5c31af7Sopenharmony_ci    color R, G, B, and A components, respectively, used in dual source
591e5c31af7Sopenharmony_ci    blending modes, for the fragment output location corresponding to the
592e5c31af7Sopenharmony_ci    color attachment being blended.
593e5c31af7Sopenharmony_ci  * [eq]#R~d~,G~d~,B~d~# and [eq]#A~d~# represent the R, G, B, and A
594e5c31af7Sopenharmony_ci    components of the destination color.
595e5c31af7Sopenharmony_ci    That is, the color currently in the corresponding color attachment for
596e5c31af7Sopenharmony_ci    this fragment/sample.
597e5c31af7Sopenharmony_ci  * [eq]#R~c~,G~c~,B~c~# and [eq]#A~c~# represent the blend constant R, G,
598e5c31af7Sopenharmony_ci    B, and A components, respectively.
599e5c31af7Sopenharmony_ci--
600e5c31af7Sopenharmony_ci
601e5c31af7Sopenharmony_ci[open,refpage='vkCmdSetBlendConstants',desc='Set the values of blend constants',type='protos']
602e5c31af7Sopenharmony_ci--
603e5c31af7Sopenharmony_ciTo <<pipelines-dynamic-state, dynamically set and change>> the blend
604e5c31af7Sopenharmony_ciconstants, call:
605e5c31af7Sopenharmony_ci
606e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdSetBlendConstants.adoc[]
607e5c31af7Sopenharmony_ci
608e5c31af7Sopenharmony_ci  * pname:commandBuffer is the command buffer into which the command will be
609e5c31af7Sopenharmony_ci    recorded.
610e5c31af7Sopenharmony_ci  * pname:blendConstants is a pointer to an array of four values specifying
611e5c31af7Sopenharmony_ci    the [eq]#R~c~#, [eq]#G~c~#, [eq]#B~c~#, and [eq]#A~c~# components of the
612e5c31af7Sopenharmony_ci    blend constant color used in blending, depending on the
613e5c31af7Sopenharmony_ci    <<framebuffer-blendfactors,blend factor>>.
614e5c31af7Sopenharmony_ci
615e5c31af7Sopenharmony_ci[[framebuffer-blendconstants]]
616e5c31af7Sopenharmony_ciThis command sets blend constants for subsequent drawing commands when
617e5c31af7Sopenharmony_ciifdef::VK_EXT_shader_object[when drawing using <<shaders-objects, shader objects>>, or]
618e5c31af7Sopenharmony_cithe graphics pipeline is created with ename:VK_DYNAMIC_STATE_BLEND_CONSTANTS
619e5c31af7Sopenharmony_ciset in slink:VkPipelineDynamicStateCreateInfo::pname:pDynamicStates.
620e5c31af7Sopenharmony_ciOtherwise, this state is specified by the
621e5c31af7Sopenharmony_cislink:VkPipelineColorBlendStateCreateInfo::pname:blendConstants values used
622e5c31af7Sopenharmony_cito create the currently active pipeline.
623e5c31af7Sopenharmony_ci
624e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdSetBlendConstants.adoc[]
625e5c31af7Sopenharmony_ci--
626e5c31af7Sopenharmony_ci
627e5c31af7Sopenharmony_ci
628e5c31af7Sopenharmony_ci[[framebuffer-dsb]]
629e5c31af7Sopenharmony_ci=== Dual-Source Blending
630e5c31af7Sopenharmony_ci
631e5c31af7Sopenharmony_ciBlend factors that use the secondary color input
632e5c31af7Sopenharmony_ci[eq]#(R~s1~,G~s1~,B~s1~,A~s1~)# (ename:VK_BLEND_FACTOR_SRC1_COLOR,
633e5c31af7Sopenharmony_ciename:VK_BLEND_FACTOR_ONE_MINUS_SRC1_COLOR,
634e5c31af7Sopenharmony_ciename:VK_BLEND_FACTOR_SRC1_ALPHA, and
635e5c31af7Sopenharmony_ciename:VK_BLEND_FACTOR_ONE_MINUS_SRC1_ALPHA) may: consume implementation
636e5c31af7Sopenharmony_ciresources that could otherwise be used for rendering to multiple color
637e5c31af7Sopenharmony_ciattachments.
638e5c31af7Sopenharmony_ciTherefore, the number of color attachments that can: be used in a
639e5c31af7Sopenharmony_ciframebuffer may: be lower when using dual-source blending.
640e5c31af7Sopenharmony_ci
641e5c31af7Sopenharmony_ciDual-source blending is only supported if the <<features-dualSrcBlend,
642e5c31af7Sopenharmony_cipname:dualSrcBlend>> feature is enabled.
643e5c31af7Sopenharmony_ci
644e5c31af7Sopenharmony_ciThe maximum number of color attachments that can: be used in a subpass when
645e5c31af7Sopenharmony_ciusing dual-source blending functions is implementation-dependent and is
646e5c31af7Sopenharmony_cireported as the pname:maxFragmentDualSrcAttachments member of
647e5c31af7Sopenharmony_cisname:VkPhysicalDeviceLimits.
648e5c31af7Sopenharmony_ci
649e5c31af7Sopenharmony_ciColor outputs can: be bound to the first and second inputs of the blender
650e5c31af7Sopenharmony_ciusing the code:Index decoration, as described in
651e5c31af7Sopenharmony_ci<<interfaces-fragmentoutput,Fragment Output Interface>>.
652e5c31af7Sopenharmony_ciIf the second color input to the blender is not written in the shader, or if
653e5c31af7Sopenharmony_cino output is bound to the second input of a blender, the value of the second
654e5c31af7Sopenharmony_ciinput is undefined:.
655e5c31af7Sopenharmony_ci
656e5c31af7Sopenharmony_ci
657e5c31af7Sopenharmony_ci[[framebuffer-blendoperations]]
658e5c31af7Sopenharmony_ci=== Blend Operations
659e5c31af7Sopenharmony_ci
660e5c31af7Sopenharmony_ci[open,refpage='VkBlendOp',desc='Framebuffer blending operations',type='enums']
661e5c31af7Sopenharmony_ci--
662e5c31af7Sopenharmony_ciOnce the source and destination blend factors have been selected, they along
663e5c31af7Sopenharmony_ciwith the source and destination components are passed to the blending
664e5c31af7Sopenharmony_cioperations.
665e5c31af7Sopenharmony_ciRGB and alpha components can: use different operations.
666e5c31af7Sopenharmony_ciPossible values of elink:VkBlendOp, specifying the operations, are:
667e5c31af7Sopenharmony_ci
668e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VkBlendOp.adoc[]
669e5c31af7Sopenharmony_ci
670e5c31af7Sopenharmony_ci<<<
671e5c31af7Sopenharmony_ci
672e5c31af7Sopenharmony_ciThe semantics of the basic blend operations are described in the table
673e5c31af7Sopenharmony_cibelow:
674e5c31af7Sopenharmony_ci
675e5c31af7Sopenharmony_ci.Basic Blend Operations
676e5c31af7Sopenharmony_ci[width="100%",cols="45%,30%,25%",options="header",align="center"]
677e5c31af7Sopenharmony_ci|====
678e5c31af7Sopenharmony_ci|elink:VkBlendOp                             | RGB Components                    | Alpha Component
679e5c31af7Sopenharmony_ci
680e5c31af7Sopenharmony_ci|ename:VK_BLEND_OP_ADD
681e5c31af7Sopenharmony_ci| [eq]#R = R~s0~ {times} S~r~ {plus} R~d~ {times} D~r~# +
682e5c31af7Sopenharmony_ci  [eq]#G = G~s0~ {times} S~g~ {plus} G~d~ {times} D~g~# +
683e5c31af7Sopenharmony_ci  [eq]#B = B~s0~ {times} S~b~ {plus} B~d~ {times} D~b~#
684e5c31af7Sopenharmony_ci| [eq]#A = A~s0~ {times} S~a~ {plus} A~d~ {times} D~a~#
685e5c31af7Sopenharmony_ci
686e5c31af7Sopenharmony_ci|ename:VK_BLEND_OP_SUBTRACT
687e5c31af7Sopenharmony_ci| [eq]#R = R~s0~ {times} S~r~ - R~d~ {times} D~r~# +
688e5c31af7Sopenharmony_ci  [eq]#G = G~s0~ {times} S~g~ - G~d~ {times} D~g~# +
689e5c31af7Sopenharmony_ci  [eq]#B = B~s0~ {times} S~b~ - B~d~ {times} D~b~#
690e5c31af7Sopenharmony_ci| [eq]#A = A~s0~ {times} S~a~ - A~d~ {times} D~a~#
691e5c31af7Sopenharmony_ci
692e5c31af7Sopenharmony_ci|ename:VK_BLEND_OP_REVERSE_SUBTRACT
693e5c31af7Sopenharmony_ci| [eq]#R = R~d~ {times} D~r~ - R~s0~ {times} S~r~# +
694e5c31af7Sopenharmony_ci  [eq]#G = G~d~ {times} D~g~ - G~s0~ {times} S~g~# +
695e5c31af7Sopenharmony_ci  [eq]#B = B~d~ {times} D~b~ - B~s0~ {times} S~b~#
696e5c31af7Sopenharmony_ci| [eq]#A = A~d~ {times} D~a~ - A~s0~ {times} S~a~#
697e5c31af7Sopenharmony_ci
698e5c31af7Sopenharmony_ci|ename:VK_BLEND_OP_MIN
699e5c31af7Sopenharmony_ci| [eq]#R = min(R~s0~,R~d~)# +
700e5c31af7Sopenharmony_ci  [eq]#G = min(G~s0~,G~d~)# +
701e5c31af7Sopenharmony_ci  [eq]#B = min(B~s0~,B~d~)#
702e5c31af7Sopenharmony_ci| [eq]#A = min(A~s0~,A~d~)#
703e5c31af7Sopenharmony_ci
704e5c31af7Sopenharmony_ci|ename:VK_BLEND_OP_MAX
705e5c31af7Sopenharmony_ci| [eq]#R = max(R~s0~,R~d~)# +
706e5c31af7Sopenharmony_ci  [eq]#G = max(G~s0~,G~d~)# +
707e5c31af7Sopenharmony_ci  [eq]#B = max(B~s0~,B~d~)#
708e5c31af7Sopenharmony_ci| [eq]#A = max(A~s0~,A~d~)#
709e5c31af7Sopenharmony_ci|====
710e5c31af7Sopenharmony_ci
711e5c31af7Sopenharmony_ciIn this table, the following conventions are used:
712e5c31af7Sopenharmony_ci
713e5c31af7Sopenharmony_ci  * [eq]#R~s0~, G~s0~, B~s0~# and [eq]#A~s0~# represent the first source
714e5c31af7Sopenharmony_ci    color R, G, B, and A components, respectively.
715e5c31af7Sopenharmony_ci  * [eq]#R~d~, G~d~, B~d~# and [eq]#A~d~# represent the R, G, B, and A
716e5c31af7Sopenharmony_ci    components of the destination color.
717e5c31af7Sopenharmony_ci    That is, the color currently in the corresponding color attachment for
718e5c31af7Sopenharmony_ci    this fragment/sample.
719e5c31af7Sopenharmony_ci  * [eq]#S~r~, S~g~, S~b~# and [eq]#S~a~# represent the source blend factor
720e5c31af7Sopenharmony_ci    R, G, B, and A components, respectively.
721e5c31af7Sopenharmony_ci  * [eq]#D~r~, D~g~, D~b~# and [eq]#D~a~# represent the destination blend
722e5c31af7Sopenharmony_ci    factor R, G, B, and A components, respectively.
723e5c31af7Sopenharmony_ci
724e5c31af7Sopenharmony_ciThe blending operation produces a new set of values [eq]#R, G, B# and
725e5c31af7Sopenharmony_ci[eq]#A#, which are written to the framebuffer attachment.
726e5c31af7Sopenharmony_ciIf blending is not enabled for this attachment, then [eq]#R, G, B# and
727e5c31af7Sopenharmony_ci[eq]#A# are assigned [eq]#R~s0~, G~s0~, B~s0~# and [eq]#A~s0~#,
728e5c31af7Sopenharmony_cirespectively.
729e5c31af7Sopenharmony_ci
730e5c31af7Sopenharmony_ciIf the color attachment is fixed-point, the components of the source and
731e5c31af7Sopenharmony_cidestination values and blend factors are each clamped to [eq]#[0,1]# or
732e5c31af7Sopenharmony_ci[eq]#[-1,1]# respectively for an unsigned normalized or signed normalized
733e5c31af7Sopenharmony_cicolor attachment prior to evaluating the blend operations.
734e5c31af7Sopenharmony_ciIf the color attachment is floating-point, no clamping occurs.
735e5c31af7Sopenharmony_ci--
736e5c31af7Sopenharmony_ci
737e5c31af7Sopenharmony_ciIf the <<formats-numericformat, numeric format>> of a framebuffer attachment
738e5c31af7Sopenharmony_ciuses sRGB encoding, the R, G, and B destination color values (after
739e5c31af7Sopenharmony_ciconversion from fixed-point to floating-point) are considered to be encoded
740e5c31af7Sopenharmony_cifor the sRGB color space and hence are linearized prior to their use in
741e5c31af7Sopenharmony_ciblending.
742e5c31af7Sopenharmony_ciEach R, G, and B component is converted from nonlinear to linear as
743e5c31af7Sopenharmony_cidescribed in the "`sRGB EOTF`" section of the <<data-format,Khronos Data
744e5c31af7Sopenharmony_ciFormat Specification>>.
745e5c31af7Sopenharmony_ciIf the format is not sRGB, no linearization is performed.
746e5c31af7Sopenharmony_ci
747e5c31af7Sopenharmony_ciIf the <<formats-numericformat, numeric format>> of a framebuffer attachment
748e5c31af7Sopenharmony_ciuses sRGB encoding, then the final R, G and B values are converted into the
749e5c31af7Sopenharmony_cinonlinear sRGB representation before being written to the framebuffer
750e5c31af7Sopenharmony_ciattachment as described in the "`sRGB EOTF^&#160;-1^`" section of the
751e5c31af7Sopenharmony_ciKhronos Data Format Specification.
752e5c31af7Sopenharmony_ci
753e5c31af7Sopenharmony_ciIf the <<formats-numericformat, numeric format>> of a framebuffer color
754e5c31af7Sopenharmony_ciattachment is not sRGB encoded then the resulting [eq]#c~s~# values for R, G
755e5c31af7Sopenharmony_ciand B are unmodified.
756e5c31af7Sopenharmony_ciThe value of A is never sRGB encoded.
757e5c31af7Sopenharmony_ciThat is, the alpha component is always stored in memory as linear.
758e5c31af7Sopenharmony_ci
759e5c31af7Sopenharmony_ciIf the framebuffer color attachment is ename:VK_ATTACHMENT_UNUSED, no writes
760e5c31af7Sopenharmony_ciare performed through that attachment.
761e5c31af7Sopenharmony_ciWrites are not performed to framebuffer color attachments greater than or
762e5c31af7Sopenharmony_ciequal to the sname:VkSubpassDescription::pname:colorAttachmentCount
763e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2,VK_KHR_create_renderpass2[]
764e5c31af7Sopenharmony_cior sname:VkSubpassDescription2::pname:colorAttachmentCount
765e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2,VK_KHR_create_renderpass2[]
766e5c31af7Sopenharmony_civalue.
767e5c31af7Sopenharmony_ci
768e5c31af7Sopenharmony_ciifdef::VK_EXT_blend_operation_advanced[]
769e5c31af7Sopenharmony_ciinclude::{chapters}/VK_EXT_blend_operation_advanced/advanced_blend.adoc[]
770e5c31af7Sopenharmony_ciendif::VK_EXT_blend_operation_advanced[]
771e5c31af7Sopenharmony_ci
772e5c31af7Sopenharmony_ci
773e5c31af7Sopenharmony_ci[[framebuffer-logicop]]
774e5c31af7Sopenharmony_ci== Logical Operations
775e5c31af7Sopenharmony_ci
776e5c31af7Sopenharmony_ciThe application can: enable a _logical operation_ between the fragment's
777e5c31af7Sopenharmony_cicolor values and the existing value in the framebuffer attachment.
778e5c31af7Sopenharmony_ciThis logical operation is applied prior to updating the framebuffer
779e5c31af7Sopenharmony_ciattachment.
780e5c31af7Sopenharmony_ciLogical operations are applied only for signed and unsigned integer and
781e5c31af7Sopenharmony_cinormalized integer framebuffers.
782e5c31af7Sopenharmony_ciLogical operations are not applied to floating-point or sRGB format color
783e5c31af7Sopenharmony_ciattachments.
784e5c31af7Sopenharmony_ci
785e5c31af7Sopenharmony_ci[open,refpage='VkLogicOp',desc='Framebuffer logical operations',type='enums']
786e5c31af7Sopenharmony_ci--
787e5c31af7Sopenharmony_ciLogical operations are controlled by the pname:logicOpEnable and
788e5c31af7Sopenharmony_cipname:logicOp members of slink:VkPipelineColorBlendStateCreateInfo.
789e5c31af7Sopenharmony_ciifdef::VK_EXT_extended_dynamic_state3[]
790e5c31af7Sopenharmony_ciThe pname:logicOpEnable state can also be controlled by
791e5c31af7Sopenharmony_ciflink:vkCmdSetLogicOpEnableEXT if graphics pipeline is created with
792e5c31af7Sopenharmony_ciename:VK_DYNAMIC_STATE_LOGIC_OP_ENABLE_EXT set in
793e5c31af7Sopenharmony_cislink:VkPipelineDynamicStateCreateInfo::pname:pDynamicStates.
794e5c31af7Sopenharmony_ciendif::VK_EXT_extended_dynamic_state3[]
795e5c31af7Sopenharmony_ciifdef::VK_EXT_extended_dynamic_state2[]
796e5c31af7Sopenharmony_ciThe pname:logicOp state can also be controlled by flink:vkCmdSetLogicOpEXT
797e5c31af7Sopenharmony_ciif graphics pipeline is created with ename:VK_DYNAMIC_STATE_LOGIC_OP_EXT set
798e5c31af7Sopenharmony_ciin slink:VkPipelineDynamicStateCreateInfo::pname:pDynamicStates.
799e5c31af7Sopenharmony_ciendif::VK_EXT_extended_dynamic_state2[]
800e5c31af7Sopenharmony_ciIf pname:logicOpEnable is ename:VK_TRUE, then a logical operation selected
801e5c31af7Sopenharmony_ciby pname:logicOp is applied between each color attachment and the fragment's
802e5c31af7Sopenharmony_cicorresponding output value, and blending of all attachments is treated as if
803e5c31af7Sopenharmony_ciit were disabled.
804e5c31af7Sopenharmony_ciAny attachments using color formats for which logical operations are not
805e5c31af7Sopenharmony_cisupported simply pass through the color values unmodified.
806e5c31af7Sopenharmony_ciThe logical operation is applied independently for each of the red, green,
807e5c31af7Sopenharmony_ciblue, and alpha components.
808e5c31af7Sopenharmony_ciThe pname:logicOp is selected from the following operations:
809e5c31af7Sopenharmony_ci
810e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VkLogicOp.adoc[]
811e5c31af7Sopenharmony_ci
812e5c31af7Sopenharmony_ci<<<
813e5c31af7Sopenharmony_ci
814e5c31af7Sopenharmony_ciThe logical operations supported by Vulkan are summarized in the following
815e5c31af7Sopenharmony_citable in which
816e5c31af7Sopenharmony_ci
817e5c31af7Sopenharmony_ci  * [eq]#{lnot}# is bitwise invert,
818e5c31af7Sopenharmony_ci  * [eq]#{land}# is bitwise and,
819e5c31af7Sopenharmony_ci  * [eq]#{lor}# is bitwise or,
820e5c31af7Sopenharmony_ci  * [eq]#{oplus}# is bitwise exclusive or,
821e5c31af7Sopenharmony_ci  * [eq]#s# is the fragment's [eq]#R~s0~, G~s0~, B~s0~# or [eq]#A~s0~#
822e5c31af7Sopenharmony_ci    component value for the fragment output corresponding to the color
823e5c31af7Sopenharmony_ci    attachment being updated, and
824e5c31af7Sopenharmony_ci  * [eq]#d# is the color attachment's [eq]#R, G, B# or [eq]#A# component
825e5c31af7Sopenharmony_ci    value:
826e5c31af7Sopenharmony_ci
827e5c31af7Sopenharmony_ci.Logical Operations
828e5c31af7Sopenharmony_ci[width="75%",options="header",align="center"]
829e5c31af7Sopenharmony_ci|====
830e5c31af7Sopenharmony_ci|Mode                            | Operation
831e5c31af7Sopenharmony_ci|ename:VK_LOGIC_OP_CLEAR         | [eq]#0#
832e5c31af7Sopenharmony_ci|ename:VK_LOGIC_OP_AND           | [eq]#s {land} d#
833e5c31af7Sopenharmony_ci|ename:VK_LOGIC_OP_AND_REVERSE   | [eq]#s {land} {lnot} d#
834e5c31af7Sopenharmony_ci|ename:VK_LOGIC_OP_COPY          | [eq]#s#
835e5c31af7Sopenharmony_ci|ename:VK_LOGIC_OP_AND_INVERTED  | [eq]#{lnot} s {land} d#
836e5c31af7Sopenharmony_ci|ename:VK_LOGIC_OP_NO_OP         | [eq]#d#
837e5c31af7Sopenharmony_ci|ename:VK_LOGIC_OP_XOR           | [eq]#s {oplus} d#
838e5c31af7Sopenharmony_ci|ename:VK_LOGIC_OP_OR            | [eq]#s {lor} d#
839e5c31af7Sopenharmony_ci|ename:VK_LOGIC_OP_NOR           | [eq]#{lnot} (s {lor} d)#
840e5c31af7Sopenharmony_ci|ename:VK_LOGIC_OP_EQUIVALENT    | [eq]#{lnot} (s {oplus} d)#
841e5c31af7Sopenharmony_ci|ename:VK_LOGIC_OP_INVERT        | [eq]#{lnot} d#
842e5c31af7Sopenharmony_ci|ename:VK_LOGIC_OP_OR_REVERSE    | [eq]#s {lor} {lnot} d#
843e5c31af7Sopenharmony_ci|ename:VK_LOGIC_OP_COPY_INVERTED | [eq]#{lnot} s#
844e5c31af7Sopenharmony_ci|ename:VK_LOGIC_OP_OR_INVERTED   | [eq]#{lnot} s {lor} d#
845e5c31af7Sopenharmony_ci|ename:VK_LOGIC_OP_NAND          | [eq]#{lnot} (s {land} d)#
846e5c31af7Sopenharmony_ci|ename:VK_LOGIC_OP_SET           | all 1s
847e5c31af7Sopenharmony_ci|====
848e5c31af7Sopenharmony_ci
849e5c31af7Sopenharmony_ciThe result of the logical operation is then written to the color attachment
850e5c31af7Sopenharmony_cias controlled by the component write mask, described in
851e5c31af7Sopenharmony_ci<<framebuffer-blendoperations,Blend Operations>>.
852e5c31af7Sopenharmony_ci--
853e5c31af7Sopenharmony_ci
854e5c31af7Sopenharmony_ciifdef::VK_EXT_extended_dynamic_state3,VK_EXT_shader_object[]
855e5c31af7Sopenharmony_ci[open,refpage='vkCmdSetLogicOpEnableEXT',desc='Specify dynamically whether logical operations are enabled for a command buffer',type='protos']
856e5c31af7Sopenharmony_ci--
857e5c31af7Sopenharmony_ciTo <<pipelines-dynamic-state, dynamically set>> whether logical operations
858e5c31af7Sopenharmony_ciare enabled, call:
859e5c31af7Sopenharmony_ci
860e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdSetLogicOpEnableEXT.adoc[]
861e5c31af7Sopenharmony_ci
862e5c31af7Sopenharmony_ci  * pname:commandBuffer is the command buffer into which the command will be
863e5c31af7Sopenharmony_ci    recorded.
864e5c31af7Sopenharmony_ci  * pname:logicOpEnable specifies whether logical operations are enabled.
865e5c31af7Sopenharmony_ci
866e5c31af7Sopenharmony_ciThis command sets whether logical operations are enabled for subsequent
867e5c31af7Sopenharmony_cidrawing commands
868e5c31af7Sopenharmony_ciifdef::VK_EXT_shader_object[]
869e5c31af7Sopenharmony_ciifdef::VK_EXT_extended_dynamic_state3[when drawing using <<shaders-objects, shader objects>>, or]
870e5c31af7Sopenharmony_ciifndef::VK_EXT_extended_dynamic_state3[when drawing using <<shaders-objects, shader objects>>.]
871e5c31af7Sopenharmony_ciendif::VK_EXT_shader_object[]
872e5c31af7Sopenharmony_ciifdef::VK_EXT_extended_dynamic_state3[]
873e5c31af7Sopenharmony_ciwhen the graphics pipeline is created with
874e5c31af7Sopenharmony_ciename:VK_DYNAMIC_STATE_LOGIC_OP_ENABLE_EXT set in
875e5c31af7Sopenharmony_cislink:VkPipelineDynamicStateCreateInfo::pname:pDynamicStates.
876e5c31af7Sopenharmony_ciendif::VK_EXT_extended_dynamic_state3[]
877e5c31af7Sopenharmony_ciOtherwise, this state is specified by the
878e5c31af7Sopenharmony_cislink:VkPipelineColorBlendStateCreateInfo::pname:logicOpEnable value used to
879e5c31af7Sopenharmony_cicreate the currently active pipeline.
880e5c31af7Sopenharmony_ci
881e5c31af7Sopenharmony_ci:refpage: vkCmdSetLogicOpEnableEXT
882e5c31af7Sopenharmony_ci:requiredfeature: extendedDynamicState3LogicOpEnable
883e5c31af7Sopenharmony_ci
884e5c31af7Sopenharmony_ci.Valid Usage
885e5c31af7Sopenharmony_ci****
886e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/dynamic_state3_feature_common.adoc[]
887e5c31af7Sopenharmony_ci  * [[VUID-vkCmdSetLogicOpEnableEXT-logicOp-07366]]
888e5c31af7Sopenharmony_ci    If the <<features-logicOp, pname:logicOp>> feature is not enabled,
889e5c31af7Sopenharmony_ci    pname:logicOpEnable must: be ename:VK_FALSE
890e5c31af7Sopenharmony_ci****
891e5c31af7Sopenharmony_ci
892e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdSetLogicOpEnableEXT.adoc[]
893e5c31af7Sopenharmony_ci--
894e5c31af7Sopenharmony_ciendif::VK_EXT_extended_dynamic_state3,VK_EXT_shader_object[]
895e5c31af7Sopenharmony_ci
896e5c31af7Sopenharmony_ciifdef::VK_EXT_extended_dynamic_state2,VK_EXT_shader_object[]
897e5c31af7Sopenharmony_ci[open,refpage='vkCmdSetLogicOpEXT',desc='Select which logical operation to apply for blend state dynamically for a command buffer',type='protos']
898e5c31af7Sopenharmony_ci--
899e5c31af7Sopenharmony_ciTo <<pipelines-dynamic-state, dynamically set>> the logical operation to
900e5c31af7Sopenharmony_ciapply for blend state, call:
901e5c31af7Sopenharmony_ci
902e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdSetLogicOpEXT.adoc[]
903e5c31af7Sopenharmony_ci
904e5c31af7Sopenharmony_ci  * pname:commandBuffer is the command buffer into which the command will be
905e5c31af7Sopenharmony_ci    recorded.
906e5c31af7Sopenharmony_ci  * pname:logicOp specifies the logical operation to apply for blend state.
907e5c31af7Sopenharmony_ci
908e5c31af7Sopenharmony_ciThis command sets the logical operation for blend state for subsequent
909e5c31af7Sopenharmony_cidrawing commands
910e5c31af7Sopenharmony_ciifdef::VK_EXT_shader_object[]
911e5c31af7Sopenharmony_ciifdef::VK_EXT_extended_dynamic_state2[when drawing using <<shaders-objects, shader objects>>, or]
912e5c31af7Sopenharmony_ciifndef::VK_EXT_extended_dynamic_state2[when drawing using <<shaders-objects, shader objects>>.]
913e5c31af7Sopenharmony_ciendif::VK_EXT_shader_object[]
914e5c31af7Sopenharmony_ciifdef::VK_EXT_extended_dynamic_state2[]
915e5c31af7Sopenharmony_ciwhen the graphics pipeline is created with
916e5c31af7Sopenharmony_ciename:VK_DYNAMIC_STATE_LOGIC_OP_EXT set in
917e5c31af7Sopenharmony_cislink:VkPipelineDynamicStateCreateInfo::pname:pDynamicStates.
918e5c31af7Sopenharmony_ciendif::VK_EXT_extended_dynamic_state2[]
919e5c31af7Sopenharmony_ciOtherwise, this state is specified by the
920e5c31af7Sopenharmony_cislink:VkPipelineColorBlendStateCreateInfo::pname:logicOp value used to
921e5c31af7Sopenharmony_cicreate the currently active pipeline.
922e5c31af7Sopenharmony_ci
923e5c31af7Sopenharmony_ci:refpage: vkCmdSetLogicOpEXT
924e5c31af7Sopenharmony_ci:requiredfeature: extendedDynamicState2LogicOp
925e5c31af7Sopenharmony_ci
926e5c31af7Sopenharmony_ci.Valid Usage
927e5c31af7Sopenharmony_ci****
928e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/dynamic_state2_optional_feature_common.adoc[]
929e5c31af7Sopenharmony_ci****
930e5c31af7Sopenharmony_ci
931e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdSetLogicOpEXT.adoc[]
932e5c31af7Sopenharmony_ci--
933e5c31af7Sopenharmony_ciendif::VK_EXT_extended_dynamic_state2,VK_EXT_shader_object[]
934e5c31af7Sopenharmony_ci
935e5c31af7Sopenharmony_ci
936e5c31af7Sopenharmony_ci[[framebuffer-color-write-mask]]
937e5c31af7Sopenharmony_ci== Color Write Mask
938e5c31af7Sopenharmony_ci
939e5c31af7Sopenharmony_ci[open,refpage='VkColorComponentFlagBits',desc='Bitmask controlling which components are written to the framebuffer',type='enums']
940e5c31af7Sopenharmony_ci--
941e5c31af7Sopenharmony_ciBits which can: be set in
942e5c31af7Sopenharmony_cislink:VkPipelineColorBlendAttachmentState::pname:colorWriteMask, determining
943e5c31af7Sopenharmony_ciwhether the final color values [eq]#R, G, B# and [eq]#A# are written to the
944e5c31af7Sopenharmony_ciframebuffer attachment, are:
945e5c31af7Sopenharmony_ci
946e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VkColorComponentFlagBits.adoc[]
947e5c31af7Sopenharmony_ci
948e5c31af7Sopenharmony_ci  * ename:VK_COLOR_COMPONENT_R_BIT specifies that the [eq]#R# value is
949e5c31af7Sopenharmony_ci    written to the color attachment for the appropriate sample.
950e5c31af7Sopenharmony_ci    Otherwise, the value in memory is unmodified.
951e5c31af7Sopenharmony_ci  * ename:VK_COLOR_COMPONENT_G_BIT specifies that the [eq]#G# value is
952e5c31af7Sopenharmony_ci    written to the color attachment for the appropriate sample.
953e5c31af7Sopenharmony_ci    Otherwise, the value in memory is unmodified.
954e5c31af7Sopenharmony_ci  * ename:VK_COLOR_COMPONENT_B_BIT specifies that the [eq]#B# value is
955e5c31af7Sopenharmony_ci    written to the color attachment for the appropriate sample.
956e5c31af7Sopenharmony_ci    Otherwise, the value in memory is unmodified.
957e5c31af7Sopenharmony_ci  * ename:VK_COLOR_COMPONENT_A_BIT specifies that the [eq]#A# value is
958e5c31af7Sopenharmony_ci    written to the color attachment for the appropriate sample.
959e5c31af7Sopenharmony_ci    Otherwise, the value in memory is unmodified.
960e5c31af7Sopenharmony_ci
961e5c31af7Sopenharmony_ciThe color write mask operation is applied regardless of whether blending is
962e5c31af7Sopenharmony_cienabled.
963e5c31af7Sopenharmony_ci
964e5c31af7Sopenharmony_ciifdef::VK_EXT_color_write_enable[]
965e5c31af7Sopenharmony_ciThe color write mask operation is applied only if
966e5c31af7Sopenharmony_ci<<framebuffer-color-write-enable,Color Write Enable>> is enabled for the
967e5c31af7Sopenharmony_cirespective attachment.
968e5c31af7Sopenharmony_ciOtherwise the color write mask is ignored and writes to all components of
969e5c31af7Sopenharmony_cithe attachment are disabled.
970e5c31af7Sopenharmony_ciendif::VK_EXT_color_write_enable[]
971e5c31af7Sopenharmony_ci--
972e5c31af7Sopenharmony_ci
973e5c31af7Sopenharmony_ci[open,refpage='VkColorComponentFlags',desc='Bitmask of VkColorComponentFlagBits',type='flags']
974e5c31af7Sopenharmony_ci--
975e5c31af7Sopenharmony_ciinclude::{generated}/api/flags/VkColorComponentFlags.adoc[]
976e5c31af7Sopenharmony_ci
977e5c31af7Sopenharmony_citname:VkColorComponentFlags is a bitmask type for setting a mask of zero or
978e5c31af7Sopenharmony_cimore elink:VkColorComponentFlagBits.
979e5c31af7Sopenharmony_ci--
980e5c31af7Sopenharmony_ci
981e5c31af7Sopenharmony_ci
982e5c31af7Sopenharmony_ciifdef::VK_EXT_color_write_enable[]
983e5c31af7Sopenharmony_ci[[framebuffer-color-write-enable]]
984e5c31af7Sopenharmony_ci== Color Write Enable
985e5c31af7Sopenharmony_ci
986e5c31af7Sopenharmony_ci[open,refpage='VkPipelineColorWriteCreateInfoEXT',desc='Structure specifying color write state of a newly created pipeline',type='structs']
987e5c31af7Sopenharmony_ci--
988e5c31af7Sopenharmony_ciThe sname:VkPipelineColorWriteCreateInfoEXT structure is defined as:
989e5c31af7Sopenharmony_ci
990e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkPipelineColorWriteCreateInfoEXT.adoc[]
991e5c31af7Sopenharmony_ci
992e5c31af7Sopenharmony_ci  * pname:sType is a elink:VkStructureType value identifying this structure.
993e5c31af7Sopenharmony_ci  * pname:pNext is `NULL` or a pointer to a structure extending this
994e5c31af7Sopenharmony_ci    structure.
995e5c31af7Sopenharmony_ci  * pname:attachmentCount is the number of basetype:VkBool32 elements in
996e5c31af7Sopenharmony_ci    pname:pColorWriteEnables.
997e5c31af7Sopenharmony_ci  * pname:pColorWriteEnables is a pointer to an array of per target
998e5c31af7Sopenharmony_ci    attachment boolean values specifying whether color writes are enabled
999e5c31af7Sopenharmony_ci    for the given attachment.
1000e5c31af7Sopenharmony_ci
1001e5c31af7Sopenharmony_ciWhen this structure is included in the pname:pNext chain of
1002e5c31af7Sopenharmony_cislink:VkPipelineColorBlendStateCreateInfo, it defines per-attachment color
1003e5c31af7Sopenharmony_ciwrite state.
1004e5c31af7Sopenharmony_ciIf this structure is not included in the pname:pNext chain, it is equivalent
1005e5c31af7Sopenharmony_cito specifying this structure with pname:attachmentCount equal to the
1006e5c31af7Sopenharmony_cipname:attachmentCount member of slink:VkPipelineColorBlendStateCreateInfo,
1007e5c31af7Sopenharmony_ciand pname:pColorWriteEnables pointing to an array of as many ename:VK_TRUE
1008e5c31af7Sopenharmony_civalues.
1009e5c31af7Sopenharmony_ci
1010e5c31af7Sopenharmony_ciIf the <<features-colorWriteEnable, pname:colorWriteEnable>> feature is not
1011e5c31af7Sopenharmony_cienabled on the device, all basetype:VkBool32 elements in the
1012e5c31af7Sopenharmony_cipname:pColorWriteEnables array must: be ename:VK_TRUE.
1013e5c31af7Sopenharmony_ci
1014e5c31af7Sopenharmony_ciColor Write Enable interacts with the <<framebuffer-color-write-mask,Color
1015e5c31af7Sopenharmony_ciWrite Mask>> as follows:
1016e5c31af7Sopenharmony_ci
1017e5c31af7Sopenharmony_ci  * If pname:colorWriteEnable is ename:VK_TRUE, writes to the attachment are
1018e5c31af7Sopenharmony_ci    determined by the pname:colorWriteMask.
1019e5c31af7Sopenharmony_ci  * If pname:colorWriteEnable is ename:VK_FALSE, the pname:colorWriteMask is
1020e5c31af7Sopenharmony_ci    ignored and writes to all components of the attachment are disabled.
1021e5c31af7Sopenharmony_ci    This is equivalent to specifying a pname:colorWriteMask of 0.
1022e5c31af7Sopenharmony_ci
1023e5c31af7Sopenharmony_ci.Valid Usage
1024e5c31af7Sopenharmony_ci****
1025e5c31af7Sopenharmony_ci  * [[VUID-VkPipelineColorWriteCreateInfoEXT-pAttachments-04801]]
1026e5c31af7Sopenharmony_ci    If the <<features-colorWriteEnable, pname:colorWriteEnable>> feature is
1027e5c31af7Sopenharmony_ci    not enabled, all elements of pname:pColorWriteEnables must: be
1028e5c31af7Sopenharmony_ci    ename:VK_TRUE
1029e5c31af7Sopenharmony_ci  * [[VUID-VkPipelineColorWriteCreateInfoEXT-attachmentCount-07608]]
1030e5c31af7Sopenharmony_ciifdef::VK_EXT_extended_dynamic_state3[]
1031e5c31af7Sopenharmony_ci    If the pipeline is being created with
1032e5c31af7Sopenharmony_ci    ename:VK_DYNAMIC_STATE_COLOR_BLEND_ADVANCED_EXT,
1033e5c31af7Sopenharmony_ci    ename:VK_DYNAMIC_STATE_COLOR_BLEND_ENABLE_EXT,
1034e5c31af7Sopenharmony_ci    ename:VK_DYNAMIC_STATE_COLOR_BLEND_EQUATION_EXT, or
1035e5c31af7Sopenharmony_ci    ename:VK_DYNAMIC_STATE_COLOR_WRITE_MASK_EXT dynamic states not set,
1036e5c31af7Sopenharmony_ciendif::VK_EXT_extended_dynamic_state3[]
1037e5c31af7Sopenharmony_ci    pname:attachmentCount must: be equal to the pname:attachmentCount member
1038e5c31af7Sopenharmony_ci    of the sname:VkPipelineColorBlendStateCreateInfo structure specified
1039e5c31af7Sopenharmony_ci    during pipeline creation
1040e5c31af7Sopenharmony_ci  * [[VUID-VkPipelineColorWriteCreateInfoEXT-attachmentCount-06655]]
1041e5c31af7Sopenharmony_ci    pname:attachmentCount must: be less than or equal to the
1042e5c31af7Sopenharmony_ci    pname:maxColorAttachments member of sname:VkPhysicalDeviceLimits
1043e5c31af7Sopenharmony_ci****
1044e5c31af7Sopenharmony_ci
1045e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkPipelineColorWriteCreateInfoEXT.adoc[]
1046e5c31af7Sopenharmony_ci--
1047e5c31af7Sopenharmony_ci
1048e5c31af7Sopenharmony_ci[open,refpage='vkCmdSetColorWriteEnableEXT',desc='Enable or disable writes to a color attachment dynamically for a command buffer',type='protos']
1049e5c31af7Sopenharmony_ci--
1050e5c31af7Sopenharmony_ciTo <<pipelines-dynamic-state, dynamically enable or disable>> writes to a
1051e5c31af7Sopenharmony_cicolor attachment, call:
1052e5c31af7Sopenharmony_ci
1053e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdSetColorWriteEnableEXT.adoc[]
1054e5c31af7Sopenharmony_ci
1055e5c31af7Sopenharmony_ci  * pname:commandBuffer is the command buffer into which the command will be
1056e5c31af7Sopenharmony_ci    recorded.
1057e5c31af7Sopenharmony_ci  * pname:attachmentCount is the number of basetype:VkBool32 elements in
1058e5c31af7Sopenharmony_ci    pname:pColorWriteEnables.
1059e5c31af7Sopenharmony_ci  * pname:pColorWriteEnables is a pointer to an array of per target
1060e5c31af7Sopenharmony_ci    attachment boolean values specifying whether color writes are enabled
1061e5c31af7Sopenharmony_ci    for the given attachment.
1062e5c31af7Sopenharmony_ci
1063e5c31af7Sopenharmony_ciThis command sets the color write enables for subsequent drawing commands
1064e5c31af7Sopenharmony_ciifdef::VK_EXT_shader_object[when drawing using <<shaders-objects, shader objects>>, or]
1065e5c31af7Sopenharmony_ciwhen the graphics pipeline is created with
1066e5c31af7Sopenharmony_ciename:VK_DYNAMIC_STATE_COLOR_WRITE_ENABLE_EXT set in
1067e5c31af7Sopenharmony_cislink:VkPipelineDynamicStateCreateInfo::pname:pDynamicStates.
1068e5c31af7Sopenharmony_ciOtherwise, this state is specified by the
1069e5c31af7Sopenharmony_cislink:VkPipelineColorWriteCreateInfoEXT::pname:pColorWriteEnables values
1070e5c31af7Sopenharmony_ciused to create the currently active pipeline.
1071e5c31af7Sopenharmony_ci
1072e5c31af7Sopenharmony_ci.Valid Usage
1073e5c31af7Sopenharmony_ci****
1074e5c31af7Sopenharmony_ci  * [[VUID-vkCmdSetColorWriteEnableEXT-None-04803]]
1075e5c31af7Sopenharmony_ci    The <<features-colorWriteEnable, pname:colorWriteEnable>> feature must:
1076e5c31af7Sopenharmony_ci    be enabled
1077e5c31af7Sopenharmony_ci  * [[VUID-vkCmdSetColorWriteEnableEXT-attachmentCount-06656]]
1078e5c31af7Sopenharmony_ci    pname:attachmentCount must: be less than or equal to the
1079e5c31af7Sopenharmony_ci    pname:maxColorAttachments member of sname:VkPhysicalDeviceLimits
1080e5c31af7Sopenharmony_ci****
1081e5c31af7Sopenharmony_ci
1082e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdSetColorWriteEnableEXT.adoc[]
1083e5c31af7Sopenharmony_ci--
1084e5c31af7Sopenharmony_ciendif::VK_EXT_color_write_enable[]
1085e5c31af7Sopenharmony_ci
1086e5c31af7Sopenharmony_ci
1087e5c31af7Sopenharmony_ciifdef::VK_QCOM_tile_properties[]
1088e5c31af7Sopenharmony_ci[[framebuffer-queries]]
1089e5c31af7Sopenharmony_ci== Framebuffer Query Instructions
1090e5c31af7Sopenharmony_ci
1091e5c31af7Sopenharmony_ci[open,refpage='vkGetFramebufferTilePropertiesQCOM',desc='Get tile properties from the attachments in framebuffer',type='protos']
1092e5c31af7Sopenharmony_ci--
1093e5c31af7Sopenharmony_ciTo query the tile properties from the attachments in framebuffer, call:
1094e5c31af7Sopenharmony_ci
1095e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkGetFramebufferTilePropertiesQCOM.adoc[]
1096e5c31af7Sopenharmony_ci
1097e5c31af7Sopenharmony_ci  * pname:device is a logical device associated with the framebuffer.
1098e5c31af7Sopenharmony_ci  * pname:framebuffer is a handle of the framebuffer to query.
1099e5c31af7Sopenharmony_ci  * pname:pPropertiesCount is a pointer to an integer related to the number
1100e5c31af7Sopenharmony_ci    of tile properties available or queried, as described below.
1101e5c31af7Sopenharmony_ci  * pname:pProperties is either `NULL` or a pointer to an array of
1102e5c31af7Sopenharmony_ci    slink:VkTilePropertiesQCOM structures.
1103e5c31af7Sopenharmony_ci
1104e5c31af7Sopenharmony_ciIf pname:pProperties is `NULL`, then the number of tile properties available
1105e5c31af7Sopenharmony_ciis returned in pname:pPropertiesCount.
1106e5c31af7Sopenharmony_ciOtherwise, pname:pPropertiesCount must: point to a variable set by the user
1107e5c31af7Sopenharmony_cito the number of elements in the pname:pProperties array, and on return the
1108e5c31af7Sopenharmony_civariable is overwritten with the number of properties actually written to
1109e5c31af7Sopenharmony_cipname:pProperties.
1110e5c31af7Sopenharmony_ciIf pname:pPropertiesCount is less than the number of tile properties
1111e5c31af7Sopenharmony_ciavailable, at most pname:pPropertiesCount structures will be written, and
1112e5c31af7Sopenharmony_ciename:VK_INCOMPLETE will be returned instead of ename:VK_SUCCESS, to
1113e5c31af7Sopenharmony_ciindicate that not all the available properties were returned.
1114e5c31af7Sopenharmony_ci
1115e5c31af7Sopenharmony_ciThe number of tile properties available is determined by the number of
1116e5c31af7Sopenharmony_cimerged subpasses, and each tile property is associated with a merged
1117e5c31af7Sopenharmony_cisubpass.
1118e5c31af7Sopenharmony_ciThere will be at most as many properties as there are subpasses within the
1119e5c31af7Sopenharmony_cirender pass.
1120e5c31af7Sopenharmony_ciTo obtain the tile properties for a given merged subpass, the `pProperties`
1121e5c31af7Sopenharmony_ciarray can be indexed using the `postMergeIndex` value provided in
1122e5c31af7Sopenharmony_cislink:VkRenderPassSubpassFeedbackInfoEXT.
1123e5c31af7Sopenharmony_ci
1124e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkGetFramebufferTilePropertiesQCOM.adoc[]
1125e5c31af7Sopenharmony_ci--
1126e5c31af7Sopenharmony_ciendif::VK_QCOM_tile_properties[]
1127