Shader.WarmupAllShaders FATAL EXCEPTION [UnityMain]

Hi there!

I’m experiencing a crash on my game launch. It happened on one unlucky day on my HTC Incredible S and I have no idea how to deal with it so far. Previously the game started and working on this phone just fine (on Android 2.3.5). After unknown circumstances it started to block the phone completely to full system hang and subsequent device reboot. After installing previous versions of the game which definitely were working nothing changed. I decided to make a factory reset - no effect again! Then I updated to Android 4.0.4 and the game still crashes. However, on a latter Android I’m able to view a crash report and observe there this fatal error:
java.lang.Error: FATAL EXCEPTION [UnityMain]
Unity version : 4.3.2f1
Device model : HTC HTC Incredible S
Device fingerprint: htc_wwe/htc_vivo/vivo:4.0.4/IMM76D/398875.1:user/release-keys

Caused by: java.lang.Error: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 042e2b50
Build fingerprint: 'htc_wwe/htc_vivo/vivo:4.0.4/IMM76D/398875.1:user/release-keys'
Revision: '128'
pid: 30308, tid: 30323, name: UnityMain >>> com.[MY_PACKAGE_NAME] <<<
r0 55120240 r1 042e2b50 r2 0000009c r3 0000009c
r4 00000000 r5 042e2b50 r6 028015d0 r7 0000000c
r8 00000000 r9 01c02de0 sl 0000003c fp 534453fc
ip 00000001 sp 52f9e394 lr 532e831c pc 400bdf28 cpsr 0000000b

at libc.0000df28(Native Method)
at [heap].00dc75ac(Native Method)
at Shader.WarmupAllShaders(Native Method)
at ... [my C# code]

Any ideas what can cause the problem? Shader.WarmupAllShaders is required to abort a jittery game start.

Update: if I comment out Shader.WarmupAllShaders() call then the game starts and works fine. But I need to mention here that I did not change shaders for a long time before the bug came out. The only thing I did is updated Unity. But another interesting thing here is that I’ve tried to install and run APK files build with older Unity versions. As I said, these game versions were 100% working before on the same Android version which were used originally to run these APKs. What I did with my test phone is just installed/removed some apps from Google Play. And my phone is not rooted, it had a stock Android version.

Update 2: it seems that the crash happens on a wide range of Adreno GPU family:

  • HTC Desire X (Adreno 203)
  • HTC Incredible S (Adreno 205)
  • HTC One S (Adreno 225)

We were getting the same crash due to WarmupAllShaders. It is specific to clip and alphatest calls within the shaders for Adreno devices.

Adding this answer for archival purposes of linking clip/alphatest/adreno to WarmupAllShaders.