public static class SoftwareRasterThe CPU reference rasterizer: ClusterSoftwareRaster.rvn's coverage and depth, on the host.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
Improvement 4 of docs/plan/22-virtualized-geometry.md, applied to the raster. IsVisible transliterates the object cull and Traverse transliterates the traversal, for one reason each time: these are the decisions that fail silently. A rasterizer that covers one pixel too many along a shared edge draws a seam that blends; one that covers one too few draws a crack; and both look like a driver, a mesh or a camera until somebody can compare the arithmetic against its definition.
So the coverage rule here is the same one the shader runs, and the tests compare it against the definition — a pixel centre is inside a triangle, two triangles sharing an edge cover it exactly once — rather than against a second implementation.
What it deliberately does not mirror is the schedule. The shader deals triangles out to sixty-four lanes and resolves them with an atomic; the answer does not depend on which lane got which, so this walks them in order and resolves them with a comparison. Key is the packing both use.
Methods (5)
public static float Edge(Vector2 a, Vector2 b, Vector2 point)One edge function of a triangle, evaluated at a point.
public static bool IsTopLeft(Vector2 a, Vector2 b)Whether an edge's zero line belongs to the triangle on its left — the top-left rule.
public static bool Inside(float edge, Vector2 a, Vector2 b)Whether a point is on the inner side of one edge, ties included.
public static Vector2 Project(Vector4 clip, Int2 screen)Where a clip-space position lands on the screen, in pixels.
public static int Rasterize(Vector4 c0, Vector4 c1, Vector4 c2, Int2 screen, uint identity, Span<ulong> depths)Rasterizes one triangle into a packed depth-and-identity buffer.
Used by (1)
- SoftwareRasterTestsVixen.Rendering.Tests