The Shader Chip
A fragment shader, compiled and running in the browser, sitting inside a page that is otherwise plain text in a Git repository. This is the chip that most often gets the question: wait, that runs?
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
vec2 uv = fragCoord / iResolution.xy;
vec3 col = 0.5 + 0.5 * cos(iTime + uv.xyx + vec3(0.0, 2.0, 4.0));
fragColor = vec4(col, 1.0);
}
That is not a video or a GIF. It is a live WebGL context, compiled from the source shown beneath it, running at your screen refresh rate.
What It Does
The chip takes raw GLSL fragment source and renders it on a canvas. Source visibility is a toggle, so a page can either show the code alongside the output or present the output on its own.
How the Source Is Wrapped
You write a mainImage function. The runtime supplies the boilerplate around it: a precision header, the uniforms, and a main function that calls yours and assigns the result. Four uniforms are injected and must not be redeclared: iResolution, iTime, iMouse and iChannel0.
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
vec2 uv = fragCoord / iResolution.xy;
vec3 col = 0.5 + 0.5 * cos(iTime + uv.xyx + vec3(0.0, 2.0, 4.0));
fragColor = vec4(col, 1.0);
}
The Guard Rail
Before compiling, the runtime checks the source for a mainImage or a main function. Without one it refuses and says so plainly rather than handing back a blank canvas. A silent black rectangle is the worst possible failure for a visual chip, because it is indistinguishable from a shader that renders black.
Why There Are No Presets
There is no preset list and no effect dropdown anywhere in the chip or its builder. You paste raw GLSL and that is the whole input. It is a harder first five minutes than picking from a menu, and it is honest: what you write is what compiles. A preset list would also age badly, and it would teach nothing about what the chip actually is.
Uniforms injected
4
Max source length
65,535
Compile target
WebGL fragment
Presets
none, by design
The Texture Channel That Is Not Wired Up
The payload carries an imageUrl for iChannel0, so a shader could sample a texture. No authoring path sets it yet. The uniform is declared and available, the plumbing to fill it is not built. Documented here rather than quietly omitted, because a half-connected feature is still a fact about the system.
"The chip that proves a page is not a document.
"

