bgfx/3rdparty/glsl-optimizer/tests/fragment/z-unishader-dirlm-outES3.txt
2015-04-02 23:30:48 -07:00

208 lines
7.1 KiB
Plaintext

#version 300 es
out mediump vec4 _fragData;
uniform highp vec3 _WorldSpaceCameraPos;
uniform sampler2D _MainTex;
uniform sampler2D _DetailAlbedoMap;
uniform sampler2D _AlphaMap;
uniform sampler2D _Occlusion;
uniform sampler2D _DetailNormalMap;
uniform highp float _DetailNormalMapScale;
uniform sampler2D _BumpMap;
uniform highp float _BumpScale;
uniform highp float _Exposure;
uniform highp vec4 _Color;
uniform sampler2D _SpecGlossMap;
uniform sampler2D _ShadowMapTexture;
uniform lowp samplerCube _SpecCube;
uniform sampler2D unity_Lightmap;
uniform sampler2D unity_LightmapInd;
uniform highp float _SelfIllumScale;
uniform sampler2D _SelfIllum;
in highp vec4 xlv_TEXCOORD0;
in highp vec4 xlv_TEXCOORD1;
in highp vec3 xlv_TEXCOORD2;
in highp vec4 xlv_TEXCOORD3;
in highp vec3 xlv_TEXCOORD4;
in highp vec4 xlv_TEXCOORD5;
void main ()
{
lowp vec3 lightDir_1;
lowp vec3 env_2;
highp vec3 tmpvar_3;
highp vec3 tmpvar_4;
tmpvar_3 = xlv_TEXCOORD3.xyz;
tmpvar_4 = (((xlv_TEXCOORD2.yzx * xlv_TEXCOORD3.zxy) - (xlv_TEXCOORD2.zxy * xlv_TEXCOORD3.yzx)) * xlv_TEXCOORD3.www);
highp mat3 tmpvar_5;
tmpvar_5[uint(0)].x = tmpvar_3.x;
tmpvar_5[uint(0)].y = tmpvar_4.x;
tmpvar_5[uint(0)].z = xlv_TEXCOORD2.x;
tmpvar_5[1u].x = tmpvar_3.y;
tmpvar_5[1u].y = tmpvar_4.y;
tmpvar_5[1u].z = xlv_TEXCOORD2.y;
tmpvar_5[2u].x = tmpvar_3.z;
tmpvar_5[2u].y = tmpvar_4.z;
tmpvar_5[2u].z = xlv_TEXCOORD2.z;
lowp vec3 normal_6;
normal_6.xy = ((texture (_BumpMap, xlv_TEXCOORD0.xy).wy * 2.0) - 1.0);
normal_6.xy = (normal_6.xy * _BumpScale);
normal_6.z = sqrt((1.0 - clamp (
dot (normal_6.xy, normal_6.xy)
, 0.0, 1.0)));
lowp vec3 normal_7;
normal_7.xy = ((texture (_DetailNormalMap, xlv_TEXCOORD0.zw).wy * 2.0) - 1.0);
normal_7.xy = (normal_7.xy * _DetailNormalMapScale);
normal_7.z = sqrt((1.0 - clamp (
dot (normal_7.xy, normal_7.xy)
, 0.0, 1.0)));
lowp vec3 tmpvar_8;
tmpvar_8.xy = (normal_6.xy + normal_7.xy);
tmpvar_8.z = (normal_6.z * normal_7.z);
lowp vec3 tmpvar_9;
tmpvar_9 = normalize(tmpvar_8);
lowp vec3 tmpvar_10;
tmpvar_10 = (tmpvar_9 * tmpvar_5);
highp vec3 tmpvar_11;
tmpvar_11 = normalize((xlv_TEXCOORD1.xyz - _WorldSpaceCameraPos));
lowp vec4 tmpvar_12;
tmpvar_12 = texture (_SpecGlossMap, xlv_TEXCOORD0.xy);
lowp float tmpvar_13;
tmpvar_13 = dot (tmpvar_12.xyz, vec3(0.299, 0.587, 0.114));
lowp float tmpvar_14;
tmpvar_14 = (1.0 - tmpvar_12.w);
lowp vec4 tmpvar_15;
tmpvar_15.xyz = (tmpvar_11 - (2.0 * (
dot (tmpvar_10, tmpvar_11)
* tmpvar_10)));
tmpvar_15.w = (tmpvar_14 * 5.0);
lowp vec4 tmpvar_16;
tmpvar_16 = textureLod (_SpecCube, tmpvar_15.xyz, tmpvar_15.w);
lowp float tmpvar_17;
tmpvar_17 = (tmpvar_16.w * tmpvar_16.w);
lowp vec2 tmpvar_18;
tmpvar_18.x = tmpvar_17;
tmpvar_18.y = (tmpvar_16.w * tmpvar_17);
env_2 = (((tmpvar_16.xyz *
dot (vec2(0.7532, 0.2468), tmpvar_18)
) * _Exposure) * texture (_Occlusion, xlv_TEXCOORD0.xy).x);
lowp vec4 tmpvar_19;
tmpvar_19 = texture (unity_Lightmap, xlv_TEXCOORD4.xy);
lowp vec4 tmpvar_20;
tmpvar_20 = texture (unity_LightmapInd, xlv_TEXCOORD4.xy);
highp mat3 tmpvar_21;
tmpvar_21[uint(0)].x = 0.816497;
tmpvar_21[uint(0)].y = -0.408248;
tmpvar_21[uint(0)].z = -0.408248;
tmpvar_21[1u].x = 0.0;
tmpvar_21[1u].y = 0.707107;
tmpvar_21[1u].z = -0.707107;
tmpvar_21[2u].x = 0.57735;
tmpvar_21[2u].y = 0.57735;
tmpvar_21[2u].z = 0.57735;
lowp vec3 tmpvar_22;
tmpvar_22 = ((8.0 * tmpvar_20.w) * tmpvar_20.xyz);
highp vec3 v_23;
v_23.x = tmpvar_21[0].x;
v_23.y = tmpvar_21[1].x;
v_23.z = tmpvar_21[2].x;
highp vec3 v_24;
v_24.x = tmpvar_21[0].y;
v_24.y = tmpvar_21[1].y;
v_24.z = tmpvar_21[2].y;
highp vec3 v_25;
v_25.x = tmpvar_21[0].z;
v_25.y = tmpvar_21[1].z;
v_25.z = tmpvar_21[2].z;
lightDir_1 = (normalize((
((tmpvar_22.x * v_23) + (tmpvar_22.y * v_24))
+
(tmpvar_22.z * v_25)
)) * tmpvar_5);
lowp vec3 tmpvar_26;
tmpvar_26 = normalize(lightDir_1);
lightDir_1 = tmpvar_26;
lowp vec3 lightColor_27;
lightColor_27 = (textureProj (_ShadowMapTexture, xlv_TEXCOORD5).x * ((
(8.0 * tmpvar_19.w)
* tmpvar_19.xyz) * dot (
clamp ((tmpvar_21 * tmpvar_9), 0.0, 1.0)
, tmpvar_22)));
highp vec3 viewDir_28;
viewDir_28 = -(tmpvar_11);
lowp vec3 tmpvar_29;
tmpvar_29 = normalize((tmpvar_26 + viewDir_28));
lowp float tmpvar_30;
tmpvar_30 = max (0.0, dot (tmpvar_10, tmpvar_26));
lowp float tmpvar_31;
tmpvar_31 = max (0.0, dot (tmpvar_10, tmpvar_29));
lowp float tmpvar_32;
tmpvar_32 = max (0.0, dot (tmpvar_10, viewDir_28));
lowp float tmpvar_33;
tmpvar_33 = max (0.0, dot (viewDir_28, tmpvar_29));
lowp float VdotH_34;
VdotH_34 = (tmpvar_33 + 1e-05);
lowp float tmpvar_35;
tmpvar_35 = ((1.0/((
pow (tmpvar_14, 4.0)
+ 1e-05))) - 2.0);
lowp float tmpvar_36;
lowp float tmpvar_37;
tmpvar_37 = max (0.0, dot (tmpvar_26, tmpvar_29));
tmpvar_36 = (0.5 + ((2.0 * tmpvar_37) * (tmpvar_37 * tmpvar_14)));
lowp vec4 tmpvar_38;
tmpvar_38.xyz = (((
(min (((_Color.xyz * texture (_MainTex, xlv_TEXCOORD0.xy).xyz) * (2.0 * texture (_DetailAlbedoMap, xlv_TEXCOORD0.zw).xyz)), (vec3(1.0, 1.0, 1.0) - tmpvar_13)) * (((
(1.0 + ((tmpvar_36 - 1.0) * pow ((1.00001 - tmpvar_30), 5.0)))
*
(1.0 + ((tmpvar_36 - 1.0) * pow ((1.00001 - tmpvar_32), 5.0)))
) * tmpvar_30) * lightColor_27))
+
(tmpvar_12.xyz * (env_2 + (lightColor_27 * max (0.0,
((((tmpvar_13 +
((1.0 - tmpvar_13) * pow (abs((1.0 - tmpvar_33)), 5.0))
) * min (1.0,
min ((((2.0 * tmpvar_31) * tmpvar_32) / VdotH_34), (((2.0 * tmpvar_31) * tmpvar_30) / VdotH_34))
)) * max (0.0, (
pow (tmpvar_31, tmpvar_35)
*
((tmpvar_35 + 1.0) / 6.28318)
))) / ((4.0 * tmpvar_32) + 1e-05))
))))
) + (
(((1.0 - dot (tmpvar_12.xyz, vec3(0.299, 0.587, 0.114))) * (1.0 - tmpvar_14)) * pow (abs((1.0 - tmpvar_32)), 5.0))
* env_2)) + (texture (_SelfIllum, xlv_TEXCOORD0.xy).xyz * _SelfIllumScale));
tmpvar_38.w = (texture (_AlphaMap, xlv_TEXCOORD0.xy).w * _Color.w);
mediump vec4 tmpvar_39;
tmpvar_39 = tmpvar_38;
_fragData = tmpvar_39;
}
// stats: 146 alu 12 tex 0 flow
// inputs: 6
// #0: xlv_TEXCOORD0 (high float) 4x1 [-1]
// #1: xlv_TEXCOORD1 (high float) 4x1 [-1]
// #2: xlv_TEXCOORD2 (high float) 3x1 [-1]
// #3: xlv_TEXCOORD3 (high float) 4x1 [-1]
// #4: xlv_TEXCOORD4 (high float) 3x1 [-1]
// #5: xlv_TEXCOORD5 (high float) 4x1 [-1]
// uniforms: 6 (total size: 0)
// #0: _WorldSpaceCameraPos (high float) 3x1 [-1]
// #1: _DetailNormalMapScale (high float) 1x1 [-1]
// #2: _BumpScale (high float) 1x1 [-1]
// #3: _Exposure (high float) 1x1 [-1]
// #4: _Color (high float) 4x1 [-1]
// #5: _SelfIllumScale (high float) 1x1 [-1]
// textures: 12
// #0: _MainTex (low 2d) 0x0 [-1]
// #1: _DetailAlbedoMap (low 2d) 0x0 [-1]
// #2: _AlphaMap (low 2d) 0x0 [-1]
// #3: _Occlusion (low 2d) 0x0 [-1]
// #4: _DetailNormalMap (low 2d) 0x0 [-1]
// #5: _BumpMap (low 2d) 0x0 [-1]
// #6: _SpecGlossMap (low 2d) 0x0 [-1]
// #7: _ShadowMapTexture (low 2d) 0x0 [-1]
// #8: _SpecCube (low cube) 0x0 [-1]
// #9: unity_Lightmap (low 2d) 0x0 [-1]
// #10: unity_LightmapInd (low 2d) 0x0 [-1]
// #11: _SelfIllum (low 2d) 0x0 [-1]