[macOS][Metal] Mesh rendered incorrectly when shader property has name "_Float16"

Shader "MinimalWorkingExample"
{
    Properties
    {
        _Float16("Float 16", Float) = 1
    }

    SubShader
    {
        CGPROGRAM
        #pragma target 5.0
        #pragma surface surf Standard
        struct Input
        {
            float2 uv_texcoord;
        };
       
        uniform float _Float16;
        //static const float _Float16 = 1.0;

        void surf( Input i , inout SurfaceOutputStandard o )
        {
            //_Float16 = 1.0;
            o.Albedo = float4(0.0, 0.0, _Float16, 1.0);
        }

        ENDCG
    }
}

Issue was sent to Unity Bug Reporter (15-02-2022, status: open), description:

System: macOS Big Sur 11.4
GPUs: AMD Radeon Pro 5500M (PCIe) and built-in Intel UHD Graphics 630
1. Open scene Scenes\SampleScene;
2. Cube has material “MinimalWorkingExample” and is invisible;
3. Edit source code of MinimalWorkingExample.shader;
4. Uncomment line 23: _Float16 = 1.0; and save modified code;
5. Now cube is visible (blue color);
Shader properties with names “_Float0” , “_Float1”, “_Float2” etc. are created automatically with Amplify Shader Editor. When user creates a shader with many (16 or more) properties, it works properly under Windows (DirectX 11), but failed under MacOS. In inspector there are no compile errors.

I am curious whether someone else encountered similar bugs / problems.

1 Like

Unity 2021.3.25f1c1 contain that bug.
By a shader export from ASE.