Vixen
02b45cc4
csharp
public readonly record struct UiShape

Everything the box shader needs about one box, in the layout it reads.

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

Remarks

⚠ Per box, not per vertex, and that is the whole reason this type exists. Four corners with an elliptical radius each is eight floats, a gradient is another six, and a box is four vertices — so carrying them on the vertex would take it from forty-eight bytes to a hundred and four, and every glyph and every path triangle in the frame would pay for fields no shader reads on them. One record per box costs eighty bytes against the sixty-four the four vertices already spend on Shape, and the vertex layout does not move at all: a box's Shape.X becomes the index of its record.

⚠ Five Vector4s, written out rather than left to a struct layout to work out. This is copied into a storage buffer with MemoryMarshal and read back by a shader whose own alignment rules are not C#'s — a float beside a Vector2 lays out differently under std430 than under sequential, and the failure is a box drawn with another box's radii, which looks like a bug in the geometry.

Fields and properties (5)

  • public Vector4 Size

    Half width, half height, border thickness, and whether there is a gradient.

  • public Vector4 RadiiX

    The four horizontal radii, clockwise from the top left.

  • public Vector4 RadiiY

    The four vertical radii, in the same order.

  • public Vector4 Axis

    Which way the gradient runs, then a shadow's blur radius, then padding.

  • public Vector4 End

    The colour at the far end of the gradient.

Methods (1)

Used by (5)

  • SoftwareUiRasterizerVixen.Ui.Testing
  • UiGeometryVixen.Ui
  • UiGeometryBuilderVixen.Ui
  • UiGeometryTestsVixen.Ui.Tests
  • UiRendererVixen.Ui.Renderer