Verification
On every push
The repository's CI runs these on every push and pull request, in the CI workflow:
- The same module compiles to a CPU function that runs in f64 arithmetic. In its default mode only its equality tests round to f32 first, so they agree with the GPU; an f32 mode that rounds after every operation is opt-in. The test suite checks that function against known answers and against a second CPU backend, generated JavaScript, which must match it bit for bit. It says nothing about what rounding does on a driver, and no GPU output is compared against it in this repository. src/core/oracle.ts
- The compile gate emits every registered example, hands each WGSL emit to Tint inside headless Chromium, and compiles and links both GLSL ES 3.00 stages of every renderable example on a real WebGL2 context. It also hands each compiler a shader that cannot compile: if either accepts that non-program, the gate fails and the verdicts on the examples do not count. scripts/compile-gate.ts
- Golden files hold the emitted bytes of every example, so any change in a backend surfaces as a diff in review. emit-goldens.test.ts
The same pass on both backends
The gradient pass from the front page, drawn once by each backend. No pixel comparison between the two is committed yet.
At author time
The uniform block is declared once, and every field read is typed against that declaration. Misspell one and TypeScript says so in the editor, before a string reaches a GPU.
const U = uniformStruct('Uniforms', { group: 0, binding: 0, as: 'U' }, { time: f32T, top: vec4fT, bottom: vec4fT,})
const fsGradient = fn('fs_gradient', { vo: VsOut }, (p) => { const t = p.vo.uv.y.add(U.field.time.mul(0.05)) return vec4(mix(U.field.bottom.rgb, U.field.colour.rgb, t), f32(1))}, { stage: 'fragment', retAttr: '@location(0)' })error TS2339 at line 7, column 47: Property 'colour' does not exist on type '{ readonly time: ReadonlyNode<"f32">; readonly top: ReadonlyNode<"vec4<f32>">; readonly bottom: ReadonlyNode<"vec4<f32>">; }'.
| field | type | offset | size |
|---|---|---|---|
| time | f32 | 0 | 4 |
| top | vec4<f32> | 16 | 16 |
| bottom | vec4<f32> | 32 | 16 |