I have an app with a number of render targets/frame buffers and inside one call to glDrawElements it crashes on device ( iPad iOS 5.0) but not in simulator. This is a very shader intensive app with a dozen different shaders and thousands of vertex buffers.
Further debugging the matter turned me to believe that the crash occurs because of a particular shader, but the shader is valid and so is the frame buffer object that is being written to.
Ok, so after tons of time spent on debugging I found out that my Depth of field shader was causing the crash, particularly this function :
float GetNearFalloff( float Depth, float MinDist, float MaxDist)
{
float Range = MaxDist - MinDist;
if (Depth < MinDist)
return 1.0;
/*else*/if (Depth > MaxDist)
return 0.0;
float Blur = 1.0 - ( (Depth - MinDist) / Range );
return Blur;
}
Basically the commented else there is causing my crash. Removing that made everything work. I put it back actually ( I was thinking it may be something else ), only to see that after a couple of shader recompilations the same crash appeared with the same fix, deleting the else .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.