bgfx/3rdparty/glsl-optimizer/tests/fragment/zun-SSAO24-outES3.txt
2015-04-02 23:30:48 -07:00

82 lines
2.8 KiB
Plaintext

#version 300 es
layout(location=0) out mediump vec4 _glesFragData[4];
uniform highp vec4 _ProjectionParams;
uniform highp sampler2D _CameraDepthNormalsTexture;
uniform sampler2D _RandomTexture;
uniform highp vec4 _Params;
in highp vec2 xlv_TEXCOORD0;
in highp vec2 xlv_TEXCOORD1;
void main ()
{
mediump float tmpvar_1;
highp vec2 tmpvar_2;
tmpvar_2 = xlv_TEXCOORD0;
highp float occ_4;
highp float scale_5;
highp float depth_6;
highp vec3 viewNorm_7;
mediump vec3 randN_8;
lowp vec3 tmpvar_9;
tmpvar_9 = ((texture (_RandomTexture, xlv_TEXCOORD1).xyz * 2.0) - 1.0);
randN_8 = tmpvar_9;
highp vec4 tmpvar_10;
tmpvar_10 = texture (_CameraDepthNormalsTexture, xlv_TEXCOORD0);
highp vec3 n_11;
highp vec3 tmpvar_12;
tmpvar_12 = ((tmpvar_10.xyz * vec3(3.5554, 3.5554, 0.0)) + vec3(-1.7777, -1.7777, 1.0));
highp float tmpvar_13;
tmpvar_13 = (2.0 / dot (tmpvar_12, tmpvar_12));
n_11.xy = (tmpvar_13 * tmpvar_12.xy);
n_11.z = (tmpvar_13 - 1.0);
viewNorm_7 = n_11;
depth_6 = (dot (tmpvar_10.zw, vec2(1.0, 0.00392157)) * _ProjectionParams.z);
scale_5 = (_Params.x / depth_6);
occ_4 = 0.0;
for (highp int s_3 = 0; s_3 < 8; s_3++) {
mediump vec3 randomDir_14;
highp vec3 tmpvar_15;
highp vec3 I_16;
I_16 = vec3[8](vec3(0.0130572, 0.587232, -0.119337), vec3(0.323078, 0.0220727, -0.418873), vec3(-0.310725, -0.191367, 0.0561369), vec3(-0.479646, 0.0939877, -0.580265), vec3(0.139999, -0.33577, 0.559679), vec3(-0.248458, 0.255532, 0.348944), vec3(0.18719, -0.702764, -0.231748), vec3(0.884915, 0.284208, 0.368524))[s_3];
tmpvar_15 = (I_16 - (2.0 * (
dot (randN_8, I_16)
* randN_8)));
randomDir_14 = tmpvar_15;
highp float tmpvar_17;
tmpvar_17 = dot (viewNorm_7, randomDir_14);
mediump float tmpvar_18;
if ((tmpvar_17 < 0.0)) {
tmpvar_18 = 1.0;
} else {
tmpvar_18 = -1.0;
};
randomDir_14 = (randomDir_14 * -(tmpvar_18));
randomDir_14 = (randomDir_14 + (viewNorm_7 * 0.3));
highp vec4 tmpvar_19;
tmpvar_19 = texture (_CameraDepthNormalsTexture, (tmpvar_2 + (randomDir_14.xy * scale_5)));
highp float tmpvar_20;
tmpvar_20 = clamp (((depth_6 -
(randomDir_14.z * _Params.x)
) - (
dot (tmpvar_19.zw, vec2(1.0, 0.00392157))
* _ProjectionParams.z)), 0.0, 1.0);
if ((tmpvar_20 > _Params.y)) {
occ_4 = (occ_4 + pow ((1.0 - tmpvar_20), _Params.z));
};
};
occ_4 = (occ_4 / 8.0);
tmpvar_1 = (1.0 - occ_4);
_glesFragData[0] = vec4(tmpvar_1);
}
// stats: 41 alu 3 tex 4 flow
// inputs: 2
// #0: xlv_TEXCOORD0 (high float) 2x1 [-1]
// #1: xlv_TEXCOORD1 (high float) 2x1 [-1]
// uniforms: 2 (total size: 0)
// #0: _ProjectionParams (high float) 4x1 [-1]
// #1: _Params (high float) 4x1 [-1]
// textures: 2
// #0: _CameraDepthNormalsTexture (high 2d) 0x0 [-1]
// #1: _RandomTexture (low 2d) 0x0 [-1]