If a fragment shader is active and its entry point’s interface includes a
built-in output variable decorated with SampleMask, the fragment
coverage is ANDed with the bits of the sample mask to generate a new
fragment coverage value.
If such a fragment shader did not assign a value to SampleMask due to
flow of control, the value ANDed with the fragment coverage is
undefined.
If no fragment shader is active, or if the active fragment shader does not
include SampleMask in its interface, the fragment coverage is not
modified.
Next, the fragment alpha and coverage values are modified based on the
alphaToCoverageEnable and alphaToOneEnable members of the
VkPipelineMultisampleStateCreateInfo structure.
All alpha values in this section refer only to the alpha component of the
fragment shader output that has a Location and Index decoration of
zero (see the Fragment Output Interface
section).
If that shader output has an integer or unsigned integer type, then these
operations are skipped.
If alphaToCoverageEnable is enabled, a temporary coverage value is
generated where each bit is determined by the fragment’s alpha value.
The temporary coverage value is then ANDed with the fragment coverage value
to generate a new fragment coverage value.
No specific algorithm is specified for converting the alpha value to a temporary coverage mask. It is intended that the number of 1’s in this value be proportional to the alpha value (clamped to [0,1]), with all 1’s corresponding to a value of 1.0 and all 0’s corresponding to 0.0. The algorithm may be different at different pixel locations.
| Note | |
|---|---|
Using different algorithms at different pixel location may help to avoid artifacts caused by regular coverage sample locations. |
Next, if alphaToOneEnable is enabled, each alpha value is replaced by
the maximum representable alpha value for fixed-point color buffers, or by
1.0 for floating-point buffers.
Otherwise, the alpha values are not changed.