Search Unity

  1. Unity 2020.1 has been released.
    Dismiss Notice
  2. We are looking for feedback on the experimental Unity Safe Mode which is aiming to help you resolve compilation errors faster during project startup.
    Dismiss Notice
  3. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

compile to VULKAN

Discussion in 'Scripting' started by michael_unity988, Aug 18, 2019.

  1. michael_unity988

    michael_unity988

    Joined:
    Aug 30, 2018
    Posts:
    9
    After added "#define of SHADER_API_VULKAN" can't compile unity shader../
    someone know why?


    #define SHADER_API_VULKAN
    //#define SHADER_API_GLCORE
    //#define UNITY_COMPILER_HLSLCC
    /*#undef SHADER_API_MOBILE
    #undef SHADER_API_METAL
    #undef SHADER_API_VULKAN
    #undef SHADER_API_GLES3*/
    #define SHADER_TARGET 50
    #define UNITY_PBS_USE_BRDF1
    //#pragma target 5.0
    //#define UNITY_PBS_USE_BRDF3
    //#define SHADER_API_GLCORE
    /*#define fixed float
    #define fixed2 float2
    #define fixed3 float3
    #define fixed4 float4
    #define fixed4x4 float4x4
    #define fixed3x3 float3x3
    #define fixed2x2 float2x2
    #define half float
    #define half2 float2
    #define half3 float3
    #define half4 float4
    #define half2x2 float2x2
    #define half3x3 float3x3
    #define half4x4 float4x4
    */
    // michael's fix
    /*#define half min16float
    #define half2 min16float2
    #define half3 min16float3
    #define half4 min16float4
    #define half2x2 min16float2x2
    #define half3x3 min16float3x3
    #define half4x4 min16float4x4
    */
    #include "Header.hlsli"
    /*half main() : SV_TARGET
    {
    half4 zhopa = half4(0.0f, 0.0f, 1.0f, 1.0f);
    half res = ShadeSH9(zhopa);
    return res;
    //return float4(1.0f, 1.0f, 1.0f, 1.0f);
    }*/
    struct ps_in {
    half4 text0: TEXCOORD0;
    half4 text1: TEXCOORD1;
    half4 text2: TEXCOORD2;
    half4 text3: TEXCOORD3;
    };
    /*
    min16float4 BRDF1_Unity_PBS(min16float3 diffColor, min16float3 specColor, min16float oneMinusReflectivity, min16float smoothness,
    float3 normal, float3 viewDir,
    UnityLight light, UnityIndirect gi)
    */
    cbuffer zhopa
    {
    UnityLight light;
    UnityIndirect gi;
    };
    half4 main(ps_in In) : SV_TARGET
    {
    //half4 zhopa = half4(0.0f, 0.0f, 1.0f, 1.0f);
    //half4 res = BRDF1_Unity_PBS(In.text0.rgb, In.text1.rgb, In.text0.a, In.text1.a, In.text2.rgb, In.text3.rgb, light, gi);
    half4 res = UNITY_BRDF_PBS(In.text0.rgb, In.text1.rgb, In.text0.a, In.text1.a, In.text2.rgb, In.text3.rgb, light, gi);
    return res;
    //return float4(1.0f, 1.0f, 1.0f, 1.0f);
    }
     
  2. michael_unity988

    michael_unity988

    Joined:
    Aug 30, 2018
    Posts:
    9
    1>C:\Users\user\Downloads\unityShader\CGIncludes\UnityShaderVariables.cginc(119,11-28): error X3650: 'unity_4LightAtten0': global variables cannot use the 'half' type in ps_5_0. To treat this variable as a float, use the backwards compatibility flag.
     
unityunity