Shader compile error: the varying you wrote out in the vertex shader and never read in — undeclared identifiers across the stage boundary
Problem
A custom WebGL shader that renders black and floods the console:
ERROR: 0:18: 'v_uv' : undeclared identifier
ERROR: 0:18: 'assign' : cannot convert from 'highp 2-component vector of vec2' to 'float'The vertex shader compiles cleanly on its own, the fragment shader compiles cleanly on its own, and the mistake is only visible when you read them as a pair.
Root cause
Varyings are a contract between two separately compiled programs. In GLSL ES 1.00 the vertex shader writes varying vec2 v_uv; and the fragment shader must re-declare it with the same qualifier and type; in GLSL ES 3.00 the vertex side declares out and the fragment side declares in. Declare it in one stage and not the other, or declare in where you wrote varying, and the stage that references the name sees an undeclared identifier — exactly the error above, pointing at the texture lookup in the fragment shader.
The silent variant is worse: matching names with mismatched types (out vec2 in vertex, in vec4 in fragment) links with an undefined-value varying and no error on some drivers, which is why the black-output-no-error case also gets traced here eventually.
✅ verified against es 3.00
// vertex shader
#version 300 es
in vec3 a_position;
… 6 more lines in the fix🔒 the fix — including 4 code blocks — is members-only. $1/mo unlocks everything.