Search Unity

What's wrong with Unity 5.6?

Discussion in 'Shaders' started by mcmorry, Apr 4, 2017.

  1. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    580
    I'm testing Unity 5.6 by porting my iOS project from 5.4 and I'm having so many issues with my shaders that I don't even know from where to start fixing.

    In OpenGLES2 I suddenly have "Implementation limit of 32 varying components exceeded" on some shaders.
    Also, as soon as I enable a second image effect, the screen becomes gray. It looks like that the source texture of the second image effect is empty.

    On Metal is even worst.
    I'm getting tons of these errors:

    WARNING: Shader Unsupported: 'BRA/Toon/Diffuse/Planet02MonumentsNear' - Pass 'FORWARD' has no vertex shader
    WARNING: Shader Unsupported: 'BRA/Toon/Diffuse/Planet02MonumentsNear' - All passes removed

    2017-04-04 20:30:54.991730 ---[1354:295252] Compiler failed to build request
    Metal: Error creating pipeline state (BRA/Toon/Triplanar/Ground): Fragment input(s) `user(TEXCOORD7),user(TEXCOORD0),user(TEXCOORD1),user(TEXCOORD2),user(TEXCOORD3),user(TEXCOORD4),user(TEXCOORD5),user(TEXCOORD6)` mismatching vertex shader output type(s) or not written by vertex shader

    Also, in one of my scenes where I use a fullscreen effect, the image is flipped upside down.

    What is going on?!

    I checked all the release notes to see if something important is changed that I should have to update, but I can't find anything.

    Any clue? Did you have any similar issue?
     
  2. Johannski

    Johannski

    Joined:
    Jan 25, 2014
    Posts:
    826
    Hm, interesting. For me the transition was very smooth, but I also stuck around for Unity 5.5.
    Here are the easy fixes:

    Image effect:
    You will need to check if the uv is flipped, something like this in the vertex shader:
    Code (CSharp):
    1. #if UNITY_UV_STARTS_AT_TOP
    2. if (_MainTex_TexelSize.y < 0)
    3. {
    4.     o.uv.y = 1 - o.uv.y;
    5. }
    6. #endif
    BRA/Toon/Diffuse/Planet02MonumentsNear seems to have no vertex shader pass (didn't even know that was allowed before).

    BRA/Toon/Triplanar/Ground has a lot of inputs... are you sure you need that many (I actually though that TEXCOORD only goes as high as 3).
     
  3. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    580

    Thanks, I'll try the fix you suggested.

    The other errors are very weird! Of course, I have a vertex pass, and it was always working fine.
    Also in the editor, with Metal emulation and the experimental Metal drivers for the editor, everything works fine.
    But inside the build, it goes crazy.

    Also, I forgot to mention that last 2 errors are coming from Surface Shaders. So I'm not manually assigning TEXCOORD fields.
     
  4. DominoM

    DominoM

    Joined:
    Nov 24, 2016
    Posts:
    460
  5. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    580
    Yes, Unity is riding too fast and not doing well...

    I filled a bug report, and they were able to reproduce the issues. Going to fix it... I hope soon.