When a fragment stage is present in a pipeline, the fragment shader
subpass inputs form an interface with the input attachments of the
current subpass. The fragment shader subpass input variables are
matched by InputAttachmentIndex
decorations to the input
attachments specified in the pInputAttachments
array of the
VkSubpassDescription
structure that describes the subpass that
the fragment shader is executed in.
The fragment shader subpass input variables with the UniformConstant
storage class and a decoration of InputAttachmentIndex
that are
statically used by OpEntryPoint
form the fragment input
attachment interface. These variables must be declared with a type
of OpTypeImage
, a Dim
operand of SubpassData
, and a
Sampled
operand of 2.
A subpass input variable identified with an InputAttachmentIndex
decoration of i reads from the input attachment indicated by
pInputAttachments
[i] member of VkSubpassDescription
.
If the subpass input variable is declared
as an array of size N, it consumes N consecutive input attachments,
starting with the index specified. There must not be more than one input
variable with the same InputAttachmentIndex
whether explicitly declared
or implied by an array declaration. The number of available input attachment
indices is given by the maxPerStageDescriptorInputAttachments
member
of the VkPhysicalDeviceLimits
structure.
Variables identified with the InputAttachmentIndex
must only be
used by a fragment stage. The basic data type (floating-point,
integer, unsigned integer) of the subpass input must match the basic
format of the corresponding input attachment, or the values of subpass
loads from these variables are undefined.
See Section 13.1.11, “Input Attachment” for more details.