iPhone 5S - Possible Depth Buffer issue

iphone, opengl-es

Solution

Ok... I have solved this. There was problem in my shader that caused depth buffer to be filled incorectly. I have used

precision mediump float;

and that caused geometry to be not precise and Z = 0 vs Z = 0.5 has been mixed together.

Changing precision to `highp` solved the issue.

Bottom line. This "optimalization" was huge mistake and never use mediump in Vertex Shader (unless you are facing some performance impact and even that its not worth it. The difference in rendering is not noticable)

Problem

In my application, I render plane over plane. Lower plane has Z = 0, second one has Z = 0.5. If I render them (lower first), I got missing part of render, as shown on picture On iPhone 4 and desktop (using ES emulator), there is everything correct and no problem. What could cause this bevaiour ? Same problem occurs also for other parts of scene, like tracks, tubes (green and blue on this picture). Problem occurs, when I move camera

Original source