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 created the ticket MPDDEVREL-1076 for this. We'll try and find a workaround for affected devices, which in this case should just be alternative shader code. Is it possible for your generator to take different driver revisions into account when emitting the GLSL code? If not I'm not sure how you will incorporate a workaround.
Thanks,
Chris
Hi Chris,
Thanks for opening a ticket. If we can track down what is causing the issue I should be able to find some way to fix it. Either by changing the original shader or changing the code at the hlsl->glsl translation level. I just have no control over the hlsl assembly outputted by D3DXCompileShader. There are a few flags I can tinker around with but I wont know if they will help unless I know the source of the problem.
I did a quick test with firmware 4.3 and this issue does not happen on it. So this is only a problem with 4.0.4 firmware. Let me know if there is way to track the ticket. Thanks
The ticket is for an internal bug tracking system not publically accessible, I just provided it for your convenience if you wanted to refer to it in future
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,