Since it sounds like large uniforms are the issue, here's some alternatives:
If you use OpenGL ES 3.0 when running on iPhone 5s, you can take advantage of Uniform Buffer Objects (UBOs), which allow much larger storage than uniform arrays. Also note that even if you don't really leverage ES3 features when running on an ES3-capable device, using an ES3 context gives you bigger limits (
MAX_TEXTURE_IMAGE_UNITS
, etc.).Another good place for bulk data is textures. You're using three texture units in that shader, so you've got plenty of room to add a fourth, which can hold a 32x32 image with the same data as your uniform array, and probably be sampled faster. (The general advice would be to watch out for dependent texture fetches here, but there's no penalty for that on A7 so you're okay doing this in code specific to the new GPU.)