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

169 lines
5.3 KiB
Text

uniform sampler2D _CameraDepthTexture;
uniform sampler2D _CameraNormalsTexture;
uniform highp mat4 _CameraToWorld;
uniform highp vec4 _LightColor;
uniform highp mat4 _LightMatrix0;
uniform highp vec4 _LightPos;
uniform highp vec4 _LightPositionRange;
uniform highp vec4 _LightShadowData;
uniform samplerCube _LightTexture0;
uniform sampler2D _LightTextureB0;
uniform highp vec4 _ProjectionParams;
uniform samplerCube _ShadowMapTexture;
uniform highp vec3 _WorldSpaceCameraPos;
uniform highp vec4 _ZBufferParams;
uniform highp vec4 unity_LightmapFade;
varying highp vec4 xlv_TEXCOORD0;
varying highp vec3 xlv_TEXCOORD1;
void main ()
{
mediump vec4 res_1;
highp float spec_2;
mediump vec3 h_3;
highp float atten_4;
mediump vec3 lightDir_5;
highp float depth_6;
mediump vec3 normal_7;
mediump vec4 nspec_8;
highp vec2 tmpvar_9;
tmpvar_9 = (xlv_TEXCOORD0.xy / xlv_TEXCOORD0.w);
lowp vec4 tmpvar_10;
tmpvar_10 = texture2D (_CameraNormalsTexture, tmpvar_9);
nspec_8 = tmpvar_10;
normal_7 = normalize(((nspec_8.xyz * 2.0) - 1.0));
lowp float tmpvar_11;
tmpvar_11 = texture2D (_CameraDepthTexture, tmpvar_9).x;
depth_6 = tmpvar_11;
highp float tmpvar_12;
tmpvar_12 = (1.0/(((_ZBufferParams.x * depth_6) + _ZBufferParams.y)));
depth_6 = tmpvar_12;
highp vec4 tmpvar_13;
tmpvar_13.w = 1.0;
tmpvar_13.xyz = ((xlv_TEXCOORD1 * (_ProjectionParams.z / xlv_TEXCOORD1.z)) * tmpvar_12);
highp vec3 tmpvar_14;
tmpvar_14 = (_CameraToWorld * tmpvar_13).xyz;
highp vec3 tmpvar_15;
tmpvar_15 = (tmpvar_14 - _LightPos.xyz);
highp vec3 tmpvar_16;
tmpvar_16 = -(normalize(tmpvar_15));
lightDir_5 = tmpvar_16;
highp vec2 tmpvar_17;
tmpvar_17 = vec2((dot (tmpvar_15, tmpvar_15) * _LightPos.w));
lowp float tmpvar_18;
tmpvar_18 = texture2D (_LightTextureB0, tmpvar_17).w;
atten_4 = tmpvar_18;
highp float tmpvar_19;
tmpvar_19 = ((sqrt(
dot (tmpvar_15, tmpvar_15)
) * _LightPositionRange.w) * 0.97);
mediump vec4 shadows_20;
highp vec4 shadowVals_21;
highp vec3 vec_22;
vec_22 = (tmpvar_15 + vec3(0.0078125, 0.0078125, 0.0078125));
highp vec4 packDist_23;
lowp vec4 tmpvar_24;
tmpvar_24 = textureCube (_ShadowMapTexture, vec_22);
packDist_23 = tmpvar_24;
shadowVals_21.x = dot (packDist_23, vec4(1.0, 0.00392157, 1.53787e-05, 6.22737e-09));
highp vec3 vec_25;
vec_25 = (tmpvar_15 + vec3(-0.0078125, -0.0078125, 0.0078125));
highp vec4 packDist_26;
lowp vec4 tmpvar_27;
tmpvar_27 = textureCube (_ShadowMapTexture, vec_25);
packDist_26 = tmpvar_27;
shadowVals_21.y = dot (packDist_26, vec4(1.0, 0.00392157, 1.53787e-05, 6.22737e-09));
highp vec3 vec_28;
vec_28 = (tmpvar_15 + vec3(-0.0078125, 0.0078125, -0.0078125));
highp vec4 packDist_29;
lowp vec4 tmpvar_30;
tmpvar_30 = textureCube (_ShadowMapTexture, vec_28);
packDist_29 = tmpvar_30;
shadowVals_21.z = dot (packDist_29, vec4(1.0, 0.00392157, 1.53787e-05, 6.22737e-09));
highp vec3 vec_31;
vec_31 = (tmpvar_15 + vec3(0.0078125, -0.0078125, -0.0078125));
highp vec4 packDist_32;
lowp vec4 tmpvar_33;
tmpvar_33 = textureCube (_ShadowMapTexture, vec_31);
packDist_32 = tmpvar_33;
shadowVals_21.w = dot (packDist_32, vec4(1.0, 0.00392157, 1.53787e-05, 6.22737e-09));
bvec4 tmpvar_34;
tmpvar_34 = lessThan (shadowVals_21, vec4(tmpvar_19));
highp vec4 tmpvar_35;
tmpvar_35 = _LightShadowData.xxxx;
highp float tmpvar_36;
if (tmpvar_34.x) {
tmpvar_36 = tmpvar_35.x;
} else {
tmpvar_36 = 1.0;
};
highp float tmpvar_37;
if (tmpvar_34.y) {
tmpvar_37 = tmpvar_35.y;
} else {
tmpvar_37 = 1.0;
};
highp float tmpvar_38;
if (tmpvar_34.z) {
tmpvar_38 = tmpvar_35.z;
} else {
tmpvar_38 = 1.0;
};
highp float tmpvar_39;
if (tmpvar_34.w) {
tmpvar_39 = tmpvar_35.w;
} else {
tmpvar_39 = 1.0;
};
highp vec4 tmpvar_40;
tmpvar_40.x = tmpvar_36;
tmpvar_40.y = tmpvar_37;
tmpvar_40.z = tmpvar_38;
tmpvar_40.w = tmpvar_39;
shadows_20 = tmpvar_40;
mediump float tmpvar_41;
tmpvar_41 = dot (shadows_20, vec4(0.25, 0.25, 0.25, 0.25));
highp vec4 tmpvar_42;
tmpvar_42.w = 1.0;
tmpvar_42.xyz = tmpvar_14;
lowp vec4 tmpvar_43;
highp vec3 P_44;
P_44 = (_LightMatrix0 * tmpvar_42).xyz;
tmpvar_43 = textureCube (_LightTexture0, P_44);
highp float tmpvar_45;
tmpvar_45 = ((atten_4 * tmpvar_41) * tmpvar_43.w);
atten_4 = tmpvar_45;
mediump float tmpvar_46;
tmpvar_46 = max (0.0, dot (lightDir_5, normal_7));
highp vec3 tmpvar_47;
tmpvar_47 = normalize((lightDir_5 - normalize(
(tmpvar_14 - _WorldSpaceCameraPos)
)));
h_3 = tmpvar_47;
mediump float tmpvar_48;
tmpvar_48 = pow (max (0.0, dot (h_3, normal_7)), (nspec_8.w * 128.0));
spec_2 = tmpvar_48;
highp float tmpvar_49;
tmpvar_49 = (spec_2 * clamp (tmpvar_45, 0.0, 1.0));
spec_2 = tmpvar_49;
highp vec3 tmpvar_50;
tmpvar_50 = (_LightColor.xyz * (tmpvar_46 * tmpvar_45));
res_1.xyz = tmpvar_50;
mediump vec3 c_51;
c_51 = _LightColor.xyz;
mediump float tmpvar_52;
tmpvar_52 = dot (c_51, vec3(0.22, 0.707, 0.071));
highp float tmpvar_53;
tmpvar_53 = (tmpvar_49 * tmpvar_52);
res_1.w = tmpvar_53;
highp float tmpvar_54;
tmpvar_54 = clamp ((1.0 - (
(tmpvar_13.z * unity_LightmapFade.z)
+ unity_LightmapFade.w)), 0.0, 1.0);
mediump vec4 tmpvar_55;
tmpvar_55 = (res_1 * tmpvar_54);
res_1 = tmpvar_55;
gl_FragData[0] = exp2(-(tmpvar_55));
}
// inputs: 2, stats: 62 alu 8 tex 4 flow