bgfx/3rdparty/glsl-optimizer/tests/fragment/unity-Hidden_Shadow-ScreenBlur-ir.txt
Branimir Karadzic dee3fe5266 Initial commit.
2012-04-03 20:30:07 -07:00

217 lines
4.1 KiB
Text

struct v2f_img {
vec4 pos;
vec2 uv;
};
uniform vec4 unity_ShadowBlurParams;
uniform sampler2D _MainTex;
uniform vec4 _BlurOffsets[8];
float xll_saturate (
in float x
)
{
float tmpvar_1;
tmpvar_1 = clamp (x, 0.0, 1.0);
return tmpvar_1;
}
vec2 xll_saturate (
in vec2 x
)
{
vec2 tmpvar_1;
tmpvar_1 = clamp (x, 0.0, 1.0);
return tmpvar_1;
}
vec3 xll_saturate (
in vec3 x
)
{
vec3 tmpvar_1;
tmpvar_1 = clamp (x, 0.0, 1.0);
return tmpvar_1;
}
vec4 xll_saturate (
in vec4 x
)
{
vec4 tmpvar_1;
tmpvar_1 = clamp (x, 0.0, 1.0);
return tmpvar_1;
}
mat2 xll_saturate (
in mat2 m
)
{
vec2 tmpvar_1;
tmpvar_1 = clamp (m[0], 0.0, 1.0);
vec2 tmpvar_2;
tmpvar_2 = clamp (m[1], 0.0, 1.0);
mat2 tmpvar_3;
vec2 tmpvar_4;
tmpvar_4 = tmpvar_1;
tmpvar_3[0] = tmpvar_4;
vec2 tmpvar_5;
tmpvar_5 = tmpvar_2;
tmpvar_3[1] = tmpvar_5;
return tmpvar_3;
}
mat3 xll_saturate (
in mat3 m
)
{
vec3 tmpvar_1;
tmpvar_1 = clamp (m[0], 0.0, 1.0);
vec3 tmpvar_2;
tmpvar_2 = clamp (m[1], 0.0, 1.0);
vec3 tmpvar_3;
tmpvar_3 = clamp (m[2], 0.0, 1.0);
mat3 tmpvar_4;
vec3 tmpvar_5;
tmpvar_5 = tmpvar_1;
tmpvar_4[0] = tmpvar_5;
vec3 tmpvar_6;
tmpvar_6 = tmpvar_2;
tmpvar_4[1] = tmpvar_6;
vec3 tmpvar_7;
tmpvar_7 = tmpvar_3;
tmpvar_4[2] = tmpvar_7;
return tmpvar_4;
}
mat4 xll_saturate (
in mat4 m
)
{
vec4 tmpvar_1;
tmpvar_1 = clamp (m[0], 0.0, 1.0);
vec4 tmpvar_2;
tmpvar_2 = clamp (m[1], 0.0, 1.0);
vec4 tmpvar_3;
tmpvar_3 = clamp (m[2], 0.0, 1.0);
vec4 tmpvar_4;
tmpvar_4 = clamp (m[3], 0.0, 1.0);
mat4 tmpvar_5;
vec4 tmpvar_6;
tmpvar_6 = tmpvar_1;
tmpvar_5[0] = tmpvar_6;
vec4 tmpvar_7;
tmpvar_7 = tmpvar_2;
tmpvar_5[1] = tmpvar_7;
vec4 tmpvar_8;
tmpvar_8 = tmpvar_3;
tmpvar_5[2] = tmpvar_8;
vec4 tmpvar_9;
tmpvar_9 = tmpvar_4;
tmpvar_5[3] = tmpvar_9;
return tmpvar_5;
}
vec4 frag (
in v2f_img i
)
{
float shadow;
float diff;
float sampleDist;
vec4 sample;
int i_1;
float diffTolerance;
float radius;
float dist;
vec4 mask;
vec4 coord;
int tmpvar_1;
tmpvar_1 = 0;
i_1 = tmpvar_1;
vec4 tmpvar_2;
tmpvar_2.zw = vec2(0.0, 0.0);
tmpvar_2.xy = i.uv.xy;
vec4 tmpvar_3;
tmpvar_3 = tmpvar_2;
coord = tmpvar_3;
vec4 tmpvar_4;
tmpvar_4 = texture2D (_MainTex, coord.xy);
vec4 tmpvar_5;
tmpvar_5 = tmpvar_4;
mask = tmpvar_5;
float tmpvar_6;
tmpvar_6 = (mask.z + (mask.w / 255.0));
dist = tmpvar_6;
float tmpvar_7;
tmpvar_7 = xll_saturate ((unity_ShadowBlurParams.y / (1.0 - dist)));
float tmpvar_8;
tmpvar_8 = tmpvar_7;
radius = tmpvar_8;
float tmpvar_9;
tmpvar_9 = unity_ShadowBlurParams.x;
diffTolerance = tmpvar_9;
vec2 tmpvar_10;
tmpvar_10 = (mask.xy * diffTolerance);
mask.xy = tmpvar_10.xy.xy;
while (true) {
if (!((i_1 < 8))) {
break;
};
vec4 tmpvar_11;
tmpvar_11 = texture2D (_MainTex, (coord + (radius * _BlurOffsets[i_1])).xy);
vec4 tmpvar_12;
tmpvar_12 = tmpvar_11;
sample = tmpvar_12;
float tmpvar_13;
tmpvar_13 = (sample.z + (sample.w / 255.0));
sampleDist = tmpvar_13;
float tmpvar_14;
tmpvar_14 = (dist - sampleDist);
diff = tmpvar_14;
float tmpvar_15;
tmpvar_15 = abs (diff);
float tmpvar_16;
tmpvar_16 = xll_saturate ((diffTolerance - tmpvar_15));
float tmpvar_17;
tmpvar_17 = tmpvar_16;
diff = tmpvar_17;
vec2 tmpvar_18;
tmpvar_18 = (mask.xy + (diff * sample.xy));
mask.xy = tmpvar_18.xy.xy;
int _post_incdec_tmp;
_post_incdec_tmp = i_1;
int tmpvar_19;
tmpvar_19 = (i_1 + 1);
i_1 = tmpvar_19;
};
float tmpvar_20;
tmpvar_20 = (mask.x / mask.y);
shadow = tmpvar_20;
vec4 tmpvar_21;
tmpvar_21 = vec4(shadow);
return tmpvar_21;
}
void main ()
{
v2f_img 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;
vec4 tmpvar_4;
tmpvar_4 = frag (xlt_i);
vec4 tmpvar_5;
tmpvar_5 = tmpvar_4;
xl_retval = tmpvar_5;
vec4 tmpvar_6;
tmpvar_6 = xl_retval.xyzw;
vec4 tmpvar_7;
tmpvar_7 = tmpvar_6;
gl_FragData[0] = tmpvar_7;
}