GL::Shader::compile(): compilation of fragment shader 2 failed with the following message: ERROR: 1:1: '' : syntax error
Aparently WebGL shader compilers sometimes just deny you any information on what’s wrong with your shader code.
To hopefully save some people some time, here’s the code snippets that I know can cause this error:
#define A 1 #define B 2 uniform lowp vec4 array[A*B]; #ifdef NOT_DEFINED_SYMBOL // Not a problem if not evaluated uniform lowp vec4 array2[A*B]; #endif
#ifdef NOT_DEFINED_SYMBOL #include "Someother.glsl" #endif
Yes, includes are not supported in GLSL, but if you have your own system for that, make sure you don’t leave any traces of that. Even when it should not be evaluated, it may cause the above issue.