In a super simple shader shown below
Unity 2018.2.6 will compile the line :-
float test = (i < 0) + (i> .999);
As tmpvar_3.w = (float((i_1 < 0.0)) + float((i_1 > 0.999)));
But 2019.2.2 (and 2019.2.6) will make it
u_xlatb0.x = _Color.w<0.0;
u_xlatb0.y = 0.999000013<_Color.w;
u_xlati0.xy = ivec2((ivec2(u_xlatb0.xy) * -1) & ivec2(1, 1));
A more complex shader that does a similar thing causes issues on OpenGLES2 devices (Android logcat shows something like ‘&’ : supported in pack/unpack shaders only) when build with 2019.2.2 (or 2019.2.6) but is fine in 2018.2.6. (I haven’t had chance to test this simple shader in Android yet)
Is this expected, or something that should be flagged as a bug?
Shader "super simple shader" {
Properties{
_Color("Main Color", COLOR) = (1,1,1,1)
}
SubShader{
Pass {
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
fixed4 _Color;
float4 vert(float4 vertexPos : POSITION) : SV_POSITION
{
return UnityObjectToClipPos(vertexPos);
}
float4 frag(void) : COLOR
{
float i = _Color.a;
float test = (i < 0) + (i > .999);
return float4(1.0, 0.0, 0.0, test);
}
ENDCG
}
}
}