I have the following trivial fragment shader:
sampler2D _MainTex;
fixed4 unlitFrag(fragmentIn i) : SV_Target
{
fixed4 col = tex2D(_MainTex, i.texcoord);
return col;
}
Looking at the crosscompiled shader code for OpenGL ES 3.x I see:
#ifdef FRAGMENT
#version 310 es
precision highp float;
precision highp int;
#define UNITY_SUPPORTS_UNIFORM_LOCATION 1
#if UNITY_SUPPORTS_UNIFORM_LOCATION
#define UNITY_LOCATION(x) layout(location = x)
#define UNITY_BINDING(x) layout(binding = x, std140)
#else
#define UNITY_LOCATION(x)
#define UNITY_BINDING(x) layout(std140)
#endif
UNITY_LOCATION(0) uniform mediump sampler2D _MainTex;
layout(location = 0) in highp vec2 gs_TEXCOORD0;
layout(location = 0) out mediump vec4 SV_Target0;
mediump vec4 u_xlat16_0;
void main()
{
u_xlat16_0 = texture(_MainTex, gs_TEXCOORD0.xy);
SV_Target0 = u_xlat16_0;
return;
}
#endif
Why are the Sampler2D as well as SV_Target0 defined to have precision mediump rather than lowp?