Hello.
I am working on a game and one of the device (Samsung Galaxy S3 (GT-I9300) with gpu Mali-400MP4, android version 4.0.4) is displaying problems while trying to compile one of the shaders. The gl call glCompileShader takes exceptionally long time for this shader (20+seconds). It is not a necessarily a big complicated shader and I am attaching the source file here. I have tried experimenting with changing the sahders and the compile time does go down if I start taking out instructions but even a simple acceptable shader for the game is taking 5-10 seconds to compile depending on the features. Unfortunately I have hit a wall while trying to figure out exactly which instruction is causing this issue and am not getting anywhere. Since it doesnt technically crash I get no information from glGetShaderInfoLog. Any help on this will be greatly appreciated.
PS - I am not seeing this issue on most of the other devices. I also trying using the offline compiler but I ran into other issues like the compiled shader would not link complaining (L0101 All attached shaders must be compiled prior to linking).
Hi s2moudgi,
I've found that by reducing the length of the shaders, you can bring the compilation times down to something more reasonable. Your original shader I gave up timing after 12 minutes, Pete's optimized version took ~5 minutes, but by removing chunks of the shader I had versions that ran at 96 seconds, 8.5 seconds, 2.6 seconds, and 65ms. Compilation time in this driver version seems to go up exponentially with shader length. This is fixed in later versions of the driver (this driver is 2 years old now) and so I would urge your users to upgrade to the latest Android versions. For this version of the shader my advice would be:
Hope this helps,
Chris