bgfx/3rdparty/glsl-optimizer/tests/fragment/z-fxaa-preset3-ir.txt
2012-10-07 20:41:18 -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 * 1.96321) + 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;
bool tmpvar_70;
tmpvar_70 = bool(0);
doneN_32 = tmpvar_70;
bool tmpvar_71;
tmpvar_71 = bool(0);
doneP_31 = tmpvar_71;
int tmpvar_72;
tmpvar_72 = 0;
i_30 = tmpvar_72;
vec4 tmpvar_73;
tmpvar_73 = FxaaTexOff (tex_22, pos_21.xy, vec2(0.0, -1.0), rcpFrame_23);
vec3 tmpvar_74;
tmpvar_74 = tmpvar_73.xyz;
rgbN_69 = tmpvar_74;
vec4 tmpvar_75;
tmpvar_75 = FxaaTexOff (tex_22, pos_21.xy, vec2(-1.0, 0.0), rcpFrame_23);
vec3 tmpvar_76;
tmpvar_76 = tmpvar_75.xyz;
rgbW_68 = tmpvar_76;
vec4 tmpvar_77;
tmpvar_77 = FxaaTexOff (tex_22, pos_21.xy, vec2(0.0, 0.0), rcpFrame_23);
vec3 tmpvar_78;
tmpvar_78 = tmpvar_77.xyz;
rgbM_67 = tmpvar_78;
vec4 tmpvar_79;
tmpvar_79 = FxaaTexOff (tex_22, pos_21.xy, vec2(1.0, 0.0), rcpFrame_23);
vec3 tmpvar_80;
tmpvar_80 = tmpvar_79.xyz;
rgbE_66 = tmpvar_80;
vec4 tmpvar_81;
tmpvar_81 = FxaaTexOff (tex_22, pos_21.xy, vec2(0.0, 1.0), rcpFrame_23);
vec3 tmpvar_82;
tmpvar_82 = tmpvar_81.xyz;
rgbS_65 = tmpvar_82;
float tmpvar_83;
tmpvar_83 = FxaaLuma (rgbN_69);
float tmpvar_84;
tmpvar_84 = tmpvar_83;
lumaN_64 = tmpvar_84;
float tmpvar_85;
tmpvar_85 = FxaaLuma (rgbW_68);
float tmpvar_86;
tmpvar_86 = tmpvar_85;
lumaW_63 = tmpvar_86;
float tmpvar_87;
tmpvar_87 = FxaaLuma (rgbM_67);
float tmpvar_88;
tmpvar_88 = tmpvar_87;
lumaM_62 = tmpvar_88;
float tmpvar_89;
tmpvar_89 = FxaaLuma (rgbE_66);
float tmpvar_90;
tmpvar_90 = tmpvar_89;
lumaE_61 = tmpvar_90;
float tmpvar_91;
tmpvar_91 = FxaaLuma (rgbS_65);
float tmpvar_92;
tmpvar_92 = tmpvar_91;
lumaS_60 = tmpvar_92;
float tmpvar_93;
tmpvar_93 = min (lumaN_64, lumaW_63);
float tmpvar_94;
tmpvar_94 = min (lumaS_60, lumaE_61);
float tmpvar_95;
tmpvar_95 = min (tmpvar_93, tmpvar_94);
float tmpvar_96;
tmpvar_96 = min (lumaM_62, tmpvar_95);
float tmpvar_97;
tmpvar_97 = tmpvar_96;
rangeMin_59 = tmpvar_97;
float tmpvar_98;
tmpvar_98 = max (lumaN_64, lumaW_63);
float tmpvar_99;
tmpvar_99 = max (lumaS_60, lumaE_61);
float tmpvar_100;
tmpvar_100 = max (tmpvar_98, tmpvar_99);
float tmpvar_101;
tmpvar_101 = max (lumaM_62, tmpvar_100);
float tmpvar_102;
tmpvar_102 = tmpvar_101;
rangeMax_58 = tmpvar_102;
float tmpvar_103;
tmpvar_103 = (rangeMax_58 - rangeMin_59);
range_57 = tmpvar_103;
float tmpvar_104;
tmpvar_104 = max (0.0416667, (rangeMax_58 * 0.125));
if ((range_57 < tmpvar_104)) {
vec3 tmpvar_105;
tmpvar_105 = FxaaFilterReturn (rgbM_67);
return tmpvar_105;
};
vec3 tmpvar_106;
tmpvar_106 = ((((rgbN_69 + rgbW_68) + rgbM_67) + rgbE_66) + rgbS_65);
rgbL_56 = tmpvar_106;
float tmpvar_107;
tmpvar_107 = ((((lumaN_64 + lumaW_63) + lumaE_61) + lumaS_60) * 0.25);
lumaL_55 = tmpvar_107;
float tmpvar_108;
tmpvar_108 = abs ((lumaL_55 - lumaM_62));
float tmpvar_109;
tmpvar_109 = tmpvar_108;
rangeL_54 = tmpvar_109;
float tmpvar_110;
tmpvar_110 = max (0.0, ((rangeL_54 / range_57) - 0.25));
float tmpvar_111;
tmpvar_111 = (tmpvar_110 * 1.33333);
blendL_53 = tmpvar_111;
float tmpvar_112;
tmpvar_112 = min (0.75, blendL_53);
float tmpvar_113;
tmpvar_113 = tmpvar_112;
blendL_53 = tmpvar_113;
vec4 tmpvar_114;
tmpvar_114 = FxaaTexOff (tex_22, pos_21.xy, vec2(-1.0, -1.0), rcpFrame_23);
vec3 tmpvar_115;
tmpvar_115 = tmpvar_114.xyz;
rgbNW_52 = tmpvar_115;
vec4 tmpvar_116;
tmpvar_116 = FxaaTexOff (tex_22, pos_21.xy, vec2(1.0, -1.0), rcpFrame_23);
vec3 tmpvar_117;
tmpvar_117 = tmpvar_116.xyz;
rgbNE_51 = tmpvar_117;
vec4 tmpvar_118;
tmpvar_118 = FxaaTexOff (tex_22, pos_21.xy, vec2(-1.0, 1.0), rcpFrame_23);
vec3 tmpvar_119;
tmpvar_119 = tmpvar_118.xyz;
rgbSW_50 = tmpvar_119;
vec4 tmpvar_120;
tmpvar_120 = FxaaTexOff (tex_22, pos_21.xy, vec2(1.0, 1.0), rcpFrame_23);
vec3 tmpvar_121;
tmpvar_121 = tmpvar_120.xyz;
rgbSE_49 = tmpvar_121;
vec3 tmpvar_122;
tmpvar_122 = (rgbL_56 + (((rgbNW_52 + rgbNE_51) + rgbSW_50) + rgbSE_49));
rgbL_56 = tmpvar_122;
vec3 tmpvar_123;
tmpvar_123 = (rgbL_56 * vec3(0.111111, 0.111111, 0.111111));
rgbL_56 = tmpvar_123;
float tmpvar_124;
tmpvar_124 = FxaaLuma (rgbNW_52);
float tmpvar_125;
tmpvar_125 = tmpvar_124;
lumaNW_48 = tmpvar_125;
float tmpvar_126;
tmpvar_126 = FxaaLuma (rgbNE_51);
float tmpvar_127;
tmpvar_127 = tmpvar_126;
lumaNE_47 = tmpvar_127;
float tmpvar_128;
tmpvar_128 = FxaaLuma (rgbSW_50);
float tmpvar_129;
tmpvar_129 = tmpvar_128;
lumaSW_46 = tmpvar_129;
float tmpvar_130;
tmpvar_130 = FxaaLuma (rgbSE_49);
float tmpvar_131;
tmpvar_131 = tmpvar_130;
lumaSE_45 = tmpvar_131;
float tmpvar_132;
tmpvar_132 = abs ((((0.25 * lumaNW_48) + (-(0.5) * lumaN_64)) + (0.25 * lumaNE_47)));
float tmpvar_133;
tmpvar_133 = abs ((((0.5 * lumaW_63) + (-(1.0) * lumaM_62)) + (0.5 * lumaE_61)));
float tmpvar_134;
tmpvar_134 = abs ((((0.25 * lumaSW_46) + (-(0.5) * lumaS_60)) + (0.25 * lumaSE_45)));
float tmpvar_135;
tmpvar_135 = ((tmpvar_132 + tmpvar_133) + tmpvar_134);
edgeVert_44 = tmpvar_135;
float tmpvar_136;
tmpvar_136 = abs ((((0.25 * lumaNW_48) + (-(0.5) * lumaW_63)) + (0.25 * lumaSW_46)));
float tmpvar_137;
tmpvar_137 = abs ((((0.5 * lumaN_64) + (-(1.0) * lumaM_62)) + (0.5 * lumaS_60)));
float tmpvar_138;
tmpvar_138 = abs ((((0.25 * lumaNE_47) + (-(0.5) * lumaE_61)) + (0.25 * lumaSE_45)));
float tmpvar_139;
tmpvar_139 = ((tmpvar_136 + tmpvar_137) + tmpvar_138);
edgeHorz_43 = tmpvar_139;
bool tmpvar_140;
tmpvar_140 = (edgeHorz_43 >= edgeVert_44);
horzSpan_42 = tmpvar_140;
float tmpvar_141;
if (horzSpan_42) {
tmpvar_141 = -(rcpFrame_23.y);
} else {
tmpvar_141 = -(rcpFrame_23.x);
};
float tmpvar_142;
tmpvar_142 = tmpvar_141;
lengthSign_41 = tmpvar_142;
if (!(horzSpan_42)) {
float tmpvar_143;
tmpvar_143 = lumaW_63;
lumaN_64 = tmpvar_143;
};
if (!(horzSpan_42)) {
float tmpvar_144;
tmpvar_144 = lumaE_61;
lumaS_60 = tmpvar_144;
};
float tmpvar_145;
tmpvar_145 = abs ((lumaN_64 - lumaM_62));
float tmpvar_146;
tmpvar_146 = tmpvar_145;
gradientN_40 = tmpvar_146;
float tmpvar_147;
tmpvar_147 = abs ((lumaS_60 - lumaM_62));
float tmpvar_148;
tmpvar_148 = tmpvar_147;
gradientS_39 = tmpvar_148;
float tmpvar_149;
tmpvar_149 = ((lumaN_64 + lumaM_62) * 0.5);
lumaN_64 = tmpvar_149;
float tmpvar_150;
tmpvar_150 = ((lumaS_60 + lumaM_62) * 0.5);
lumaS_60 = tmpvar_150;
bool tmpvar_151;
tmpvar_151 = (gradientN_40 >= gradientS_39);
pairN_38 = tmpvar_151;
if (!(pairN_38)) {
float tmpvar_152;
tmpvar_152 = lumaS_60;
lumaN_64 = tmpvar_152;
};
if (!(pairN_38)) {
float tmpvar_153;
tmpvar_153 = gradientS_39;
gradientN_40 = tmpvar_153;
};
if (!(pairN_38)) {
float tmpvar_154;
tmpvar_154 = (lengthSign_41 * -(1.0));
lengthSign_41 = tmpvar_154;
};
float tmpvar_155;
if (horzSpan_42) {
tmpvar_155 = 0.0;
} else {
tmpvar_155 = (lengthSign_41 * 0.5);
};
float tmpvar_156;
tmpvar_156 = (pos_21.x + tmpvar_155);
posN_37.x = tmpvar_156;
float tmpvar_157;
if (horzSpan_42) {
tmpvar_157 = (lengthSign_41 * 0.5);
} else {
tmpvar_157 = 0.0;
};
float tmpvar_158;
tmpvar_158 = (pos_21.y + tmpvar_157);
posN_37.y = vec2(tmpvar_158).y;
float tmpvar_159;
tmpvar_159 = (gradientN_40 * 0.25);
gradientN_40 = tmpvar_159;
vec2 tmpvar_160;
tmpvar_160 = posN_37;
posP_36 = tmpvar_160;
vec2 tmpvar_161;
if (horzSpan_42) {
vec2 tmpvar_162;
tmpvar_162.y = 0.0;
tmpvar_162.x = rcpFrame_23.x;
tmpvar_161 = tmpvar_162;
} else {
vec2 tmpvar_163;
tmpvar_163.x = 0.0;
tmpvar_163.y = rcpFrame_23.y;
tmpvar_161 = tmpvar_163;
};
vec2 tmpvar_164;
tmpvar_164 = tmpvar_161;
offNP_35 = tmpvar_164;
float tmpvar_165;
tmpvar_165 = lumaN_64;
lumaEndN_34 = tmpvar_165;
float tmpvar_166;
tmpvar_166 = lumaN_64;
lumaEndP_33 = tmpvar_166;
vec2 tmpvar_167;
tmpvar_167 = (posN_37 + (offNP_35 * vec2(-1.0, -1.0)));
posN_37 = tmpvar_167;
vec2 tmpvar_168;
tmpvar_168 = (posP_36 + (offNP_35 * vec2(1.0, 1.0)));
posP_36 = 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;
}