Что может значить такая ошибка при компилировании шейдера?
Shader error in 'Map/Map': D3D shader assembly failed with: (7): error X5204: Read of uninitialized component(*) in r1: r/x/0 g/y/1 b/z/2 *a/w/3
Shader Assembly: ps_2_0
; 3 ALU, 1 TEX
dcl_2d s0
def c0, 0.00000000, 0, 0, 0
dcl t0.xy
texld r0, t0, s0
mul r0.xyz, r0, r1.w
mov_pp r0.w, c0.x
mov_pp oC0, r0
Причем шейдер все же компилируется.
Вот сам шейдер.
SubShader {
Tags { "RenderType"="Opaque" }
LOD 200
CGPROGRAM
#pragma surface surf SimpleLambert finalcolor:MyFinalColor noambient
//finalcolor:MyFinalColor noambient
struct Input {
float2 uv_MainTex;
float4 color : COLOR;
};
sampler2D _MainTex;
half4 LightingSimpleLambert (SurfaceOutput s, half3 lightDir, half atten) {
half NdotL = dot (s.Normal, lightDir);
half4 c;
c.rgb = s.Albedo * _LightColor0.rgb * (NdotL * atten * 2);
c.a = s.Alpha;
return c;
}
void MyFinalColor(Input IN, SurfaceOutput o, inout fixed4 color) {
float shadow = IN.color.a;
float3 ambient = UNITY_LIGHTMODEL_AMBIENT;
float scale = min(ambient.r, shadow);
color.rgb = o.Albedo.rgb * scale;
color.a = o.Alpha;
}
void surf (Input IN, inout SurfaceOutput o) {
//float3 ambient = UNITY_LIGHTMODEL_AMBIENT;
//float shadow = IN.color.a;
//float scale = min(ambient.r, shadow);
o.Albedo = tex2D (_MainTex, IN.uv_MainTex).rgb;
}
ENDCG
}
И виновато в этом похоже эта строчка IN.color.a