bgfx/3rdparty/glsl-optimizer/tests/fragment/unity-Hidden_Internal-PrePassCollectShadows-ir.txt

192 lines
3.9 KiB
Text
Raw Normal View History

2012-04-03 23:30:07 -04:00
struct v2f {
vec4 pos;
vec2 uv;
vec3 ray;
};
uniform vec4 _ZBufferParams;
uniform mat4 _View2Shadow3;
uniform mat4 _View2Shadow2;
uniform mat4 _View2Shadow1;
uniform mat4 _View2Shadow;
uniform sampler2D _ShadowMapTexture;
uniform vec4 _LightSplitsNear;
uniform vec4 _LightSplitsFar;
uniform vec4 _LightShadowData;
uniform sampler2D _CameraDepthTexture;
float unitySampleShadow (
in vec4 eyePos
)
{
float shadow;
vec4 coord;
vec4 weights;
vec4 far;
vec4 near;
float z;
vec3 sc3;
vec3 sc2;
vec3 sc1;
vec3 sc0;
vec3 tmpvar_1;
tmpvar_1 = (_View2Shadow * eyePos).xyz;
sc0 = tmpvar_1;
vec3 tmpvar_2;
tmpvar_2 = (_View2Shadow1 * eyePos).xyz;
sc1 = tmpvar_2;
vec3 tmpvar_3;
tmpvar_3 = (_View2Shadow2 * eyePos).xyz;
sc2 = tmpvar_3;
vec3 tmpvar_4;
tmpvar_4 = (_View2Shadow3 * eyePos).xyz;
sc3 = tmpvar_4;
float tmpvar_5;
tmpvar_5 = eyePos.z;
z = tmpvar_5;
vec4 tmpvar_6;
tmpvar_6 = vec4(z);
bvec4 tmpvar_7;
tmpvar_7 = greaterThanEqual (tmpvar_6, _LightSplitsNear);
vec4 tmpvar_8;
tmpvar_8 = vec4(tmpvar_7).xyzw;
vec4 tmpvar_9;
tmpvar_9 = tmpvar_8;
near = tmpvar_9;
vec4 tmpvar_10;
tmpvar_10 = vec4(z);
bvec4 tmpvar_11;
tmpvar_11 = lessThan (tmpvar_10, _LightSplitsFar);
vec4 tmpvar_12;
tmpvar_12 = vec4(tmpvar_11).xyzw;
vec4 tmpvar_13;
tmpvar_13 = tmpvar_12;
far = tmpvar_13;
vec4 tmpvar_14;
tmpvar_14 = (near * far);
weights = tmpvar_14;
vec4 tmpvar_15;
tmpvar_15.w = 1.0;
tmpvar_15.xyz = ((((sc0 * weights.x) + (sc1 * weights.y)) + (sc2 * weights.z)) + (sc3 * weights.w)).xyz;
vec4 tmpvar_16;
tmpvar_16 = tmpvar_15;
coord = tmpvar_16;
vec4 tmpvar_17;
tmpvar_17 = texture2D (_ShadowMapTexture, coord.xy);
float tmpvar_18;
if ((tmpvar_17.x < coord.z)) {
tmpvar_18 = _LightShadowData.x;
} else {
tmpvar_18 = 1.0;
};
float tmpvar_19;
tmpvar_19 = tmpvar_18;
shadow = tmpvar_19;
return shadow;
}
float Linear01Depth (
in float z
)
{
return (1.0 / ((_ZBufferParams.x * z) + _ZBufferParams.y));
}
vec2 EncodeFloatRG (
in float v
)
{
vec2 enc;
float kEncodeBit;
vec2 kEncodeMul;
vec2 tmpvar_1;
tmpvar_1 = vec2(1.0, 255.0);
kEncodeMul = tmpvar_1;
float tmpvar_2;
tmpvar_2 = 0.00392157;
kEncodeBit = tmpvar_2;
vec2 tmpvar_3;
tmpvar_3 = (kEncodeMul * v);
enc = tmpvar_3;
vec2 tmpvar_4;
tmpvar_4 = fract (enc);
vec2 tmpvar_5;
tmpvar_5 = tmpvar_4;
enc = tmpvar_5;
float tmpvar_6;
tmpvar_6 = (enc.x - (enc.y * kEncodeBit));
enc.x = tmpvar_6;
return enc;
}
vec4 frag (
in v2f i
)
{
vec4 res;
float shadow;
vec4 vpos;
float depth;
vec4 tmpvar_1;
tmpvar_1 = texture2D (_CameraDepthTexture, i.uv);
float tmpvar_2;
tmpvar_2 = tmpvar_1.x;
depth = tmpvar_2;
float tmpvar_3;
tmpvar_3 = Linear01Depth (depth);
float tmpvar_4;
tmpvar_4 = tmpvar_3;
depth = tmpvar_4;
vec4 tmpvar_5;
tmpvar_5.w = 1.0;
tmpvar_5.xyz = (i.ray * depth).xyz;
vec4 tmpvar_6;
tmpvar_6 = tmpvar_5;
vpos = tmpvar_6;
float tmpvar_7;
tmpvar_7 = unitySampleShadow (vpos);
float tmpvar_8;
tmpvar_8 = tmpvar_7;
shadow = tmpvar_8;
float tmpvar_9;
tmpvar_9 = shadow;
res.x = tmpvar_9;
float tmpvar_10;
tmpvar_10 = 1.0;
res.y = vec2(tmpvar_10).y;
vec2 tmpvar_11;
tmpvar_11 = EncodeFloatRG ((1.0 - depth));
vec2 tmpvar_12;
tmpvar_12 = tmpvar_11;
res.zw = tmpvar_12.xxxy.zw;
return res;
}
void main ()
{
v2f xlt_i;
vec4 xl_retval;
vec4 tmpvar_1;
tmpvar_1 = vec4(0.0, 0.0, 0.0, 0.0);
xlt_i.pos = tmpvar_1;
vec2 tmpvar_2;
tmpvar_2 = gl_TexCoord[0].xy;
vec2 tmpvar_3;
tmpvar_3 = tmpvar_2;
xlt_i.uv = tmpvar_3;
vec3 tmpvar_4;
tmpvar_4 = gl_TexCoord[1].xyz;
vec3 tmpvar_5;
tmpvar_5 = tmpvar_4;
xlt_i.ray = tmpvar_5;
vec4 tmpvar_6;
tmpvar_6 = frag (xlt_i);
vec4 tmpvar_7;
tmpvar_7 = tmpvar_6;
xl_retval = tmpvar_7;
vec4 tmpvar_8;
tmpvar_8 = xl_retval.xyzw;
vec4 tmpvar_9;
tmpvar_9 = tmpvar_8;
gl_FragData[0] = tmpvar_9;
}