My GLSL shader isn't compiling even though it should. What should I investigate?
- by reapz
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.