Phone complains that identical GLSL struct definition differs in vert/frag programs

Posted by stephelton on Game Development See other posts from Game Development or by stephelton
Published on 2011-07-30T01:09:38Z Indexed on 2011/11/16 2:10 UTC
Read the original article Hit count: 205

Filed under:
|
|
|

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?)

© Game Development or respective owner

Related posts about android

Related posts about opengl-es