Behaviour

Description

[Flags]
enum Tinman.Gpu.Semantic.Behaviour

Enumeration of special behaviour flags for values that are passed between shader stages.

The interpolation mode for a pixel shader input value is defined by the following flags:

  1. If NoInterpolation is present, the value will not be interpolated. It will be copied from the provoking vertex instead.

  2. Otherwise, if NoPerspective is present, interpolation without perspective correction will be applied to the value.

  3. Otherwise, interpolation with perspective correction will be applied to the value.

The sampling mode for interpolated pixel shader input values can be controlled as follows:

  1. If Sample is present, the pixel shader will run per sample and the value will be sampled at the respective sample location, which will always be inside the graphics primitive.

  2. If Centroid is present and Center is absent, the value will be sampled at an unspecified location (chosen by the GPU) that is inside the graphics primitive.

  3. Otherwise, the value will be sampled at the pixel center, which might lie be outside the graphics primitive.

See also

With

Public / Constants

None

public constant None → (0:int32)

No special behaviour.

NoPerspective

public constant NoPerspective → (1:int32)

Do not perform perspective correction during interpolation.

See also

PixelShader

Centroid

public constant Centroid → (2:int32)

Use centroid sampling instead of pixel-center sampling when running at pixel frequency and if Center is not present.

When using multi-sampling at pixel frequency, the pixel shader is executed only once and its output is copied to those samples that lie within the current graphics primitive. It is possible that one or more samples are within the primitive while the pixel center is on the outside. In that case, the pixel shader receives extrapolated input data, which does not necessarily lie within expected value ranges. With centroid sampling, input data is guaranteed to have been computed for a location within the pixel that is inside the primitive, chosen by the GPU. Since centroid locations of neighbouring pixels may be chosen arbitrarily by the GPU, derivatives usually become highly inaccurate. In a nutshell, Centroid should be used according to these rules:

  • Do use Centroid for input data that must not be extrapolated, for example texture coordinates into a tightly packed atlas.

  • Do not use Centroid for input data that is used to compute derivatives, for example normal vectors based on position.

See also

PixelShader

Center

public constant Center → (4:int32)

Force pixel-center sampling when running at pixel frequency, even if Centroid is present.

See also

PixelShader

Sample

public constant Sample → (8:int32)

Run per sample instead of per pixel and perform sampling at each sample location.

If this flag is present, the Centroid and Center flags have no effect and are ignored.

See also

PixelShader

GroupShared

public constant GroupShared → (16:int32)

Place variable in group-shared memory.

See also

ComputeShader

NoInterpolation

public constant NoInterpolation → (32:int32)

Do not perform value interpolation.

See also

PixelShader

All

public constant All → (63:int32)

A behaviour flags.