Vixen
dd8b0a81
csharp
public enum InterpolationMode

How a varying is interpolated across a primitive, written as [Interpolation("noperspective")] on the declaration that carries it.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

The author's half of a decision the compiler could only make for integers. Reflection.StageInterface.MustBeFlat answers it for an int varying, where there is exactly one legal answer and no reason to make anybody write it. For a float there are four answers and the shader is the only thing that knows which one it means: a screen-space value wants noperspective, a per-primitive value riding the provoking vertex wants flat, and a value sampled at the covered centroid rather than the pixel centre wants centroid — which is the difference between a correct edge texel and one extrapolated outside the triangle at multisample rates.

One attribute with one word rather than four marker attributes, because the modes are mutually exclusive: two markers on one declaration would be a state nothing can emit, and the shape of the syntax is what stops it being writable at all.

⚠ Centroid is a sampling qualifier in both targets rather than a third interpolation function, so it means "smooth, sampled at the centroid". Raven spells it as a mode anyway: the alternative is a second attribute that combines with this one, and a combination is only worth its cost when somebody wants noperspective centroid, which nothing in the library does.

Fields and properties (4)

  • Smooth

    Perspective-correct interpolation — what a varying does when nothing says otherwise, and therefore the value a declaration with no attribute has.

  • Flat

    No interpolation: every fragment reads the provoking vertex's value.

  • NoPerspective

    Linear interpolation in screen space, without the perspective divide.

  • Centroid

    Perspective-correct, sampled at the centroid of the covered area rather than at the pixel centre.

Used by (14)

  • DeclarationFactsVixen.Raven
  • FieldSymbolVixen.Raven
  • GlslEmitterVixen.Raven
  • InterpolationTestsVixen.Raven.Tests
  • IrStageIoVixen.Raven
  • IrStreamVixen.Raven
  • ParameterSymbolVixen.Raven
  • SourceFieldSymbolVixen.Raven
  • SourceNamedTypeSymbolVixen.Raven
  • SourceParameterSymbolVixen.Raven
  • SpirvEmitterVixen.Raven
  • StageInterfaceVixen.Raven
  • SubstitutedFieldSymbolVixen.Raven
  • SubstitutedParameterSymbolVixen.Raven