API Reference · Diagnostics

SelfTest

Namespace: Ava3D

public static class SelfTest

What this renderer computes, reduced to numbers that two machines can be compared on.

Written for a fault that has no other handle on it: the software renderer draws the browser demo correctly in Chrome and speckles it with wrongly-coloured triangles in Safari, from the same WebAssembly binary. Geometry lands in exactly the right place, so nothing is wrong with the transforms; individual vertices come out black or blown white, so something is wrong with what is computed for them or with what is written down afterwards. It survives holding the renderer to one core, so it is not a race, and the GPU path is clean, so it is this rasteriser and nothing else.

Beyond that point, screenshots stop being evidence. Two pictures that differ tell you they differ. What is needed is which stage differs, and that is what this is: six checksums over fixed inputs, ordered from the most primitive arithmetic to a finished frame. The first one that disagrees between two engines is the stage the fault is in, and everything after it is a consequence.

Reading it:

transform disagrees → matrix and vector arithmetic. Nothing above this can be trusted. normalize disagrees → reciprocal square root, dot, cross. transcend disagrees → pow, sqrt, exp — the specular lobe's ingredients. shade disagrees → the lighting itself, on inputs the three above agreed about. vertex disagrees → placing, culling or projecting; see the stray count beside it. raster disagrees → scanline fill, depth test or interpolation; the maths was fine. nothing disagrees → the fault is in what the frame is drawn into, not in what it draws.

The last line is worth as much as the others. A run where every checksum matches and the picture is still wrong rules out this entire library, which is a large thing to be able to say in one paste.

vertex is the one line that does not need a second machine to be read. Its stray count is triangles the renderer would draw with corners it never lit, and the right answer is zero on every engine there has ever been — so a number there is a fault on the machine that printed it, no diff required, and the fault is exactly the reported one: a triangle in the right place, coloured from whatever the last frame left in its slot.

Determinism: WebAssembly's floating point is specified to the bit, and both browsers run the same module, so a difference here is a difference in an engine rather than in a machine. Desktop numbers will not match browser numbers — different runtime, different libm — and are not meant to. This compares like with like: two browsers, one build.

Methods

MemberDescription
static string Run()

Runs every stage and returns the whole report as one block of text, ready to paste.

returns

A multi-line report: one hexadecimal checksum per stage, plus a triangle count and a small ASCII picture of the rendered frame for the two stages where a number alone is hard to act on.

See also