public static class SoftwareUiRasterizerThe interface, drawn on the CPU, from the same geometry the GPU would be given.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
Why a software renderer rather than the real one. A visual regression suite that needs a Vulkan device runs on the machines that have one, which in practice means it does not run: not on a laptop without the SDK, not on a container, not on the CI leg that has no GPU. A game developer's UI suite has to run everywhere their unit tests run or it will be the suite nobody has ever seen pass.
⚠ And it buys something a GPU cannot: an exact comparison. Vixen.Graphics.Golden.Tests compares perceptually because MoltenVK and lavapipe round the same sRGB conversion differently and both are conformant — its README says a bitwise suite there is red from the day it is written. The arithmetic here is the same on every machine, so a screenshot can be compared byte for byte and a one-pixel shift in a glyph is a failure rather than something under a threshold.
⚠ What it does not replace. This consumes UiGeometry — so the draw list, the geometry builder, the clip resolution, the tessellator and the glyph atlas are all under test — and then does the fragment shaders' arithmetic itself. It therefore cannot catch a mistake that lives below that line: a wrong descriptor binding, a vertex layout that disagrees with the shader, a projection that flips y. Those are exactly what Vixen.Graphics.Golden.Tests exists for, and this does not make that suite redundant. The two answer different questions and both are worth asking.
⚠ The port is of the shaders as written, including their approximations. BoxDistance turns an elliptical corner into a circle by scaling and scales the distance back by the smaller semi-axis, because that is what ui-box.frag does; "improving" it here would make this renderer disagree with the one that ships, which is the one failure mode a testing renderer must not have.
Methods (3)
public static Bitmap Render(UiGeometry geometry, GlyphAtlas atlas, int width, int height, Color4 background)Draws a frame of interface geometry.
public static float[] RenderLinear(UiGeometry geometry, GlyphAtlas atlas, int width, int height, Color4 background)The same frame, before the store that makes it eight bits.
public static float BoxDistance(Vector2 point, Vector2 half, Vector2 radius)The signed distance to a box with an elliptical corner, negative inside.
Used by (7)
- FillRuleTestsVixen.Ui.Testing.Tests
- FrameVixen.Ui.Testing
- HudLuminanceTestsVixen.Ui.Controls.Tests
- MixBlendModeLuminanceTestsVixen.Ui.Controls.Tests
- UiBoxAgreementTestsVixen.Graphics.Golden.Tests
- UiCompositingTestsVixen.Graphics.Golden.Tests
- UiTestVixen.Ui.Testing