Author Topic: Build warning: Shader is using clip instruction....  (Read 14384 times)

NGUIJeffS

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 19
    • View Profile
Build warning: Shader is using clip instruction....
« on: February 26, 2014, 05:39:53 PM »
Hi, I'm building for the Android and got this warning message...

Shader is using clip instruction (usually caused by alpha test). It might cause problems on some Qualcomm/Adreno drivers.
UnityEditor.HostView:OnGUI()

I'm using Unity Unity4.3.0f4 and NGUI v3.0.2. Is there something I need to disable or enable to resolve the issue?
Is there other info that you may need me to provide?
Thanks.

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: Build warning: Shader is using clip instruction....
« Reply #1 on: February 27, 2014, 04:35:23 AM »
As far as I know, this was killed off quite a while ago. The old Hard Clipping used clip, while the Alpha clip doesn't. This is the reason the Hard Clipping just outright crashed on adreno devices.

I'm not sure the alphatest causes the same issue but I'm by no means a shader expert.

NGUIJeffS

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 19
    • View Profile
Re: Build warning: Shader is using clip instruction....
« Reply #2 on: February 27, 2014, 11:05:50 AM »
Hi Nicki, Thanks for responding. By saying... "As far as I know, this was killed off quite a while ago...." do you mean that there are no longer mobile devices that fit this category? or That I should just ignore the warning as a non-issue?

I just doing want to publish a game that crashes on some Android devices. Thanks for your help.

Ferazel

  • Full Member
  • ***
  • Thank You
  • -Given: 1
  • -Receive: 2
  • Posts: 150
    • View Profile
Re: Build warning: Shader is using clip instruction....
« Reply #3 on: February 27, 2014, 02:14:40 PM »
Shaders from NGUI shouldn't be using the clip() anymore due to this warning. Instead I believe that they just make it alpha transparent. I'm pretty sure that this was changed before the 3.0 transition so I'm surprised you still have those shaders in your project still. I'd upgrade your project to the latest version of NGUI. There are performance improvements that you can take advantage of. Also, you will not get any support unless you're running the most up-to-date version.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Build warning: Shader is using clip instruction....
« Reply #4 on: February 27, 2014, 04:52:47 PM »
3.0.2 is extremely old, Please update before posting about issues.

NGUIJeffS

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 19
    • View Profile
Re: Build warning: Shader is using clip instruction....
« Reply #5 on: March 02, 2014, 12:10:15 PM »
I see that there are many builds created each month. That would tend to make any release "old" within a short period of time. Is there an intelligent reason for this? As  a suggestion, perhaps limiting the release to one per month (at  a minimum) would improve and perhaps simplify your support. That way you can still support a release that was created only several months ago.

If I sound upset and a bit sarcastic it's because I just  updated my project to release NGUI 3.5.0, or what ever is on the asset store as of today, and not only do I still have the same warning when I build but my UI is in total disarray. Meaning, I need to recreate the last several months of work.

So, I guess my question remains... Is this warning something that can be fixed and if so, what is the fix? Thank you.


ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Build warning: Shader is using clip instruction....
« Reply #6 on: March 02, 2014, 06:19:56 PM »
NGUI doesn't use the clip instruction anywhere. It was used in the "HardClip" shader, which was deleted a long time ago. Please make sure you follow the upgrading instructions from the readme file.

NaxIonz

  • Jr. Member
  • **
  • Thank You
  • -Given: 3
  • -Receive: 0
  • Posts: 70
    • View Profile
Re: Build warning: Shader is using clip instruction....
« Reply #7 on: April 07, 2014, 11:18:05 AM »
I'm using the Unlit Transparent Colored (3.5.4 r2), and I still receive this warning in Unity 4.3.4f

Is that the correct shader to be using? We pretty much use it as the general purpose shader for all our UI.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Build warning: Shader is using clip instruction....
« Reply #8 on: April 07, 2014, 10:35:54 PM »
Yes it's fine. It doesn't use the clip instruction inside, so not sure what Unity is complaining about.

Newton

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 4
    • View Profile
Re: Build warning: Shader is using clip instruction....
« Reply #9 on: April 25, 2014, 03:44:29 AM »
I'm having the same issue.
Unity 4.3.4f1, NGUI 3.5.8.

Atlas material is "Unlit/Transparent Colored". it even have a notification on the inspector "PerformanceChecks.ShaderWithClipAndroid"

When trying to change the shader to "Unlit/Transparent", the notification disappears and all works well except in a scroll view in which the items don't show, and when moved/scrolled, they flicker.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Build warning: Shader is using clip instruction....
« Reply #10 on: April 25, 2014, 09:19:36 AM »
Just ignore it. It's Unity glitching out. If you look at the shader (or any of them for that matter), there is no "clip" used anywhere.

ryan

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 90
    • View Profile
Re: Build warning: Shader is using clip instruction....
« Reply #11 on: April 25, 2014, 01:51:01 PM »
Unlit - Transparent Colored has an AlphaTest in the second sub shader.  That's what's causing those warnings.

Grhyll

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 32
    • View Profile
Re: Build warning: Shader is using clip instruction....
« Reply #12 on: June 04, 2014, 10:50:01 AM »
Hi,

I was investigating about those warnings, and I'm quite concerned about this AlphaTest. Several people on internet say that this AlphaTest will make the game crash immediately on some devices like HTC Thunderbolt. Since I don't have one to test it, can you confirm this AlphaTest would not be a problem?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Build warning: Shader is using clip instruction....
« Reply #13 on: June 05, 2014, 12:22:27 AM »
I already removed the alpha test setting from all of NGUI's shaders months ago.

Grhyll

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 32
    • View Profile
Re: Build warning: Shader is using clip instruction....
« Reply #14 on: June 05, 2014, 10:17:03 AM »
Indeed, sorry, I made a clean update by removing all previous sources and it was gone. I don't know why I still had one with AlphaTest...