bgfx/3rdparty/glsl-optimizer/tests/fragment/z-unishader-dirlm-out.txt
2014-02-10 23:06:13 -08:00

172 lines
5.7 KiB
Text

#extension GL_ARB_shader_texture_lod : enable
uniform vec3 _WorldSpaceCameraPos;
uniform sampler2D _MainTex;
uniform sampler2D _DetailAlbedoMap;
uniform sampler2D _AlphaMap;
uniform sampler2D _Occlusion;
uniform sampler2D _DetailNormalMap;
uniform float _DetailNormalMapScale;
uniform sampler2D _BumpMap;
uniform float _BumpScale;
uniform float _Exposure;
uniform vec4 _Color;
uniform sampler2D _SpecGlossMap;
uniform sampler2D _ShadowMapTexture;
uniform samplerCube _SpecCube;
uniform sampler2D unity_Lightmap;
uniform sampler2D unity_LightmapInd;
uniform float _SelfIllumScale;
uniform sampler2D _SelfIllum;
varying vec4 xlv_TEXCOORD0;
varying vec4 xlv_TEXCOORD1;
varying vec3 xlv_TEXCOORD2;
varying vec4 xlv_TEXCOORD3;
varying vec3 xlv_TEXCOORD4;
varying vec4 xlv_TEXCOORD5;
void main ()
{
vec3 tmpvar_1;
vec3 tmpvar_2;
tmpvar_1 = xlv_TEXCOORD3.xyz;
tmpvar_2 = (((xlv_TEXCOORD2.yzx * xlv_TEXCOORD3.zxy) - (xlv_TEXCOORD2.zxy * xlv_TEXCOORD3.yzx)) * xlv_TEXCOORD3.www);
mat3 tmpvar_3;
tmpvar_3[0].x = tmpvar_1.x;
tmpvar_3[0].y = tmpvar_2.x;
tmpvar_3[0].z = xlv_TEXCOORD2.x;
tmpvar_3[1].x = tmpvar_1.y;
tmpvar_3[1].y = tmpvar_2.y;
tmpvar_3[1].z = xlv_TEXCOORD2.y;
tmpvar_3[2].x = tmpvar_1.z;
tmpvar_3[2].y = tmpvar_2.z;
tmpvar_3[2].z = xlv_TEXCOORD2.z;
vec3 normal_4;
normal_4.xy = ((texture2D (_BumpMap, xlv_TEXCOORD0.xy).wy * 2.0) - 1.0);
normal_4.xy = (normal_4.xy * _BumpScale);
normal_4.z = sqrt((1.0 - clamp (
dot (normal_4.xy, normal_4.xy)
, 0.0, 1.0)));
vec3 normal_5;
normal_5.xy = ((texture2D (_DetailNormalMap, xlv_TEXCOORD0.zw).wy * 2.0) - 1.0);
normal_5.xy = (normal_5.xy * _DetailNormalMapScale);
normal_5.z = sqrt((1.0 - clamp (
dot (normal_5.xy, normal_5.xy)
, 0.0, 1.0)));
vec3 tmpvar_6;
tmpvar_6.xy = (normal_4.xy + normal_5.xy);
tmpvar_6.z = (normal_4.z * normal_5.z);
vec3 tmpvar_7;
tmpvar_7 = normalize(tmpvar_6);
vec3 tmpvar_8;
tmpvar_8 = (tmpvar_7 * tmpvar_3);
vec3 tmpvar_9;
tmpvar_9 = normalize((xlv_TEXCOORD1.xyz - _WorldSpaceCameraPos));
vec4 tmpvar_10;
tmpvar_10 = texture2D (_SpecGlossMap, xlv_TEXCOORD0.xy);
float tmpvar_11;
tmpvar_11 = dot (tmpvar_10.xyz, vec3(0.299, 0.587, 0.114));
float tmpvar_12;
tmpvar_12 = (1.0 - tmpvar_10.w);
vec4 tmpvar_13;
tmpvar_13.xyz = (tmpvar_9 - (2.0 * (
dot (tmpvar_8, tmpvar_9)
* tmpvar_8)));
tmpvar_13.w = (tmpvar_12 * 5.0);
vec4 tmpvar_14;
tmpvar_14 = textureCubeLod (_SpecCube, tmpvar_13.xyz, tmpvar_13.w);
float tmpvar_15;
tmpvar_15 = (tmpvar_14.w * tmpvar_14.w);
vec2 tmpvar_16;
tmpvar_16.x = tmpvar_15;
tmpvar_16.y = (tmpvar_14.w * tmpvar_15);
vec3 tmpvar_17;
tmpvar_17 = (((tmpvar_14.xyz *
dot (vec2(0.7532, 0.2468), tmpvar_16)
) * _Exposure) * texture2D (_Occlusion, xlv_TEXCOORD0.xy).x);
vec4 tmpvar_18;
tmpvar_18 = texture2D (unity_Lightmap, xlv_TEXCOORD4.xy);
vec4 tmpvar_19;
tmpvar_19 = texture2D (unity_LightmapInd, xlv_TEXCOORD4.xy);
mat3 tmpvar_20;
tmpvar_20[0].x = 0.816497;
tmpvar_20[0].y = -0.408248;
tmpvar_20[0].z = -0.408248;
tmpvar_20[1].x = 0.0;
tmpvar_20[1].y = 0.707107;
tmpvar_20[1].z = -0.707107;
tmpvar_20[2].x = 0.57735;
tmpvar_20[2].y = 0.57735;
tmpvar_20[2].z = 0.57735;
vec3 tmpvar_21;
tmpvar_21 = ((8.0 * tmpvar_19.w) * tmpvar_19.xyz);
vec3 v_22;
v_22.x = tmpvar_20[0].x;
v_22.y = tmpvar_20[1].x;
v_22.z = tmpvar_20[2].x;
vec3 v_23;
v_23.x = tmpvar_20[0].y;
v_23.y = tmpvar_20[1].y;
v_23.z = tmpvar_20[2].y;
vec3 v_24;
v_24.x = tmpvar_20[0].z;
v_24.y = tmpvar_20[1].z;
v_24.z = tmpvar_20[2].z;
vec3 tmpvar_25;
tmpvar_25 = normalize((normalize(
(((tmpvar_21.x * v_22) + (tmpvar_21.y * v_23)) + (tmpvar_21.z * v_24))
) * tmpvar_3));
vec3 lightColor_26;
lightColor_26 = (texture2DProj (_ShadowMapTexture, xlv_TEXCOORD5).x * ((
(8.0 * tmpvar_18.w)
* tmpvar_18.xyz) * dot (
clamp ((tmpvar_20 * tmpvar_7), 0.0, 1.0)
, tmpvar_21)));
vec3 viewDir_27;
viewDir_27 = -(tmpvar_9);
vec3 tmpvar_28;
tmpvar_28 = normalize((tmpvar_25 + viewDir_27));
float tmpvar_29;
tmpvar_29 = max (0.0, dot (tmpvar_8, tmpvar_25));
float tmpvar_30;
tmpvar_30 = max (0.0, dot (tmpvar_8, tmpvar_28));
float tmpvar_31;
tmpvar_31 = max (0.0, dot (tmpvar_8, viewDir_27));
float tmpvar_32;
tmpvar_32 = max (0.0, dot (viewDir_27, tmpvar_28));
float tmpvar_33;
tmpvar_33 = (tmpvar_32 + 1e-05);
float tmpvar_34;
tmpvar_34 = ((1.0/((
pow (tmpvar_12, 4.0)
+ 1e-05))) - 2.0);
float tmpvar_35;
tmpvar_35 = (0.5 + ((2.0 *
pow (max (0.0, dot (tmpvar_25, tmpvar_28)), 2.0)
) * tmpvar_12));
vec4 tmpvar_36;
tmpvar_36.xyz = (((
(min (((_Color.xyz * texture2D (_MainTex, xlv_TEXCOORD0.xy).xyz) * (2.0 * texture2D (_DetailAlbedoMap, xlv_TEXCOORD0.zw).xyz)), (vec3(1.0, 1.0, 1.0) - tmpvar_11)) * (((
(1.0 + ((tmpvar_35 - 1.0) * pow ((1.00001 - tmpvar_29), 5.0)))
*
(1.0 + ((tmpvar_35 - 1.0) * pow ((1.00001 - tmpvar_31), 5.0)))
) * tmpvar_29) * lightColor_26))
+
(tmpvar_10.xyz * (tmpvar_17 + (lightColor_26 * max (0.0,
((((tmpvar_11 +
((1.0 - tmpvar_11) * pow (abs((1.0 - tmpvar_32)), 5.0))
) * min (1.0,
min ((((2.0 * tmpvar_30) * tmpvar_31) / tmpvar_33), (((2.0 * tmpvar_30) * tmpvar_29) / tmpvar_33))
)) * max (0.0, (
pow (tmpvar_30, tmpvar_34)
*
((tmpvar_34 + 1.0) / 6.28318)
))) / ((4.0 * tmpvar_31) + 1e-05))
))))
) + (
(((1.0 - dot (tmpvar_10.xyz, vec3(0.299, 0.587, 0.114))) * (1.0 - tmpvar_12)) * pow (abs((1.0 - tmpvar_31)), 5.0))
* tmpvar_17)) + (texture2D (_SelfIllum, xlv_TEXCOORD0.xy).xyz * _SelfIllumScale));
tmpvar_36.w = (texture2D (_AlphaMap, xlv_TEXCOORD0.xy).w * _Color.w);
gl_FragData[0] = tmpvar_36;
}
// inputs: 6, stats: 146 alu 12 tex 0 flow