Shader Compiler bailing out with just a few shader features.

Below I pasted a minimal shader which always causes the compiler to fail even though it has just about as many shader_fearures as the standard shader.

If I count correctly there should be: 3 * 4 * 3 * 3 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 = 27648 variants ?

Further more compiler never utilizes more than 30% of the CPU (no I don’t have a tri-core ;). At the same time there’s plenty of free ram and hdd is doing literally nothing so I wonder what’s preventing the compiler from running 3 times faster.

Regardless. Can I ask anyone to try and compile this shader, please?
Yes, it’ll take quite some time but because it is so minimal perhaps it’ll help unity to diagnose why the compilation fails and also why is it using so little of the cpu before it fails.

Win10 - 5.4.0f3; 5.4.0p1; 5.4.0p2. Didn’t check older versions. Target platform: android and win x64

The errors I usually get are as follows:

Protocol error - failed to read correct magic number
or
Internal error communicating with the shader compiler process
or
Shader error in ‘’: Parse error: syntax error at line 1 (no there’s no BOM - doublechecked)

Shader "Custom/Dev Test" {
  Properties {
    _MainTex("Albedo", 2D) = "white" {}
  }
  SubShader {
    Tags { "RenderType" = "Opaque" "PerformanceChecks" = "False" }
    LOD 200
    CGPROGRAM
 
    // Protocol error - failed to read correct magic number
    // Internal error communicating with the shader compiler process
    // Shader error in '': Parse error: syntax error at line 1 (no there's no BOM - doublechecked)
    // no rhyme or reason

    #pragma target 3.0
    #pragma shader_feature _PPP _WWW _QQQ
    #pragma shader_feature _ _AAA _CCC _VVV
    #pragma shader_feature _ _OOO _YYY
    #pragma shader_feature _ _FOO _BOO
    #pragma shader_feature _NOTHING_OFF
    #pragma shader_feature _SOMETHING_OFF
    #pragma shader_feature _SOMEMAP
    #pragma shader_feature _OTHERMAP
    #pragma shader_feature _FEATURE_A
    #pragma shader_feature _FEATURE_B
    #pragma shader_feature _FEATURE_C
    #pragma shader_feature _FEATURE_D
 
    // 3 * 4 * 3 * 3 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 = 27648 variants

    #pragma surface surf Lambert

    sampler2D _MainTex;

    struct Input {
        float2 uv_MainTex;
    };
 
    void surf(Input IN, inout SurfaceOutput o) {
        o.Albedo = tex2D(_MainTex, IN.uv_MainTex);
    }
    ENDCG
    } // SubShader

    FallBack "Diffuse"
}

Thanks in advance.

So I reported this bug but it turned out to be a duplicate (oops. :roll_eyes:)

Anyone interested:

BTW. Could you guys spare a vote on this issue? Assuming Unity even pays any attention.

It would be good to be able to write highly customizable shaders without having to chop them up into many simpler ones.