This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

glCompileShader taking a long time

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).




shaderGlsl.frag.zip
Parents
  • 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:

    • Reduce shader length/complexity wherever possible
    • Cache your compiled binaries so your app first looks for a cached shader/program before compiling it if it is missing/fails for any reason (usually fails after a driver update causing them to become incompatible).
    • Consider compiling shaders on multiple threads to reduce overall time.

    Hope this helps,

    Chris

Reply
  • 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:

    • Reduce shader length/complexity wherever possible
    • Cache your compiled binaries so your app first looks for a cached shader/program before compiling it if it is missing/fails for any reason (usually fails after a driver update causing them to become incompatible).
    • Consider compiling shaders on multiple threads to reduce overall time.

    Hope this helps,

    Chris

Children
No data