Files
Vulkan-Samples/samples/extensions/dynamic_blending
2025-09-04 10:54:47 +08:00
..
2025-09-04 10:54:47 +08:00
2025-09-04 10:54:47 +08:00
2025-09-04 10:54:47 +08:00
2025-09-04 10:54:47 +08:00

////
- Copyright (c) 2023, Mobica Limited
-
- SPDX-License-Identifier: Apache-2.0
-
- Licensed under the Apache License, Version 2.0 the "License";
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
-     http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
////

= Dynamic blending

== Overview

This sample demonstrates the functionality of VK_EXT_extended_dynamic_state3 related to blending. It includes the
following features: 

* `vkCmdSetColorBlendEnableEXT`: toggles blending on and off.
* `vkCmdSetColorBlendEquationEXT`: modifies blending operators and factors. 
* `vkCmdSetColorBlendAdvancedEXT`: utilizes more complex blending operators. 
* `vkCmdSetColorWriteMaskEXT`: toggles individual channels on and off.

== How to use in Vulkan

To utilize this feature, the device extension `VK_EXT_EXTENDED_DYNAMIC_STATE_3_EXTENSION_NAME` need to be enabled.
The extension `VK_EXT_BLEND_OPERATION_ADVANCED_EXTENSION_NAME` is required for the advanced blend equations.
All presented functions take an array of objects defining their action for subsequent color attachments:

* The `vkCmdSetColorBlendEnableEXT`
function expects an array of booleans to toggle blending.
* The `vkCmdSetColorBlendEquationEXT` function expects an array of
`VkColorBlendEquationEXT` objects which determine operators and factors for
color and alpha blending.
* The `VkCmdSetColorBlendAdvancedEXT` function expects an array of `VkColorBlendAdvancedEXT` objects, which determine
blending operators and premultiplication for color blending.
* The `vkCmdSetColorWriteMaskEXT` function expects an array of
`VkColorComponentFlags` objects. These objects can be created by combining
the desired color bit flags using bitwise oring.

== The sample

The sample demonstrates how to set up an application to work with this
extension: 

* Enabling the extension. 
* Setting parameters for the presented methods.

The sample demonstrates how the use of each operator affects color blending.

== Documentation links

https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkCmdSetColorBlendEnableEXT.html

https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkCmdSetColorBlendEquationEXT.html

https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkCmdSetColorBlendAdvancedEXT.html

https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkCmdSetColorWriteMaskEXT.html