bgfx/3rdparty/glsl-optimizer/tests/fragment/z-unishader-dirlm-out.txt
2014-10-11 12:32:43 -07:00

205 lines
6.8 KiB
Plaintext

#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 lightDir_1;
vec3 env_2;
vec3 tmpvar_3;
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);
mat3 tmpvar_5;
tmpvar_5[0].x = tmpvar_3.x;
tmpvar_5[0].y = tmpvar_4.x;
tmpvar_5[0].z = xlv_TEXCOORD2.x;
tmpvar_5[1].x = tmpvar_3.y;
tmpvar_5[1].y = tmpvar_4.y;
tmpvar_5[1].z = xlv_TEXCOORD2.y;
tmpvar_5[2].x = tmpvar_3.z;
tmpvar_5[2].y = tmpvar_4.z;
tmpvar_5[2].z = xlv_TEXCOORD2.z;
vec3 normal_6;
normal_6.xy = ((texture2D (_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)));
vec3 normal_7;
normal_7.xy = ((texture2D (_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)));
vec3 tmpvar_8;
tmpvar_8.xy = (normal_6.xy + normal_7.xy);
tmpvar_8.z = (normal_6.z * normal_7.z);
vec3 tmpvar_9;
tmpvar_9 = normalize(tmpvar_8);
vec3 tmpvar_10;
tmpvar_10 = (tmpvar_9 * tmpvar_5);
vec3 tmpvar_11;
tmpvar_11 = normalize((xlv_TEXCOORD1.xyz - _WorldSpaceCameraPos));
vec4 tmpvar_12;
tmpvar_12 = texture2D (_SpecGlossMap, xlv_TEXCOORD0.xy);
float tmpvar_13;
tmpvar_13 = dot (tmpvar_12.xyz, vec3(0.299, 0.587, 0.114));
float tmpvar_14;
tmpvar_14 = (1.0 - tmpvar_12.w);
vec4 tmpvar_15;
tmpvar_15.xyz = (tmpvar_11 - (2.0 * (
dot (tmpvar_10, tmpvar_11)
* tmpvar_10)));
tmpvar_15.w = (tmpvar_14 * 5.0);
vec4 tmpvar_16;
tmpvar_16 = textureCubeLod (_SpecCube, tmpvar_15.xyz, tmpvar_15.w);
float tmpvar_17;
tmpvar_17 = (tmpvar_16.w * tmpvar_16.w);
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) * texture2D (_Occlusion, xlv_TEXCOORD0.xy).x);
vec4 tmpvar_19;
tmpvar_19 = texture2D (unity_Lightmap, xlv_TEXCOORD4.xy);
vec4 tmpvar_20;
tmpvar_20 = texture2D (unity_LightmapInd, xlv_TEXCOORD4.xy);
mat3 tmpvar_21;
tmpvar_21[0].x = 0.816497;
tmpvar_21[0].y = -0.408248;
tmpvar_21[0].z = -0.408248;
tmpvar_21[1].x = 0.0;
tmpvar_21[1].y = 0.707107;
tmpvar_21[1].z = -0.707107;
tmpvar_21[2].x = 0.57735;
tmpvar_21[2].y = 0.57735;
tmpvar_21[2].z = 0.57735;
vec3 tmpvar_22;
tmpvar_22 = ((8.0 * tmpvar_20.w) * tmpvar_20.xyz);
vec3 v_23;
v_23.x = tmpvar_21[0].x;
v_23.y = tmpvar_21[1].x;
v_23.z = tmpvar_21[2].x;
vec3 v_24;
v_24.x = tmpvar_21[0].y;
v_24.y = tmpvar_21[1].y;
v_24.z = tmpvar_21[2].y;
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);
vec3 tmpvar_26;
tmpvar_26 = normalize(lightDir_1);
lightDir_1 = tmpvar_26;
vec3 lightColor_27;
lightColor_27 = (texture2DProj (_ShadowMapTexture, xlv_TEXCOORD5).x * ((
(8.0 * tmpvar_19.w)
* tmpvar_19.xyz) * dot (
clamp ((tmpvar_21 * tmpvar_9), 0.0, 1.0)
, tmpvar_22)));
vec3 viewDir_28;
viewDir_28 = -(tmpvar_11);
vec3 tmpvar_29;
tmpvar_29 = normalize((tmpvar_26 + viewDir_28));
float tmpvar_30;
tmpvar_30 = max (0.0, dot (tmpvar_10, tmpvar_26));
float tmpvar_31;
tmpvar_31 = max (0.0, dot (tmpvar_10, tmpvar_29));
float tmpvar_32;
tmpvar_32 = max (0.0, dot (tmpvar_10, viewDir_28));
float tmpvar_33;
tmpvar_33 = max (0.0, dot (viewDir_28, tmpvar_29));
float VdotH_34;
VdotH_34 = (tmpvar_33 + 1e-05);
float tmpvar_35;
tmpvar_35 = ((1.0/((
pow (tmpvar_14, 4.0)
+ 1e-05))) - 2.0);
float tmpvar_36;
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)));
vec4 tmpvar_38;
tmpvar_38.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_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)) + (texture2D (_SelfIllum, xlv_TEXCOORD0.xy).xyz * _SelfIllumScale));
tmpvar_38.w = (texture2D (_AlphaMap, xlv_TEXCOORD0.xy).w * _Color.w);
gl_FragData[0] = tmpvar_38;
}
// 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 (high 2d) 0x0 [-1]
// #1: _DetailAlbedoMap (high 2d) 0x0 [-1]
// #2: _AlphaMap (high 2d) 0x0 [-1]
// #3: _Occlusion (high 2d) 0x0 [-1]
// #4: _DetailNormalMap (high 2d) 0x0 [-1]
// #5: _BumpMap (high 2d) 0x0 [-1]
// #6: _SpecGlossMap (high 2d) 0x0 [-1]
// #7: _ShadowMapTexture (high 2d) 0x0 [-1]
// #8: _SpecCube (high cube) 0x0 [-1]
// #9: unity_Lightmap (high 2d) 0x0 [-1]
// #10: unity_LightmapInd (high 2d) 0x0 [-1]
// #11: _SelfIllum (high 2d) 0x0 [-1]