bgfx/3rdparty/glsl-optimizer/tests/fragment/z-fxaa-preset3-ir.txt
2013-03-17 11:29:03 -07:00

577 lines
14 KiB
Text

#extension GL_ARB_shader_texture_lod : enable
varying vec2 xlv_TEXCOORD0;
uniform vec4 _MainTex_TexelSize;
uniform sampler2D _MainTex;
vec4 xll_tex2Dlod (
in sampler2D s_1,
in vec4 coord_2
)
{
vec4 tmpvar_3;
tmpvar_3 = texture2DLod (s_1, coord_2.xy, coord_2.w);
return tmpvar_3;
}
vec4 FxaaTexOff (
in sampler2D tex_4,
in vec2 pos_5,
in vec2 off_6,
in vec2 rcpFrame_7
)
{
vec4 tmpvar_8;
tmpvar_8.zw = vec2(0.0, 0.0);
tmpvar_8.xy = (pos_5.xy + (off_6 * rcpFrame_7)).xy;
vec4 tmpvar_9;
tmpvar_9 = xll_tex2Dlod (tex_4, tmpvar_8);
return tmpvar_9;
}
vec4 FxaaTexLod0 (
in sampler2D tex_10,
in vec2 pos_11
)
{
vec4 tmpvar_12;
tmpvar_12.zw = vec2(0.0, 0.0);
tmpvar_12.xy = pos_11.xy.xy;
vec4 tmpvar_13;
tmpvar_13 = xll_tex2Dlod (tex_10, tmpvar_12);
return tmpvar_13;
}
float FxaaLuma (
in vec3 rgb_14
)
{
return ((rgb_14.y * (0.587 / 0.299)) + rgb_14.x);
}
vec3 FxaaLerp3 (
in vec3 a_15,
in vec3 b_16,
in float amountOfA_17
)
{
vec3 tmpvar_18;
tmpvar_18.x = -(amountOfA_17);
tmpvar_18.y = -(amountOfA_17);
tmpvar_18.z = -(amountOfA_17);
vec3 tmpvar_19;
tmpvar_19.x = amountOfA_17;
tmpvar_19.y = amountOfA_17;
tmpvar_19.z = amountOfA_17;
return ((tmpvar_18 * b_16) + ((a_15 * tmpvar_19) + b_16));
}
vec3 FxaaFilterReturn (
in vec3 rgb_20
)
{
return rgb_20;
}
vec3 FxaaPixelShader (
in vec2 pos_21,
in sampler2D tex_22,
in vec2 rcpFrame_23
)
{
vec3 rgbF_24;
float subPixelOffset_25;
float spanLength_26;
bool directionN_27;
float dstP_28;
float dstN_29;
int i_30;
bool doneP_31;
bool doneN_32;
float lumaEndP_33;
float lumaEndN_34;
vec2 offNP_35;
vec2 posP_36;
vec2 posN_37;
bool pairN_38;
float gradientS_39;
float gradientN_40;
float lengthSign_41;
bool horzSpan_42;
float edgeHorz_43;
float edgeVert_44;
float lumaSE_45;
float lumaSW_46;
float lumaNE_47;
float lumaNW_48;
vec3 rgbSE_49;
vec3 rgbSW_50;
vec3 rgbNE_51;
vec3 rgbNW_52;
float blendL_53;
float rangeL_54;
float lumaL_55;
vec3 rgbL_56;
float range_57;
float rangeMax_58;
float rangeMin_59;
float lumaS_60;
float lumaE_61;
float lumaM_62;
float lumaW_63;
float lumaN_64;
vec3 rgbS_65;
vec3 rgbE_66;
vec3 rgbM_67;
vec3 rgbW_68;
vec3 rgbN_69;
vec4 tmpvar_70;
tmpvar_70 = FxaaTexOff (tex_22, pos_21.xy, vec2(0.0, -1.0), rcpFrame_23);
vec3 tmpvar_71;
tmpvar_71 = tmpvar_70.xyz;
rgbN_69 = tmpvar_71;
vec4 tmpvar_72;
tmpvar_72 = FxaaTexOff (tex_22, pos_21.xy, vec2(-1.0, 0.0), rcpFrame_23);
vec3 tmpvar_73;
tmpvar_73 = tmpvar_72.xyz;
rgbW_68 = tmpvar_73;
vec4 tmpvar_74;
tmpvar_74 = FxaaTexOff (tex_22, pos_21.xy, vec2(0.0, 0.0), rcpFrame_23);
vec3 tmpvar_75;
tmpvar_75 = tmpvar_74.xyz;
rgbM_67 = tmpvar_75;
vec4 tmpvar_76;
tmpvar_76 = FxaaTexOff (tex_22, pos_21.xy, vec2(1.0, 0.0), rcpFrame_23);
vec3 tmpvar_77;
tmpvar_77 = tmpvar_76.xyz;
rgbE_66 = tmpvar_77;
vec4 tmpvar_78;
tmpvar_78 = FxaaTexOff (tex_22, pos_21.xy, vec2(0.0, 1.0), rcpFrame_23);
vec3 tmpvar_79;
tmpvar_79 = tmpvar_78.xyz;
rgbS_65 = tmpvar_79;
float tmpvar_80;
tmpvar_80 = FxaaLuma (rgbN_69);
float tmpvar_81;
tmpvar_81 = tmpvar_80;
lumaN_64 = tmpvar_81;
float tmpvar_82;
tmpvar_82 = FxaaLuma (rgbW_68);
float tmpvar_83;
tmpvar_83 = tmpvar_82;
lumaW_63 = tmpvar_83;
float tmpvar_84;
tmpvar_84 = FxaaLuma (rgbM_67);
float tmpvar_85;
tmpvar_85 = tmpvar_84;
lumaM_62 = tmpvar_85;
float tmpvar_86;
tmpvar_86 = FxaaLuma (rgbE_66);
float tmpvar_87;
tmpvar_87 = tmpvar_86;
lumaE_61 = tmpvar_87;
float tmpvar_88;
tmpvar_88 = FxaaLuma (rgbS_65);
float tmpvar_89;
tmpvar_89 = tmpvar_88;
lumaS_60 = tmpvar_89;
float tmpvar_90;
tmpvar_90 = min (lumaN_64, lumaW_63);
float tmpvar_91;
tmpvar_91 = min (lumaS_60, lumaE_61);
float tmpvar_92;
tmpvar_92 = min (tmpvar_90, tmpvar_91);
float tmpvar_93;
tmpvar_93 = min (lumaM_62, tmpvar_92);
float tmpvar_94;
tmpvar_94 = tmpvar_93;
rangeMin_59 = tmpvar_94;
float tmpvar_95;
tmpvar_95 = max (lumaN_64, lumaW_63);
float tmpvar_96;
tmpvar_96 = max (lumaS_60, lumaE_61);
float tmpvar_97;
tmpvar_97 = max (tmpvar_95, tmpvar_96);
float tmpvar_98;
tmpvar_98 = max (lumaM_62, tmpvar_97);
float tmpvar_99;
tmpvar_99 = tmpvar_98;
rangeMax_58 = tmpvar_99;
float tmpvar_100;
tmpvar_100 = (rangeMax_58 - rangeMin_59);
range_57 = tmpvar_100;
float tmpvar_101;
tmpvar_101 = max (0.0416667, (rangeMax_58 * (1.0 / 8.0)));
if ((range_57 < tmpvar_101)) {
vec3 tmpvar_102;
tmpvar_102 = FxaaFilterReturn (rgbM_67);
return tmpvar_102;
};
vec3 tmpvar_103;
tmpvar_103 = ((((rgbN_69 + rgbW_68) + rgbM_67) + rgbE_66) + rgbS_65);
rgbL_56 = tmpvar_103;
float tmpvar_104;
tmpvar_104 = ((((lumaN_64 + lumaW_63) + lumaE_61) + lumaS_60) * 0.25);
lumaL_55 = tmpvar_104;
float tmpvar_105;
tmpvar_105 = abs ((lumaL_55 - lumaM_62));
float tmpvar_106;
tmpvar_106 = tmpvar_105;
rangeL_54 = tmpvar_106;
float tmpvar_107;
tmpvar_107 = max (0.0, ((rangeL_54 / range_57) - (1.0 / 4.0)));
float tmpvar_108;
tmpvar_108 = (tmpvar_107 * (1.0 / (1.0 - (1.0 / 4.0))));
blendL_53 = tmpvar_108;
float tmpvar_109;
tmpvar_109 = min (0.75, blendL_53);
float tmpvar_110;
tmpvar_110 = tmpvar_109;
blendL_53 = tmpvar_110;
vec4 tmpvar_111;
tmpvar_111 = FxaaTexOff (tex_22, pos_21.xy, vec2(-1.0, -1.0), rcpFrame_23);
vec3 tmpvar_112;
tmpvar_112 = tmpvar_111.xyz;
rgbNW_52 = tmpvar_112;
vec4 tmpvar_113;
tmpvar_113 = FxaaTexOff (tex_22, pos_21.xy, vec2(1.0, -1.0), rcpFrame_23);
vec3 tmpvar_114;
tmpvar_114 = tmpvar_113.xyz;
rgbNE_51 = tmpvar_114;
vec4 tmpvar_115;
tmpvar_115 = FxaaTexOff (tex_22, pos_21.xy, vec2(-1.0, 1.0), rcpFrame_23);
vec3 tmpvar_116;
tmpvar_116 = tmpvar_115.xyz;
rgbSW_50 = tmpvar_116;
vec4 tmpvar_117;
tmpvar_117 = FxaaTexOff (tex_22, pos_21.xy, vec2(1.0, 1.0), rcpFrame_23);
vec3 tmpvar_118;
tmpvar_118 = tmpvar_117.xyz;
rgbSE_49 = tmpvar_118;
vec3 tmpvar_119;
tmpvar_119 = (rgbL_56 + (((rgbNW_52 + rgbNE_51) + rgbSW_50) + rgbSE_49));
rgbL_56 = tmpvar_119;
vec3 tmpvar_120;
tmpvar_120 = (rgbL_56 * vec3(0.111111, 0.111111, 0.111111));
rgbL_56 = tmpvar_120;
float tmpvar_121;
tmpvar_121 = FxaaLuma (rgbNW_52);
float tmpvar_122;
tmpvar_122 = tmpvar_121;
lumaNW_48 = tmpvar_122;
float tmpvar_123;
tmpvar_123 = FxaaLuma (rgbNE_51);
float tmpvar_124;
tmpvar_124 = tmpvar_123;
lumaNE_47 = tmpvar_124;
float tmpvar_125;
tmpvar_125 = FxaaLuma (rgbSW_50);
float tmpvar_126;
tmpvar_126 = tmpvar_125;
lumaSW_46 = tmpvar_126;
float tmpvar_127;
tmpvar_127 = FxaaLuma (rgbSE_49);
float tmpvar_128;
tmpvar_128 = tmpvar_127;
lumaSE_45 = tmpvar_128;
float tmpvar_129;
tmpvar_129 = abs ((((0.25 * lumaNW_48) + (-(0.5) * lumaN_64)) + (0.25 * lumaNE_47)));
float tmpvar_130;
tmpvar_130 = abs ((((0.5 * lumaW_63) + (-(1.0) * lumaM_62)) + (0.5 * lumaE_61)));
float tmpvar_131;
tmpvar_131 = abs ((((0.25 * lumaSW_46) + (-(0.5) * lumaS_60)) + (0.25 * lumaSE_45)));
float tmpvar_132;
tmpvar_132 = ((tmpvar_129 + tmpvar_130) + tmpvar_131);
edgeVert_44 = tmpvar_132;
float tmpvar_133;
tmpvar_133 = abs ((((0.25 * lumaNW_48) + (-(0.5) * lumaW_63)) + (0.25 * lumaSW_46)));
float tmpvar_134;
tmpvar_134 = abs ((((0.5 * lumaN_64) + (-(1.0) * lumaM_62)) + (0.5 * lumaS_60)));
float tmpvar_135;
tmpvar_135 = abs ((((0.25 * lumaNE_47) + (-(0.5) * lumaE_61)) + (0.25 * lumaSE_45)));
float tmpvar_136;
tmpvar_136 = ((tmpvar_133 + tmpvar_134) + tmpvar_135);
edgeHorz_43 = tmpvar_136;
bool tmpvar_137;
tmpvar_137 = (edgeHorz_43 >= edgeVert_44);
horzSpan_42 = tmpvar_137;
float tmpvar_138;
if (horzSpan_42) {
tmpvar_138 = -(rcpFrame_23.y);
} else {
tmpvar_138 = -(rcpFrame_23.x);
};
float tmpvar_139;
tmpvar_139 = tmpvar_138;
lengthSign_41 = tmpvar_139;
if (!(horzSpan_42)) {
float tmpvar_140;
tmpvar_140 = lumaW_63;
lumaN_64 = tmpvar_140;
};
if (!(horzSpan_42)) {
float tmpvar_141;
tmpvar_141 = lumaE_61;
lumaS_60 = tmpvar_141;
};
float tmpvar_142;
tmpvar_142 = abs ((lumaN_64 - lumaM_62));
float tmpvar_143;
tmpvar_143 = tmpvar_142;
gradientN_40 = tmpvar_143;
float tmpvar_144;
tmpvar_144 = abs ((lumaS_60 - lumaM_62));
float tmpvar_145;
tmpvar_145 = tmpvar_144;
gradientS_39 = tmpvar_145;
float tmpvar_146;
tmpvar_146 = ((lumaN_64 + lumaM_62) * 0.5);
lumaN_64 = tmpvar_146;
float tmpvar_147;
tmpvar_147 = ((lumaS_60 + lumaM_62) * 0.5);
lumaS_60 = tmpvar_147;
bool tmpvar_148;
tmpvar_148 = (gradientN_40 >= gradientS_39);
pairN_38 = tmpvar_148;
if (!(pairN_38)) {
float tmpvar_149;
tmpvar_149 = lumaS_60;
lumaN_64 = tmpvar_149;
};
if (!(pairN_38)) {
float tmpvar_150;
tmpvar_150 = gradientS_39;
gradientN_40 = tmpvar_150;
};
if (!(pairN_38)) {
float tmpvar_151;
tmpvar_151 = (lengthSign_41 * -(1.0));
lengthSign_41 = tmpvar_151;
};
float tmpvar_152;
if (horzSpan_42) {
tmpvar_152 = 0.0;
} else {
tmpvar_152 = (lengthSign_41 * 0.5);
};
float tmpvar_153;
tmpvar_153 = (pos_21.x + tmpvar_152);
posN_37.x = tmpvar_153;
float tmpvar_154;
if (horzSpan_42) {
tmpvar_154 = (lengthSign_41 * 0.5);
} else {
tmpvar_154 = 0.0;
};
float tmpvar_155;
tmpvar_155 = (pos_21.y + tmpvar_154);
posN_37.y = vec2(tmpvar_155).y;
float tmpvar_156;
tmpvar_156 = (gradientN_40 * (1.0 / 4.0));
gradientN_40 = tmpvar_156;
vec2 tmpvar_157;
tmpvar_157 = posN_37;
posP_36 = tmpvar_157;
vec2 tmpvar_158;
if (horzSpan_42) {
vec2 tmpvar_159;
tmpvar_159.y = 0.0;
tmpvar_159.x = rcpFrame_23.x;
tmpvar_158 = tmpvar_159;
} else {
vec2 tmpvar_160;
tmpvar_160.x = 0.0;
tmpvar_160.y = rcpFrame_23.y;
tmpvar_158 = tmpvar_160;
};
vec2 tmpvar_161;
tmpvar_161 = tmpvar_158;
offNP_35 = tmpvar_161;
float tmpvar_162;
tmpvar_162 = lumaN_64;
lumaEndN_34 = tmpvar_162;
float tmpvar_163;
tmpvar_163 = lumaN_64;
lumaEndP_33 = tmpvar_163;
bool tmpvar_164;
tmpvar_164 = bool(0);
doneN_32 = tmpvar_164;
bool tmpvar_165;
tmpvar_165 = bool(0);
doneP_31 = tmpvar_165;
vec2 tmpvar_166;
tmpvar_166 = (posN_37 + (offNP_35 * vec2(-1.0, -1.0)));
posN_37 = tmpvar_166;
vec2 tmpvar_167;
tmpvar_167 = (posP_36 + (offNP_35 * vec2(1.0, 1.0)));
posP_36 = tmpvar_167;
int tmpvar_168;
tmpvar_168 = 0;
i_30 = tmpvar_168;
while (true) {
if (!((i_30 < 16))) {
break;
};
if (!(doneN_32)) {
vec4 tmpvar_169;
tmpvar_169 = FxaaTexLod0 (tex_22, posN_37.xy);
float tmpvar_170;
tmpvar_170 = FxaaLuma (tmpvar_169.xyz);
float tmpvar_171;
tmpvar_171 = tmpvar_170;
lumaEndN_34 = tmpvar_171;
};
if (!(doneP_31)) {
vec4 tmpvar_172;
tmpvar_172 = FxaaTexLod0 (tex_22, posP_36.xy);
float tmpvar_173;
tmpvar_173 = FxaaLuma (tmpvar_172.xyz);
float tmpvar_174;
tmpvar_174 = tmpvar_173;
lumaEndP_33 = tmpvar_174;
};
bool tmpvar_175;
if (doneN_32) {
tmpvar_175 = bool(1);
} else {
float tmpvar_176;
tmpvar_176 = abs ((lumaEndN_34 - lumaN_64));
tmpvar_175 = (tmpvar_176 >= gradientN_40);
};
bool tmpvar_177;
tmpvar_177 = tmpvar_175;
doneN_32 = tmpvar_177;
bool tmpvar_178;
if (doneP_31) {
tmpvar_178 = bool(1);
} else {
float tmpvar_179;
tmpvar_179 = abs ((lumaEndP_33 - lumaN_64));
tmpvar_178 = (tmpvar_179 >= gradientN_40);
};
bool tmpvar_180;
tmpvar_180 = tmpvar_178;
doneP_31 = tmpvar_180;
if ((doneN_32 && doneP_31)) {
break;
};
if (!(doneN_32)) {
vec2 tmpvar_181;
tmpvar_181 = (posN_37 - offNP_35);
posN_37 = tmpvar_181;
};
if (!(doneP_31)) {
vec2 tmpvar_182;
tmpvar_182 = (posP_36 + offNP_35);
posP_36 = tmpvar_182;
};
int _post_incdec_tmp_183;
_post_incdec_tmp_183 = i_30;
int tmpvar_184;
tmpvar_184 = (i_30 + 1);
i_30 = tmpvar_184;
};
float tmpvar_185;
if (horzSpan_42) {
tmpvar_185 = (pos_21.x - posN_37.x);
} else {
tmpvar_185 = (pos_21.y - posN_37.y);
};
float tmpvar_186;
tmpvar_186 = tmpvar_185;
dstN_29 = tmpvar_186;
float tmpvar_187;
if (horzSpan_42) {
tmpvar_187 = (posP_36.x - pos_21.x);
} else {
tmpvar_187 = (posP_36.y - pos_21.y);
};
float tmpvar_188;
tmpvar_188 = tmpvar_187;
dstP_28 = tmpvar_188;
bool tmpvar_189;
tmpvar_189 = (dstN_29 < dstP_28);
directionN_27 = tmpvar_189;
float tmpvar_190;
if (directionN_27) {
tmpvar_190 = lumaEndN_34;
} else {
tmpvar_190 = lumaEndP_33;
};
float tmpvar_191;
tmpvar_191 = tmpvar_190;
lumaEndN_34 = tmpvar_191;
if ((((lumaM_62 - lumaN_64) < 0.0) == ((lumaEndN_34 - lumaN_64) < 0.0))) {
float tmpvar_192;
tmpvar_192 = 0.0;
lengthSign_41 = tmpvar_192;
};
float tmpvar_193;
tmpvar_193 = (dstP_28 + dstN_29);
spanLength_26 = tmpvar_193;
float tmpvar_194;
if (directionN_27) {
tmpvar_194 = dstN_29;
} else {
tmpvar_194 = dstP_28;
};
float tmpvar_195;
tmpvar_195 = tmpvar_194;
dstN_29 = tmpvar_195;
float tmpvar_196;
tmpvar_196 = ((0.5 + (dstN_29 * (-(1.0) / spanLength_26))) * lengthSign_41);
subPixelOffset_25 = tmpvar_196;
float tmpvar_197;
if (horzSpan_42) {
tmpvar_197 = 0.0;
} else {
tmpvar_197 = subPixelOffset_25;
};
float tmpvar_198;
if (horzSpan_42) {
tmpvar_198 = subPixelOffset_25;
} else {
tmpvar_198 = 0.0;
};
vec2 tmpvar_199;
tmpvar_199.x = (pos_21.x + tmpvar_197);
tmpvar_199.y = (pos_21.y + tmpvar_198);
vec4 tmpvar_200;
tmpvar_200 = FxaaTexLod0 (tex_22, tmpvar_199);
vec3 tmpvar_201;
tmpvar_201 = tmpvar_200.xyz;
rgbF_24 = tmpvar_201;
vec3 tmpvar_202;
tmpvar_202 = FxaaLerp3 (rgbL_56, rgbF_24, blendL_53);
vec3 tmpvar_203;
tmpvar_203 = FxaaFilterReturn (tmpvar_202);
return tmpvar_203;
}
vec4 xlat_main (
in vec2 uv_204
)
{
vec3 tmpvar_205;
tmpvar_205 = FxaaPixelShader (uv_204.xy, _MainTex, _MainTex_TexelSize.xy);
vec4 tmpvar_206;
tmpvar_206.w = 0.0;
tmpvar_206.xyz = tmpvar_205.xyz.xyz;
return tmpvar_206;
}
void main ()
{
vec4 xl_retval_207;
vec2 tmpvar_208;
tmpvar_208 = xlv_TEXCOORD0.xy;
vec4 tmpvar_209;
tmpvar_209 = xlat_main (tmpvar_208);
vec4 tmpvar_210;
tmpvar_210 = tmpvar_209;
xl_retval_207 = tmpvar_210;
vec4 tmpvar_211;
tmpvar_211 = xl_retval_207.xyzw;
vec4 tmpvar_212;
tmpvar_212 = tmpvar_211;
gl_FragData[0] = tmpvar_212;
}