- Home /
Crash: cutout shaders on mobile
I need Cutout shader on Android. When I'm using default Transparent/Cutout/Diffuse shader Unity gives me this warning "Shader is using clip instruction (usually caused by alpha test). It might cause problems on some Qualcomm/Adreno drivers." And it actually crashes when I run the app.
I need a shader which has diffuse and works with and without lightmaps. So I suspect that writing surface shader is the best way to go. But my guess is that it will be always compiled into a shader which uses "clip" instruction.
How can I solve this probem? Can I write surface shader without clip function?
Answer by GianormousGames · Oct 18, 2012 at 08:03 PM
AlphaTest is what causes the clip instruction - and I think all the cutout shaders are affected.
I traced a crash on HTC Thunderbolt into 1) some of the NGUI shaders and 2) the cutout shaders.
Shaders that neither contain clip instructions nor turn on AlphaTest should be fine.
Yeah, I figured out same thing - cutout shaders are causing a crash. In my case it happens only when I turn on lightmaps. So my solution is not to turn no the lightmaps. But I would like to see proper solution eventually... I'm rendering a tree, and you can not render a tree without AlphaTest.
Can you somehow ifdef that instruction in the shader based "Qualcomm/Adreno" or simply "Android"?