Vixen
feb85697
csharp
public readonly record struct UiVertex

One vertex of the interface, in the layout both UI shaders read.

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

Remarks

⚠ One layout for both, rather than one per shader. Two layouts would mean two vertex buffers, two uploads and two places for a batch to point at, to save sixteen bytes on a vertex count that is in the thousands rather than the millions — an interface is not a mesh. What it buys is that a frame is one buffer and one copy however many kinds of thing it draws.

Fields a kind does not use are zero, exactly as DrawCommand does it, and for the same reason: the consumer switches on the batch anyway.

⚠ is the projected point and is what it was divided by, rather than the homogeneous triple. Every reader of a vertex outside the two rasterisers — the ink bounds, the fill rule, the hit test's picture of where a quad landed — wants the point on the screen, and on the affine geometry that is all of a frame but one quad, the two forms are the same floats. The vertex stage multiplies back (float4(xy · w, 0, w)) and the hardware divides again, which is the arithmetic that makes the varyings perspective-correct; SoftwareUiRasterizer.Triangle does the same divide by hand. The default is one so that every vertex built before there was a w still means what it did — ⚠ and default(UiVertex) is therefore not a vertex, since a zero w is a point on the eye plane with no image at all. Nothing builds one.

Fields and properties (5)

  • public Vector2 Position

    Where it is, in document pixels.

  • public Vector2 Texture

    An atlas coordinate for text, and the offset from the shape's centre for everything else.

  • public Color4 Color

    Its colour, in linear space.

  • public Vector4 Shape

    What the shader needs beyond the position: for a box, the index of its record in Shapes; for a glyph, the screen-pixel range; for a path triangle, how much of the pixel the shape covers there. Only the first lane is ever read.

  • public float W

    The homogeneous w the position was divided by, so that a rasteriser can interpolate the other three attributes perspective-correctly. One for everything but a composited group's quad under a projective UiTransform, which is the only geometry with a w to carry.

Methods (1)

  • public UiVertex(Vector2 Position, Vector2 Texture, Color4 Color, Vector4 Shape, float W = 1)

    One vertex of the interface, in the layout both UI shaders read.

Used by (14)

  • FlatteningScaleTestsVixen.Ui.Tests
  • IconAtlasTestsVixen.Ui.Tests
  • NineSliceImageTestsVixen.Ui.Tests
  • PathTessellationCacheTestsVixen.Ui.Tests
  • ProjectiveCompositeTestsVixen.Ui.Controls.Tests
  • SoftwareUiRasterizerVixen.Ui.Testing
  • UiCompositingTestsVixen.Graphics.Golden.Tests
  • UiGamutTestsVixen.Ui.Tests
  • UiGeometryVixen.Ui
  • UiGeometryBuilderVixen.Ui
  • UiGeometryTestsVixen.Ui.Tests
  • UiRavenAgreementTestsVixen.Graphics.Golden.Tests
  • UiRendererVixen.Ui.Renderer
  • UiTransformProjectiveTestsVixen.Ui.Tests