Search Unity

Bug Shaders : Failed to link fragment shaders on rare Android Devices

Discussion in 'Universal Render Pipeline' started by omx-jonson, Mar 26, 2023.

  1. omx-jonson

    omx-jonson

    Joined:
    Mar 23, 2014
    Posts:
    17
    Hey,

    I'm using Freya Holmer Shapes plugin. It works fine, but:

    I'm having issues using normal Component Shapes (not immediate draw mode) on Samsung Galaxy A12 device.

    Using URP.



    Shapes component that use transparent shaders are drawn correctly, however Opaque components are not drawn.



    The logcat outputs shows fragment shader link errors.
    The device specs attached.

    Clean installation of Shapes doesn't help.
    Rebuilding shaders and materials doesn't help.



    Any clues on how to debug this?

    Freya is saying it's beyond her, and it's a Unity bug as all shaders she wrote are up to the standards provided by Unity documentation.

    Please help.

    Cheers
    Mike
     

    Attached Files:

  2. wwWwwwW1

    wwWwwwW1

    Joined:
    Oct 31, 2021
    Posts:
    769
    Hi, not an expert but will this still happen if switching the graphics API to Vulkan?
     
  3. omx-jonson

    omx-jonson

    Joined:
    Mar 23, 2014
    Posts:
    17
    Hey, thanks for your response.

    I'm not sure, as Vulkan API has it's own cons with some of my custom shaders, so I've decided to stick to the OpenGL 3+ API.

    Unity error provided in logcat is so scarce, that there's absolutely 0 ways for me to start debugging it :(
     
    wwWwwwW1 likes this.
  4. omx-jonson

    omx-jonson

    Joined:
    Mar 23, 2014
    Posts:
    17
    I was able to narrow it down to PowerVR GE8320 GPU.
     
    Atomiz2002 likes this.
  5. omx-jonson

    omx-jonson

    Joined:
    Mar 23, 2014
    Posts:
    17
    Update:

    - All devices that uses PowerVR GE8320 GPU seems affected. It's actually quite popular budget GPU used in a lot of samsung devices.
    - That GPU is known for having issues with shader compilation.
    - Unity is working on providing bugfixes to other GE8320 related errors.
    - For the shapes part, this is where it gets interesting:
    I've narrowed down the issue, and the shader compilation error only happens when MSAA is turned on. As soon as I switch it off, all Opaque shaders starts to render again.

    SOLUTION: Turn off MSAA if you detect PowerVR GE8320.
     
    Atomiz2002, wwWwwwW1 and KimmoFactor like this.
  6. Atomiz2002

    Atomiz2002

    Joined:
    Feb 2, 2020
    Posts:
    14
    You just saved me hours of debugging and confusion. Legend!!!
    I was testing the app we develop on my phone and out of all GPUs it happened to have this exact model on it to produce the error. Unbelievable.
     
    RaventurnPatrick likes this.
  7. RaventurnPatrick

    RaventurnPatrick

    Joined:
    Aug 9, 2011
    Posts:
    250
    For us this happens with the latest Unity 2022 LTS and I think all PowerVR GPUs should have the same bug.
    The combination that does not seem to compile is: Opaque + Alpha Clipping + MSAA
    I just reported this as: https://unity3d.atlassian.net/servicedesk/customer/portal/2/IN-66653

    The workaround of disabling MSAA is not a suitable workaround in my opinion as alpha clipped objects look especially bad without MSAA.
     
  8. RaventurnPatrick

    RaventurnPatrick

    Joined:
    Aug 9, 2011
    Posts:
    250