Vixen
02b45cc4
csharp
public sealed class VertexSchema

What a vertex buffer holds, by name — the half of a vertex layout the geometry knows.

Read the guide page for this →

Remarks

A vertex layout is a join of two facts, and only one of them belongs to the mesh. The buffer decides which attributes exist, how they are packed and how far apart two vertices are; the shader decides which of them it reads and at which location. VertexLocations is the older half-answer to the same problem — a caller hands over the numbers a shader's reflection reported, once, for one shader. That works while every draw goes through one shader and stops working the moment a second pass draws the same mesh: a shadow caster declares three attributes where the forward pass declares four, and they are at different locations because StreamPlan numbers a stage's parameters after the shader's streams.

So the numbers are not written down here. Layout takes the effect that is about to be drawn with, reads the locations off its reflection, and matches them to these attributes by name — which makes one description of the mesh correct for every pass that draws it.

⚠ An attribute the shader declares and this does not have is refused, and that is the point. Binding nothing to a declared location is not a validation error on most drivers — it is a stage reading whatever was left in the slot — and describing a location the pipeline has no variable at is one. Both are silent failures a long way from their cause, so the join is checked here where both halves are in hand.

Fields and properties (2)

  • public int Stride

    Bytes between consecutive vertices.

  • public IReadOnlyList<VertexChannel> Attributes

    What one vertex holds.

Methods (2)

  • public VertexSchema(int stride, params VertexChannel[] attributes)

    Describes a vertex format.

  • public VertexBufferLayout[] Layout(Effect effect)

    The vertex layout for drawing this format with one effect.

Used by (3)

  • EffectPipelineDescriberVixen.Rendering
  • ParticleVerticesVixen.Rendering
  • SurfaceVertexVixen.Rendering