My GLSL shader isn't compiling even though it should. What should I investigate?

Posted by reapz on Game Development See other posts from Game Development or by reapz
Published on 2012-05-22T01:14:29Z Indexed on 2012/06/13 4:48 UTC
Read the original article Hit count: 237

Filed under:
|
|

I'm porting an iOS game to Android. One of the shaders I'm using wouldn't compile until I reduced the number of uniform variables. Here are the uniform definitions:

uniform highp   mat4 ViewProjMatrix;
uniform mediump vec3 LightDirWorld;
uniform mediump int  BoneCount;
uniform highp   mat4 BoneMatrixArray[8];
uniform highp   mat3 BoneMatrixArrayIT[8];
uniform mediump int  LightCount;
uniform mediump vec3 LightPos[4]; // This used to be 12, but now 4, next lines also
uniform lowp    vec3 LightColour[4];
uniform mediump vec3 LightInnerOuterFalloff[4];

My issue is that the GLSL shader wouldn't compile until I reduced the count of the above arrays from 12 to 4. My understanding is that if those 3 lines were arrays of 12 then I would be using 56 vertex uniform vectors. I query the system at startup (GL_MAX_VERTEX_UNIFORM_VECTORS) and it says that 128 are available. Why wouldn't it compile with 56? I'm having issues on the Kindle Fire.

© Game Development or respective owner

Related posts about android

Related posts about shaders