bgfx/3rdparty/glsl-optimizer/tests/fragment/zun-Hidden_Internal-PrePassLighting-out.txt

85 lines
2.5 KiB
Plaintext
Raw Normal View History

2012-10-08 07:41:18 +04:00
uniform sampler2D _CameraDepthTexture;
2014-02-11 11:06:13 +04:00
uniform sampler2D _CameraNormalsTexture;
uniform vec4 _LightColor;
uniform vec4 _LightPos;
uniform vec4 _LightPositionRange;
uniform vec4 _LightShadowData;
uniform samplerCube _LightTexture0;
uniform sampler2D _LightTextureB0;
uniform vec4 _ProjectionParams;
uniform samplerCube _ShadowMapTexture;
uniform mat4 _View2Shadow;
uniform mat4 _ViewToCookie;
uniform vec4 _ZBufferParams;
uniform vec4 unity_LightmapFade;
2012-10-08 07:41:18 +04:00
void main ()
{
vec4 tmpvar_1;
tmpvar_1 = gl_TexCoord[0];
vec3 tmpvar_2;
tmpvar_2 = gl_TexCoord[1].xyz;
vec4 res_3;
float atten_4;
vec3 lightDir_5;
vec3 normal_6;
vec2 tmpvar_7;
tmpvar_7 = (tmpvar_1.xy / tmpvar_1.w);
vec4 tmpvar_8;
tmpvar_8 = texture2D (_CameraNormalsTexture, tmpvar_7);
normal_6 = normalize(((tmpvar_8.xyz * 2.0) - 1.0));
vec3 tmpvar_9;
2014-02-11 11:06:13 +04:00
tmpvar_9 = ((tmpvar_2 * (_ProjectionParams.z / tmpvar_2.z)) * (1.0/((
(_ZBufferParams.x * texture2D (_CameraDepthTexture, tmpvar_7).x)
+ _ZBufferParams.y))));
2012-10-08 07:41:18 +04:00
vec3 tmpvar_10;
tmpvar_10 = (_LightPos.xyz - tmpvar_9);
lightDir_5 = normalize(tmpvar_10);
atten_4 = texture2D (_LightTextureB0, vec2((dot (tmpvar_10, tmpvar_10) * _LightPos.w))).w;
vec3 vec_11;
vec_11 = -(tmpvar_10);
mat3 tmpvar_12;
tmpvar_12[0] = _View2Shadow[0].xyz;
tmpvar_12[1] = _View2Shadow[1].xyz;
tmpvar_12[2] = _View2Shadow[2].xyz;
vec3 tmpvar_13;
tmpvar_13 = (tmpvar_12 * vec_11);
vec_11 = tmpvar_13;
float tmpvar_14;
2014-02-11 11:06:13 +04:00
tmpvar_14 = ((sqrt(
dot (tmpvar_13, tmpvar_13)
) * _LightPositionRange.w) * 0.97);
2012-10-08 07:41:18 +04:00
float tmpvar_15;
tmpvar_15 = dot (textureCube (_ShadowMapTexture, tmpvar_13), vec4(1.0, 0.00392157, 1.53787e-05, 6.22737e-09));
float tmpvar_16;
if ((tmpvar_15 < tmpvar_14)) {
tmpvar_16 = _LightShadowData.x;
} else {
tmpvar_16 = 1.0;
};
vec4 tmpvar_17;
tmpvar_17.w = 1.0;
tmpvar_17.xyz = tmpvar_9;
float tmpvar_18;
tmpvar_18 = ((atten_4 * tmpvar_16) * textureCube (_LightTexture0, (_ViewToCookie * tmpvar_17).xyz).w);
atten_4 = tmpvar_18;
2014-02-11 11:06:13 +04:00
res_3.xyz = (_LightColor.xyz * (max (0.0,
dot (lightDir_5, normal_6)
) * tmpvar_18));
res_3.w = ((pow (
max (0.0, dot (normalize((lightDir_5 -
normalize(tmpvar_9)
)), normal_6))
,
(tmpvar_8.w * 128.0)
) * clamp (tmpvar_18, 0.0, 1.0)) * dot (_LightColor.xyz, vec3(0.22, 0.707, 0.071)));
2012-10-08 07:41:18 +04:00
vec4 tmpvar_19;
2014-02-11 11:06:13 +04:00
tmpvar_19 = (res_3 * clamp ((1.0 -
((tmpvar_9.z * unity_LightmapFade.z) + unity_LightmapFade.w)
), 0.0, 1.0));
2012-10-08 07:41:18 +04:00
res_3 = tmpvar_19;
gl_FragData[0] = exp2(-(tmpvar_19));
}
2014-02-11 11:06:13 +04:00
// inputs: 1, stats: 49 alu 5 tex 1 flow