Vulkan-Docs/doc/specs/vulkan/man/VkBlendOp.txt

114 lines
3.8 KiB
Plaintext

// Copyright (c) 2014-2016 Khronos Group. This work is licensed under a
// Creative Commons Attribution 4.0 International License; see
// http://creativecommons.org/licenses/by/4.0/
VkBlendOp(3)
============
Name
----
VkBlendOp - framebuffer blending operations
C Specification
---------------
// refBegin VkBlendOp framebuffer blending operations
Once the source and destination blend factors have been selected, they along
with the source and destination components are passed to the blending
operation. The blending operations are selected from the following enum,
with RGB and alpha components potentially using different blend operations:
include::../enums/VkBlendOp.txt[]
Description
-----------
<<<
The semantics of each enum value is described in the table below:
.Blend Operations
[width="100%",cols="45%,30%,25%",options="header",align="center"]
|==========================================
|VkBlendOp | RGB Components | Alpha Component
|ename:VK_BLEND_OP_ADD
| latexmath:[$R=R_{s0}\times S_r+R_d\times D_r$] +
latexmath:[$G=G_{s0}\times S_g+G_d\times D_g$] +
latexmath:[$B=B_{s0}\times S_b+B_d\times D_b$]
| latexmath:[$A=A_{s0}\times S_a+A_d\times D_a$]
|ename:VK_BLEND_OP_SUBTRACT
| latexmath:[$R=R_{s0}\times S_r-R_d\times D_r$] +
latexmath:[$G=G_{s0}\times S_g-G_d\times D_g$] +
latexmath:[$B=B_{s0}\times S_b-B_d\times D_b$]
| latexmath:[$A=A_{s0}\times S_a-A_d\times D_a$]
|ename:VK_BLEND_OP_REVERSE_SUBTRACT
| latexmath:[$R=R_d\times D_r-R_{s0}\times S_r$] +
latexmath:[$G=G_d\times D_g-G_{s0}\times S_g$] +
latexmath:[$B=B_d\times D_b-B_{s0}\times S_b$]
| latexmath:[$A=A_d\times D_a-A_{s0}\times S_a$]
|ename:VK_BLEND_OP_MIN
| latexmath:[$R=\min(R_{s0},R_d)$] +
latexmath:[$G=\min(G_{s0},G_d)$] +
latexmath:[$B=\min(B_{s0},B_d)$]
| latexmath:[$A=\min(A_{s0},A_d)$]
|ename:VK_BLEND_OP_MAX
| latexmath:[$R=\max(R_{s0},R_d)$] +
latexmath:[$G=\max(G_{s0},G_d)$] +
latexmath:[$B=\max(B_{s0},B_d)$]
| latexmath:[$A=\max(A_{s0},A_d)$]
|==========================================
In this table, the following conventions are used:
- latexmath:[$R_{s0},G_{s0},B_{s0}$] and latexmath:[$A_{s0}$] represent
the first source color R, G, B, and A components, respectively.
- latexmath:[$R_d,G_d,B_d$] and latexmath:[$A_d$] represent the R, G, B,
and A components of the destination color. That is, the color currently
in the corresponding color attachment for this fragment/sample.
- latexmath:[$S_r,S_g,S_b$] and latexmath:[$S_a$] represent the source
blend factor R, G, B, and A components, respectively.
- latexmath:[$D_r,D_g,D_b$] and latexmath:[$D_a$] represent the
destination blend factor R, G, B, and A components, respectively.
The blending operation produces a new set of values latexmath:[$R, G,
B$] and latexmath:[$A$], which are written to the framebuffer attachment. If
blending is not enabled for this attachment, then latexmath:[$R, G, B$] and
latexmath:[$A$] are assigned
latexmath:[$R_{s0},G_{s0},B_{s0}$] and latexmath:[$A_{s0}$], respectively.
If the color attachment is fixed-point, the components of the source and
destination values and blend factors are each clamped to
latexmath:[$[0,1\]$] or latexmath:[$[-1,1\]$] respectively for an unsigned
normalized or signed normalized color attachment prior to evaluating the
blend operations. If the color attachment is floating-point, no clamping
occurs.
// refEnd VkBlendOp
See Also
--------
slink:VkPipelineColorBlendAttachmentState
Document Notes
--------------
For more information, see the Vulkan Specification at URL
https://www.khronos.org/registry/vulkan/specs/1.0/xhtml/vkspec.html#VkBlendOp
This page is extracted from the Vulkan Specification.
Fixes and changes should be made to the Specification,not directly.
include::footer.txt[]