Precision issue in normal generating shader on iPhone 5

I’ve got a shader that generates a normal map from a texture input (source code here:

For some reason, my shader works as expected in the iOS simulator and on an iPhone 5S, but on an iPhone 5, I am getting bad results that appear to be from some lack of precision. I suspect it is probably some trivial idiosyncrasy of OpenGL ES, but I can’t for the life of me figure it out.

The forum won’t let me post more than one link in a post, so bear with me as I post images in replies…

Shader running on iOS Simulator:

Shader running on iPhone 5:

So you can see that the gradation in the normal map is much less smooth on the iPhone 5 and it also loses all the detail of the grid in the bottom half of the image.

Can anyone advise?


can’t be sure this is the exact problem, but a quick google search led me to this, which says the difference could be from the 5s being 64bit and the 5 being 32 bit.