Skip to content
taurasgPreparing
ENLT
Back

19 August 2026

One node graph, two backends

Every shader on this site is written once and compiled twice — to WGSL for WebGPU and to GLSL for WebGL2.

The brief was a site that looks the same in every browser and still runs on a phone. The usual answer is to write the shader twice and keep the two in step by remembering to, which nobody does past the second week.

So nothing here is written as a shader at all. It is written as a node graph in TSL, and the compiler emits WGSL where WebGPU exists and GLSL where it does not. The promise that both paths agree is kept by a compiler rather than by discipline.

What that buys is not portability so much as the ability to keep changing things. A distance field, a cone of light and a refraction all live in the same expression tree, and moving the lamp is one number rather than two files that have to be edited identically.

The one cost worth knowing about is that a node graph does not tell you where it went wrong. A mistake surfaces as a black screen and a compiler error against generated source you did not write, so the debugging is bisection: delete half the graph, look, put it back.

© 2026 Tauras Giedraitis · Kaunas, Lithuania · All rights reserved