## 8.11. Interpolation Decorations

Interpolation decorations control the behavior of attribute interpolation in the fragment shader stage. Interpolation decorations can be applied to `Input` storage class variables in the fragment shader stage’s interface, and control the interpolation behavior of those variables.

Inputs that could be interpolated can be decorated by at most one of the following decorations:

- `Flat`: no interpolation
- `NoPerspective`: linear interpolation (for lines and polygons).

Fragment input variables decorated with neither `Flat` nor `NoPerspective` use perspective-correct interpolation (for lines and polygons).

The presence of and type of interpolation is controlled by the above interpolation decorations as well as the auxiliary decorations `Centroid` and `Sample`.

A variable decorated with `Flat` will not be interpolated. Instead, it will have the same value for every fragment within a triangle. This value will come from a single provoking vertex. A variable decorated with `Flat` can also be decorated with `Centroid` or `Sample`, which will mean the same thing as decorating it only as `Flat`.

For fragment shader input variables decorated with neither `Centroid` nor `Sample`, the assigned variable may be interpolated anywhere within the pixel and a single value may be assigned to each sample within the pixel.

`Centroid` and `Sample` can be used to control the location and frequency of the sampling of the decorated fragment shader input. If a fragment shader input is decorated with `Centroid`, a single value may be assigned to that variable for all samples in the pixel, but that value must be interpolated to a location that lies in both the pixel and in the primitive being rendered, including any of the pixel’s samples covered by the primitive. Because the location at which the variable is interpolated may be different in neighboring pixels, and derivatives may be computed by computing differences between neighboring pixels, derivatives of centroid-sampled inputs may be less accurate than those for non-centroid interpolated variables. If a fragment shader input is decorated with `Sample`, a separate value must be assigned to that variable for each covered sample in the pixel, and that value must be sampled at the location of the individual sample. When `rasterizationSamples` is `VK_SAMPLE_COUNT_1_BIT`, the pixel center must be used for `Centroid`, `Sample`, and undecorated attribute interpolation.

Fragment shader inputs that are signed or unsigned integers, integer vectors, or any double-precision floating-point type must be decorated with `Flat`.