bgfx/3rdparty/glsl-optimizer/tests/fragment/unity-MobileBumpSpec-irES.txt

188 lines
4.1 KiB
Text
Raw Normal View History

2012-04-03 23:30:07 -04:00
struct SurfaceOutput {
lowp vec3 Albedo;
lowp vec3 Normal;
lowp vec3 Emission;
mediump float Specular;
lowp float Gloss;
lowp float Alpha;
};
struct Input {
mediump vec2 uv_MainTex;
};
struct v2f_surf {
highp vec4 pos;
mediump vec2 pack0;
mediump vec3 viewDir;
lowp vec3 lightDir;
lowp vec3 vlight;
};
varying lowp vec3 xlv_TEXCOORD3;
varying lowp vec3 xlv_TEXCOORD2;
varying mediump vec3 xlv_TEXCOORD1;
varying mediump vec2 xlv_TEXCOORD0;
uniform mediump float _Shininess;
uniform sampler2D _MainTex;
uniform lowp vec4 _LightColor0;
uniform sampler2D _BumpMap;
lowp vec3 UnpackNormal (
in lowp vec4 packednormal
)
{
return ((packednormal.xyz * 2.0) - 1.0);
}
void surf (
in Input IN,
inout SurfaceOutput o
)
{
lowp vec4 tex;
lowp vec4 tmpvar_1;
tmpvar_1 = texture2D (_MainTex, IN.uv_MainTex);
lowp vec4 tmpvar_2;
tmpvar_2 = tmpvar_1;
tex = tmpvar_2;
lowp vec3 tmpvar_3;
tmpvar_3 = tex.xyz;
o.Albedo = tmpvar_3;
lowp float tmpvar_4;
tmpvar_4 = tex.w;
o.Gloss = tmpvar_4;
lowp float tmpvar_5;
tmpvar_5 = tex.w;
o.Alpha = tmpvar_5;
mediump float tmpvar_6;
tmpvar_6 = _Shininess;
o.Specular = tmpvar_6;
lowp vec4 tmpvar_7;
tmpvar_7 = texture2D (_BumpMap, IN.uv_MainTex);
lowp vec3 tmpvar_8;
tmpvar_8 = UnpackNormal (tmpvar_7);
lowp vec3 tmpvar_9;
tmpvar_9 = tmpvar_8;
o.Normal = tmpvar_9;
}
lowp vec4 LightingMobileBlinnPhong (
in SurfaceOutput s,
in lowp vec3 lightDir,
in lowp vec3 halfDir,
in lowp float atten
)
{
lowp vec4 c;
lowp float spec;
lowp float nh;
lowp float diff;
lowp float tmpvar_1;
tmpvar_1 = dot (s.Normal, lightDir);
lowp float tmpvar_2;
tmpvar_2 = max (0.0, tmpvar_1);
lowp float tmpvar_3;
tmpvar_3 = tmpvar_2;
diff = tmpvar_3;
lowp float tmpvar_4;
tmpvar_4 = dot (s.Normal, halfDir);
lowp float tmpvar_5;
tmpvar_5 = max (0.0, tmpvar_4);
lowp float tmpvar_6;
tmpvar_6 = tmpvar_5;
nh = tmpvar_6;
mediump float tmpvar_7;
tmpvar_7 = pow (nh, (s.Specular * 128.0));
mediump float tmpvar_8;
tmpvar_8 = (tmpvar_7 * s.Gloss);
spec = tmpvar_8;
lowp vec3 tmpvar_9;
tmpvar_9 = ((((s.Albedo * diff) + spec) * _LightColor0.xyz) * (atten * 2.0));
c.xyz = tmpvar_9.xyz.xyz;
float tmpvar_10;
tmpvar_10 = 0.0;
c.w = vec4(tmpvar_10).w;
return c;
}
lowp vec4 frag_surf (
in v2f_surf IN
)
{
lowp vec4 c;
lowp float atten;
SurfaceOutput o;
Input surfIN;
mediump vec2 tmpvar_1;
tmpvar_1 = IN.pack0.xy;
surfIN.uv_MainTex = tmpvar_1;
vec3 tmpvar_2;
tmpvar_2 = vec3(0.0, 0.0, 0.0);
o.Albedo = tmpvar_2;
vec3 tmpvar_3;
tmpvar_3 = vec3(0.0, 0.0, 0.0);
o.Emission = tmpvar_3;
float tmpvar_4;
tmpvar_4 = 0.0;
o.Specular = tmpvar_4;
float tmpvar_5;
tmpvar_5 = 0.0;
o.Alpha = tmpvar_5;
float tmpvar_6;
tmpvar_6 = 0.0;
o.Gloss = tmpvar_6;
surf (surfIN, o);
float tmpvar_7;
tmpvar_7 = 1.0;
atten = tmpvar_7;
vec4 tmpvar_8;
tmpvar_8 = vec4(0.0, 0.0, 0.0, 0.0);
c = tmpvar_8;
lowp vec4 tmpvar_9;
tmpvar_9 = LightingMobileBlinnPhong (o, IN.lightDir, IN.viewDir, atten);
lowp vec4 tmpvar_10;
tmpvar_10 = tmpvar_9;
c = tmpvar_10;
lowp vec3 tmpvar_11;
tmpvar_11 = (c.xyz + (o.Albedo * IN.vlight));
c.xyz = tmpvar_11.xyz.xyz;
return c;
}
void main ()
{
v2f_surf xlt_IN;
lowp vec4 xl_retval;
vec4 tmpvar_1;
tmpvar_1 = vec4(0.0, 0.0, 0.0, 0.0);
xlt_IN.pos = tmpvar_1;
mediump vec2 tmpvar_2;
tmpvar_2 = xlv_TEXCOORD0.xy;
mediump vec2 tmpvar_3;
tmpvar_3 = tmpvar_2;
xlt_IN.pack0 = tmpvar_3;
mediump vec3 tmpvar_4;
tmpvar_4 = xlv_TEXCOORD1.xyz;
mediump vec3 tmpvar_5;
tmpvar_5 = tmpvar_4;
xlt_IN.viewDir = tmpvar_5;
lowp vec3 tmpvar_6;
tmpvar_6 = xlv_TEXCOORD2.xyz;
lowp vec3 tmpvar_7;
tmpvar_7 = tmpvar_6;
xlt_IN.lightDir = tmpvar_7;
lowp vec3 tmpvar_8;
tmpvar_8 = xlv_TEXCOORD3.xyz;
lowp vec3 tmpvar_9;
tmpvar_9 = tmpvar_8;
xlt_IN.vlight = tmpvar_9;
lowp vec4 tmpvar_10;
tmpvar_10 = frag_surf (xlt_IN);
lowp vec4 tmpvar_11;
tmpvar_11 = tmpvar_10;
xl_retval = tmpvar_11;
lowp vec4 tmpvar_12;
tmpvar_12 = xl_retval.xyzw;
lowp vec4 tmpvar_13;
tmpvar_13 = tmpvar_12;
gl_FragData[0] = tmpvar_13;
}