Created attachment 34365 [details]
Vertex Shader that fails to link
The attached vertex shader does not link. A call to
glGetProgramiv(program, GL_LINK_STATUS, &result)after glLinkProgram returns GL_FALSE.
Attaching the code and the shaders.
Created attachment 34366 [details]
source code - sample GLES app
Created attachment 34367 [details]
fragment shader used in main.c
Created attachment 34368 [details] [review]
do varying var allocation upon usage to use fewer regs
The fragment shader is trying to read a varying var that's never written to (or declared in) the vertex shader. So that's an error.
I modified the fragment shader accordingly and found the link still failed because of too many varying vars. However, a lot of varying vars are declared but not actually used in the shader.
The following patch avoids allocating a register slot for varyings that aren't used. With this patch, the test works. Want to give it a try? I've only lightly tested it so far.
With the glsl2 merge, written but not read varyings are demoted to auto, and likely dead-code eliminated as a result. So this should be fixed now.