- Home /
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)
So if you comment out the call to WarmupAllShaders() in your code, the game is jittery but doesn't crash? Sounds like you've got an erroneous shader somewhere.
@tanoshimi, To be more specific, if I comment out WarmupAllShaders() then the game runs with a freeze on first objects instantiation. After that the game runs O$$anonymous$$. But the whole purpose of this method is to avoid such hiccups. I wonder why it fails because it should only warmup only combinations of those shaders which the game actually uses. But the game runs just fine so all used shader combinations are rendered without any problems. Yes I have some libraries using custom shaders but there are 55 shaders included in my project totally and I can not simply remove them one by one to deter$$anonymous$$e which one fails. Any ideas on a reliable warmup?
Why can't you remove them one by one? Sure it's a pain. But it might help you locate the problem.
Well, on my slow environment each test will take away about 10 $$anonymous$$. If the shader will be spotted on a halfway then it would totally consume about 4 hours of investigation.. oops! Edit: I'm using NGUI and saw a post about shader issues on Adreno. However, I'm not using hard clipping. Anyway, I checked the game in all different aspects and all used shaders are working properly. As WarmupAllShaders() should warmup only currently used shaders I don't get the idea why it does not work.
Answer by Jason-King · Apr 25, 2014 at 11:09 PM
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.
Yes, Adreno GPU with these kinds of shaders is the reason. But how we can efficiently nail down the troublesome shader without removing them one by one? I'm not a shader specialist and I have several libraries with 55 shaders total - too much to go on with this approach.
Sorry, I ended up commenting out all the uses of clip or alphatest in all of my shaders. It says that it only warms up the shaders that are already loaded (via assets located somewhere in the scene). But I suspect (I have no proof) it does more than that because we use a limited set of shaders in the entirety of our game assets. Without WarmupAllShaders the game ran fine from start to finish, but with WarmupAllShaders suddenly some hidden asset now has the broken shader - uh, no - and I know this because I've gone through every material being used in the game.
Your answer
Follow this Question
Related Questions
Android Crash, waitForCondition(LockCondition) 0 Answers
EGL_BAD_ATTRIBUTE on adreno-based android devices 2 Answers
Problem with shaders on Android? 1 Answer
Why Do Android Devices Hate This Shader? 2 Answers
Unity3D Android plugins and SIGSEGV 0 Answers