Description
SampleMask
-
Decorating a variable with the
SampleMask
built-in decoration will make any variable contain the sample mask for the current fragment shader invocation.A variable in the
Input
storage class decorated withSampleMask
will contain a bitmask of the set of samples covered by the primitive generating the fragment during rasterization. It has a sample bit set if and only if the sample is considered covered for this fragment shader invocation.SampleMask
[] is an array of integers. Bits are mapped to samples in a manner where bit B of mask M (SampleMask[M]
) corresponds to sample 32 × M + B.A variable in the
Output
storage class decorated withSampleMask
is an array of integers forming a bit array in a manner similar to an input variable decorated withSampleMask
, but where each bit represents coverage as computed by the shader. This computedSampleMask
is combined with the generated coverage mask in the multisample coverage operation.Variables decorated with
SampleMask
must be either an unsized array, or explicitly sized to be no larger than the implementation-dependent maximum sample-mask (as an array of 32-bit elements), determined by the maximum number of samples.If a fragment shader entry point’s interface includes an output variable decorated with
SampleMask
, the sample mask will be undefined for any array elements of any fragment shader invocations that fail to assign a value. If a fragment shader entry point’s interface does not include an output variable decorated withSampleMask
, the sample mask has no effect on the processing of a fragment.
Document Notes
For more information, see the Vulkan Specification
This page is extracted from the Vulkan Specification. Fixes and changes should be made to the Specification, not directly.