When I provide the following struct definition in linked frag and vert shaders, my phone (Samsung Vibrant / Android 2.2) complains that the definition differs.
struct Light {
mediump vec3 _position;
lowp vec4 _ambient;
lowp vec4 _diffuse;
lowp vec4 _specular;
bool _isDirectional;
mediump vec3 _attenuation; // constant, linear, and quadratic components
};
uniform Light u_light;
I know the struct is identical because its included from another file. These shaders work on a linux implementation and on my Android 3.0 tablet. Both shaders declare "precision mediump float;"
The exact error is:
Uniform variable u_light type/precision does not match in vertex and fragment shader
Am I doing anything wrong here, or is my phone's implementation broken? Any advice (other than file a bug report?)
glGetActiveUniformsiv( GLuint program, GLsizei uniformCount, GLconstuint *uniformIndices, GLenum pname, GLint *params );function, you can find more information on it here. That should allow you to check at run-time if they have similar block structures (hopefully before the error), update me on the results of that. :) – Shaktal Jul 30 '11 at 19:45