bgfx/3rdparty/glsl-optimizer/tests/fragment/z-fxaa-preset1-ir.txt

624 lines
15 KiB
Text
Raw Normal View History

2012-10-07 23:41:18 -04:00
#extension GL_ARB_shader_texture_lod : enable
uniform sampler2D _MainTex;
2014-02-11 02:06:13 -05:00
uniform vec4 _MainTex_TexelSize;
varying vec2 xlv_TEXCOORD0;
2012-10-07 23:41:18 -04:00
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 xll_tex2Dgrad (
in sampler2D s_4,
in vec2 coord_5,
in vec2 ddx_6,
in vec2 ddy_7
)
{
vec4 tmpvar_8;
tmpvar_8 = texture2DGradARB (s_4, coord_5, ddx_6, ddy_7);
return tmpvar_8;
}
vec4 FxaaTexOff (
in sampler2D tex_9,
in vec2 pos_10,
in vec2 off_11,
in vec2 rcpFrame_12
)
{
vec4 tmpvar_13;
tmpvar_13.zw = vec2(0.0, 0.0);
tmpvar_13.xy = (pos_10.xy + (off_11 * rcpFrame_12)).xy;
vec4 tmpvar_14;
tmpvar_14 = xll_tex2Dlod (tex_9, tmpvar_13);
return tmpvar_14;
}
vec4 FxaaTexLod0 (
in sampler2D tex_15,
in vec2 pos_16
)
{
vec4 tmpvar_17;
tmpvar_17.zw = vec2(0.0, 0.0);
tmpvar_17.xy = pos_16.xy.xy;
vec4 tmpvar_18;
tmpvar_18 = xll_tex2Dlod (tex_15, tmpvar_17);
return tmpvar_18;
}
vec4 FxaaTexGrad (
in sampler2D tex_19,
in vec2 pos_20,
in vec2 grad_21
)
{
vec4 tmpvar_22;
tmpvar_22 = xll_tex2Dgrad (tex_19, pos_20.xy, grad_21, grad_21);
return tmpvar_22;
}
float FxaaLuma (
in vec3 rgb_23
)
{
return ((rgb_23.y * 1.96321) + rgb_23.x);
}
vec3 FxaaLerp3 (
in vec3 a_24,
in vec3 b_25,
in float amountOfA_26
)
{
vec3 tmpvar_27;
tmpvar_27.x = -(amountOfA_26);
tmpvar_27.y = -(amountOfA_26);
tmpvar_27.z = -(amountOfA_26);
vec3 tmpvar_28;
tmpvar_28.x = amountOfA_26;
tmpvar_28.y = amountOfA_26;
tmpvar_28.z = amountOfA_26;
return ((tmpvar_27 * b_25) + ((a_24 * tmpvar_28) + b_25));
}
vec3 FxaaFilterReturn (
in vec3 rgb_29
)
{
return rgb_29;
}
vec3 FxaaPixelShader (
in vec2 pos_30,
in sampler2D tex_31,
in vec2 rcpFrame_32
)
{
vec3 rgbF_33;
float subPixelOffset_34;
float spanLength_35;
bool directionN_36;
float dstP_37;
float dstN_38;
int i_39;
bool doneP_40;
bool doneN_41;
float lumaEndP_42;
float lumaEndN_43;
vec2 offNP_44;
vec2 posP_45;
vec2 posN_46;
bool pairN_47;
float gradientS_48;
float gradientN_49;
float lengthSign_50;
bool horzSpan_51;
float edgeHorz_52;
float edgeVert_53;
float lumaSE_54;
float lumaSW_55;
float lumaNE_56;
float lumaNW_57;
vec3 rgbSE_58;
vec3 rgbSW_59;
vec3 rgbNE_60;
vec3 rgbNW_61;
float blendL_62;
float rangeL_63;
float lumaL_64;
vec3 rgbL_65;
float range_66;
float rangeMax_67;
float rangeMin_68;
float lumaS_69;
float lumaE_70;
float lumaM_71;
float lumaW_72;
float lumaN_73;
vec3 rgbS_74;
vec3 rgbE_75;
vec3 rgbM_76;
vec3 rgbW_77;
vec3 rgbN_78;
bool tmpvar_79;
tmpvar_79 = bool(0);
doneN_41 = tmpvar_79;
bool tmpvar_80;
tmpvar_80 = bool(0);
doneP_40 = tmpvar_80;
int tmpvar_81;
tmpvar_81 = 0;
i_39 = tmpvar_81;
vec4 tmpvar_82;
tmpvar_82 = FxaaTexOff (tex_31, pos_30.xy, vec2(0.0, -1.0), rcpFrame_32);
vec3 tmpvar_83;
tmpvar_83 = tmpvar_82.xyz;
rgbN_78 = tmpvar_83;
vec4 tmpvar_84;
tmpvar_84 = FxaaTexOff (tex_31, pos_30.xy, vec2(-1.0, 0.0), rcpFrame_32);
vec3 tmpvar_85;
tmpvar_85 = tmpvar_84.xyz;
rgbW_77 = tmpvar_85;
vec4 tmpvar_86;
tmpvar_86 = FxaaTexOff (tex_31, pos_30.xy, vec2(0.0, 0.0), rcpFrame_32);
vec3 tmpvar_87;
tmpvar_87 = tmpvar_86.xyz;
rgbM_76 = tmpvar_87;
vec4 tmpvar_88;
tmpvar_88 = FxaaTexOff (tex_31, pos_30.xy, vec2(1.0, 0.0), rcpFrame_32);
vec3 tmpvar_89;
tmpvar_89 = tmpvar_88.xyz;
rgbE_75 = tmpvar_89;
vec4 tmpvar_90;
tmpvar_90 = FxaaTexOff (tex_31, pos_30.xy, vec2(0.0, 1.0), rcpFrame_32);
vec3 tmpvar_91;
tmpvar_91 = tmpvar_90.xyz;
rgbS_74 = tmpvar_91;
float tmpvar_92;
tmpvar_92 = FxaaLuma (rgbN_78);
float tmpvar_93;
tmpvar_93 = tmpvar_92;
lumaN_73 = tmpvar_93;
float tmpvar_94;
tmpvar_94 = FxaaLuma (rgbW_77);
float tmpvar_95;
tmpvar_95 = tmpvar_94;
lumaW_72 = tmpvar_95;
float tmpvar_96;
tmpvar_96 = FxaaLuma (rgbM_76);
float tmpvar_97;
tmpvar_97 = tmpvar_96;
lumaM_71 = tmpvar_97;
float tmpvar_98;
tmpvar_98 = FxaaLuma (rgbE_75);
float tmpvar_99;
tmpvar_99 = tmpvar_98;
lumaE_70 = tmpvar_99;
float tmpvar_100;
tmpvar_100 = FxaaLuma (rgbS_74);
float tmpvar_101;
tmpvar_101 = tmpvar_100;
lumaS_69 = tmpvar_101;
float tmpvar_102;
tmpvar_102 = min (lumaN_73, lumaW_72);
float tmpvar_103;
tmpvar_103 = min (lumaS_69, lumaE_70);
float tmpvar_104;
tmpvar_104 = min (tmpvar_102, tmpvar_103);
float tmpvar_105;
tmpvar_105 = min (lumaM_71, tmpvar_104);
float tmpvar_106;
tmpvar_106 = tmpvar_105;
rangeMin_68 = tmpvar_106;
float tmpvar_107;
tmpvar_107 = max (lumaN_73, lumaW_72);
float tmpvar_108;
tmpvar_108 = max (lumaS_69, lumaE_70);
float tmpvar_109;
tmpvar_109 = max (tmpvar_107, tmpvar_108);
float tmpvar_110;
tmpvar_110 = max (lumaM_71, tmpvar_109);
float tmpvar_111;
tmpvar_111 = tmpvar_110;
rangeMax_67 = tmpvar_111;
float tmpvar_112;
tmpvar_112 = (rangeMax_67 - rangeMin_68);
range_66 = tmpvar_112;
float tmpvar_113;
tmpvar_113 = max (0.0625, (rangeMax_67 * 0.125));
if ((range_66 < tmpvar_113)) {
vec3 tmpvar_114;
tmpvar_114 = FxaaFilterReturn (rgbM_76);
return tmpvar_114;
};
vec3 tmpvar_115;
2014-02-11 02:06:13 -05:00
tmpvar_115 = (((
(rgbN_78 + rgbW_77)
+ rgbM_76) + rgbE_75) + rgbS_74);
2012-10-07 23:41:18 -04:00
rgbL_65 = tmpvar_115;
float tmpvar_116;
2014-02-11 02:06:13 -05:00
tmpvar_116 = (((
(lumaN_73 + lumaW_72)
+ lumaE_70) + lumaS_69) * 0.25);
2012-10-07 23:41:18 -04:00
lumaL_64 = tmpvar_116;
float tmpvar_117;
tmpvar_117 = abs ((lumaL_64 - lumaM_71));
float tmpvar_118;
tmpvar_118 = tmpvar_117;
rangeL_63 = tmpvar_118;
float tmpvar_119;
tmpvar_119 = max (0.0, ((rangeL_63 / range_66) - 0.25));
float tmpvar_120;
tmpvar_120 = (tmpvar_119 * 1.33333);
blendL_62 = tmpvar_120;
float tmpvar_121;
tmpvar_121 = min (0.75, blendL_62);
float tmpvar_122;
tmpvar_122 = tmpvar_121;
blendL_62 = tmpvar_122;
vec4 tmpvar_123;
tmpvar_123 = FxaaTexOff (tex_31, pos_30.xy, vec2(-1.0, -1.0), rcpFrame_32);
vec3 tmpvar_124;
tmpvar_124 = tmpvar_123.xyz;
rgbNW_61 = tmpvar_124;
vec4 tmpvar_125;
tmpvar_125 = FxaaTexOff (tex_31, pos_30.xy, vec2(1.0, -1.0), rcpFrame_32);
vec3 tmpvar_126;
tmpvar_126 = tmpvar_125.xyz;
rgbNE_60 = tmpvar_126;
vec4 tmpvar_127;
tmpvar_127 = FxaaTexOff (tex_31, pos_30.xy, vec2(-1.0, 1.0), rcpFrame_32);
vec3 tmpvar_128;
tmpvar_128 = tmpvar_127.xyz;
rgbSW_59 = tmpvar_128;
vec4 tmpvar_129;
tmpvar_129 = FxaaTexOff (tex_31, pos_30.xy, vec2(1.0, 1.0), rcpFrame_32);
vec3 tmpvar_130;
tmpvar_130 = tmpvar_129.xyz;
rgbSE_58 = tmpvar_130;
vec3 tmpvar_131;
2014-02-11 02:06:13 -05:00
tmpvar_131 = (rgbL_65 + ((
(rgbNW_61 + rgbNE_60)
+ rgbSW_59) + rgbSE_58));
2012-10-07 23:41:18 -04:00
rgbL_65 = tmpvar_131;
vec3 tmpvar_132;
tmpvar_132 = (rgbL_65 * vec3(0.111111, 0.111111, 0.111111));
rgbL_65 = tmpvar_132;
float tmpvar_133;
tmpvar_133 = FxaaLuma (rgbNW_61);
float tmpvar_134;
tmpvar_134 = tmpvar_133;
lumaNW_57 = tmpvar_134;
float tmpvar_135;
tmpvar_135 = FxaaLuma (rgbNE_60);
float tmpvar_136;
tmpvar_136 = tmpvar_135;
lumaNE_56 = tmpvar_136;
float tmpvar_137;
tmpvar_137 = FxaaLuma (rgbSW_59);
float tmpvar_138;
tmpvar_138 = tmpvar_137;
lumaSW_55 = tmpvar_138;
float tmpvar_139;
tmpvar_139 = FxaaLuma (rgbSE_58);
float tmpvar_140;
tmpvar_140 = tmpvar_139;
lumaSE_54 = tmpvar_140;
float tmpvar_141;
2014-02-11 02:06:13 -05:00
tmpvar_141 = abs ((((0.25 * lumaNW_57) + (
-(0.5)
* lumaN_73)) + (0.25 * lumaNE_56)));
2012-10-07 23:41:18 -04:00
float tmpvar_142;
2014-02-11 02:06:13 -05:00
tmpvar_142 = abs ((((0.5 * lumaW_72) + (
-(1.0)
* lumaM_71)) + (0.5 * lumaE_70)));
2012-10-07 23:41:18 -04:00
float tmpvar_143;
2014-02-11 02:06:13 -05:00
tmpvar_143 = abs ((((0.25 * lumaSW_55) + (
-(0.5)
* lumaS_69)) + (0.25 * lumaSE_54)));
2012-10-07 23:41:18 -04:00
float tmpvar_144;
tmpvar_144 = ((tmpvar_141 + tmpvar_142) + tmpvar_143);
edgeVert_53 = tmpvar_144;
float tmpvar_145;
2014-02-11 02:06:13 -05:00
tmpvar_145 = abs ((((0.25 * lumaNW_57) + (
-(0.5)
* lumaW_72)) + (0.25 * lumaSW_55)));
2012-10-07 23:41:18 -04:00
float tmpvar_146;
2014-02-11 02:06:13 -05:00
tmpvar_146 = abs ((((0.5 * lumaN_73) + (
-(1.0)
* lumaM_71)) + (0.5 * lumaS_69)));
2012-10-07 23:41:18 -04:00
float tmpvar_147;
2014-02-11 02:06:13 -05:00
tmpvar_147 = abs ((((0.25 * lumaNE_56) + (
-(0.5)
* lumaE_70)) + (0.25 * lumaSE_54)));
2012-10-07 23:41:18 -04:00
float tmpvar_148;
tmpvar_148 = ((tmpvar_145 + tmpvar_146) + tmpvar_147);
edgeHorz_52 = tmpvar_148;
bool tmpvar_149;
tmpvar_149 = (edgeHorz_52 >= edgeVert_53);
horzSpan_51 = tmpvar_149;
float tmpvar_150;
if (horzSpan_51) {
tmpvar_150 = -(rcpFrame_32.y);
} else {
tmpvar_150 = -(rcpFrame_32.x);
};
float tmpvar_151;
tmpvar_151 = tmpvar_150;
lengthSign_50 = tmpvar_151;
if (!(horzSpan_51)) {
float tmpvar_152;
tmpvar_152 = lumaW_72;
lumaN_73 = tmpvar_152;
};
if (!(horzSpan_51)) {
float tmpvar_153;
tmpvar_153 = lumaE_70;
lumaS_69 = tmpvar_153;
};
float tmpvar_154;
tmpvar_154 = abs ((lumaN_73 - lumaM_71));
float tmpvar_155;
tmpvar_155 = tmpvar_154;
gradientN_49 = tmpvar_155;
float tmpvar_156;
tmpvar_156 = abs ((lumaS_69 - lumaM_71));
float tmpvar_157;
tmpvar_157 = tmpvar_156;
gradientS_48 = tmpvar_157;
float tmpvar_158;
tmpvar_158 = ((lumaN_73 + lumaM_71) * 0.5);
lumaN_73 = tmpvar_158;
float tmpvar_159;
tmpvar_159 = ((lumaS_69 + lumaM_71) * 0.5);
lumaS_69 = tmpvar_159;
bool tmpvar_160;
tmpvar_160 = (gradientN_49 >= gradientS_48);
pairN_47 = tmpvar_160;
if (!(pairN_47)) {
float tmpvar_161;
tmpvar_161 = lumaS_69;
lumaN_73 = tmpvar_161;
};
if (!(pairN_47)) {
float tmpvar_162;
tmpvar_162 = gradientS_48;
gradientN_49 = tmpvar_162;
};
if (!(pairN_47)) {
float tmpvar_163;
tmpvar_163 = (lengthSign_50 * -(1.0));
lengthSign_50 = tmpvar_163;
};
float tmpvar_164;
if (horzSpan_51) {
tmpvar_164 = 0.0;
} else {
tmpvar_164 = (lengthSign_50 * 0.5);
};
float tmpvar_165;
tmpvar_165 = (pos_30.x + tmpvar_164);
posN_46.x = tmpvar_165;
float tmpvar_166;
if (horzSpan_51) {
tmpvar_166 = (lengthSign_50 * 0.5);
} else {
tmpvar_166 = 0.0;
};
float tmpvar_167;
tmpvar_167 = (pos_30.y + tmpvar_166);
posN_46.y = vec2(tmpvar_167).y;
float tmpvar_168;
tmpvar_168 = (gradientN_49 * 0.25);
gradientN_49 = tmpvar_168;
vec2 tmpvar_169;
tmpvar_169 = posN_46;
posP_45 = tmpvar_169;
vec2 tmpvar_170;
if (horzSpan_51) {
vec2 tmpvar_171;
tmpvar_171.y = 0.0;
tmpvar_171.x = rcpFrame_32.x;
tmpvar_170 = tmpvar_171;
} else {
vec2 tmpvar_172;
tmpvar_172.x = 0.0;
tmpvar_172.y = rcpFrame_32.y;
tmpvar_170 = tmpvar_172;
};
vec2 tmpvar_173;
tmpvar_173 = tmpvar_170;
offNP_44 = tmpvar_173;
float tmpvar_174;
tmpvar_174 = lumaN_73;
lumaEndN_43 = tmpvar_174;
float tmpvar_175;
tmpvar_175 = lumaN_73;
lumaEndP_42 = tmpvar_175;
vec2 tmpvar_176;
tmpvar_176 = (posN_46 + (offNP_44 * vec2(-2.0, -2.0)));
posN_46 = tmpvar_176;
vec2 tmpvar_177;
tmpvar_177 = (posP_45 + (offNP_44 * vec2(2.0, 2.0)));
posP_45 = tmpvar_177;
vec2 tmpvar_178;
tmpvar_178 = (offNP_44 * vec2(3.0, 3.0));
offNP_44 = tmpvar_178;
while (true) {
if (!((i_39 < 4))) {
break;
};
if (!(doneN_41)) {
vec4 tmpvar_179;
tmpvar_179 = FxaaTexGrad (tex_31, posN_46.xy, offNP_44);
float tmpvar_180;
tmpvar_180 = FxaaLuma (tmpvar_179.xyz);
float tmpvar_181;
tmpvar_181 = tmpvar_180;
lumaEndN_43 = tmpvar_181;
};
if (!(doneP_40)) {
vec4 tmpvar_182;
tmpvar_182 = FxaaTexGrad (tex_31, posP_45.xy, offNP_44);
float tmpvar_183;
tmpvar_183 = FxaaLuma (tmpvar_182.xyz);
float tmpvar_184;
tmpvar_184 = tmpvar_183;
lumaEndP_42 = tmpvar_184;
};
bool tmpvar_185;
if (doneN_41) {
tmpvar_185 = bool(1);
} else {
float tmpvar_186;
tmpvar_186 = abs ((lumaEndN_43 - lumaN_73));
tmpvar_185 = (tmpvar_186 >= gradientN_49);
};
bool tmpvar_187;
tmpvar_187 = tmpvar_185;
doneN_41 = tmpvar_187;
bool tmpvar_188;
if (doneP_40) {
tmpvar_188 = bool(1);
} else {
float tmpvar_189;
tmpvar_189 = abs ((lumaEndP_42 - lumaN_73));
tmpvar_188 = (tmpvar_189 >= gradientN_49);
};
bool tmpvar_190;
tmpvar_190 = tmpvar_188;
doneP_40 = tmpvar_190;
if ((doneN_41 && doneP_40)) {
break;
};
if (!(doneN_41)) {
vec2 tmpvar_191;
tmpvar_191 = (posN_46 - offNP_44);
posN_46 = tmpvar_191;
};
if (!(doneP_40)) {
vec2 tmpvar_192;
tmpvar_192 = (posP_45 + offNP_44);
posP_45 = tmpvar_192;
};
int _post_incdec_tmp_193;
_post_incdec_tmp_193 = i_39;
int tmpvar_194;
tmpvar_194 = (i_39 + 1);
i_39 = tmpvar_194;
};
float tmpvar_195;
if (horzSpan_51) {
tmpvar_195 = (pos_30.x - posN_46.x);
} else {
tmpvar_195 = (pos_30.y - posN_46.y);
};
float tmpvar_196;
tmpvar_196 = tmpvar_195;
dstN_38 = tmpvar_196;
float tmpvar_197;
if (horzSpan_51) {
tmpvar_197 = (posP_45.x - pos_30.x);
} else {
tmpvar_197 = (posP_45.y - pos_30.y);
};
float tmpvar_198;
tmpvar_198 = tmpvar_197;
dstP_37 = tmpvar_198;
bool tmpvar_199;
tmpvar_199 = (dstN_38 < dstP_37);
directionN_36 = tmpvar_199;
float tmpvar_200;
if (directionN_36) {
tmpvar_200 = lumaEndN_43;
} else {
tmpvar_200 = lumaEndP_42;
};
float tmpvar_201;
tmpvar_201 = tmpvar_200;
lumaEndN_43 = tmpvar_201;
if ((((lumaM_71 - lumaN_73) < 0.0) == ((lumaEndN_43 - lumaN_73) < 0.0))) {
float tmpvar_202;
tmpvar_202 = 0.0;
lengthSign_50 = tmpvar_202;
};
float tmpvar_203;
tmpvar_203 = (dstP_37 + dstN_38);
spanLength_35 = tmpvar_203;
float tmpvar_204;
if (directionN_36) {
tmpvar_204 = dstN_38;
} else {
tmpvar_204 = dstP_37;
};
float tmpvar_205;
tmpvar_205 = tmpvar_204;
dstN_38 = tmpvar_205;
float tmpvar_206;
2014-02-11 02:06:13 -05:00
tmpvar_206 = ((0.5 + (dstN_38 *
(-(1.0) / spanLength_35)
)) * lengthSign_50);
2012-10-07 23:41:18 -04:00
subPixelOffset_34 = tmpvar_206;
float tmpvar_207;
if (horzSpan_51) {
tmpvar_207 = 0.0;
} else {
tmpvar_207 = subPixelOffset_34;
};
float tmpvar_208;
if (horzSpan_51) {
tmpvar_208 = subPixelOffset_34;
} else {
tmpvar_208 = 0.0;
};
vec2 tmpvar_209;
tmpvar_209.x = (pos_30.x + tmpvar_207);
tmpvar_209.y = (pos_30.y + tmpvar_208);
vec4 tmpvar_210;
tmpvar_210 = FxaaTexLod0 (tex_31, tmpvar_209);
vec3 tmpvar_211;
tmpvar_211 = tmpvar_210.xyz;
rgbF_33 = tmpvar_211;
vec3 tmpvar_212;
tmpvar_212 = FxaaLerp3 (rgbL_65, rgbF_33, blendL_62);
vec3 tmpvar_213;
tmpvar_213 = FxaaFilterReturn (tmpvar_212);
return tmpvar_213;
}
vec4 xlat_main (
in vec2 uv_214
)
{
vec3 tmpvar_215;
tmpvar_215 = FxaaPixelShader (uv_214.xy, _MainTex, _MainTex_TexelSize.xy);
vec4 tmpvar_216;
tmpvar_216.w = 0.0;
tmpvar_216.xyz = tmpvar_215.xyz.xyz;
return tmpvar_216;
}
void main ()
{
vec4 xl_retval_217;
vec2 tmpvar_218;
tmpvar_218 = xlv_TEXCOORD0.xy;
vec4 tmpvar_219;
tmpvar_219 = xlat_main (tmpvar_218);
vec4 tmpvar_220;
tmpvar_220 = tmpvar_219;
xl_retval_217 = tmpvar_220;
vec4 tmpvar_221;
tmpvar_221 = xl_retval_217.xyzw;
vec4 tmpvar_222;
tmpvar_222 = tmpvar_221;
gl_FragData[0] = tmpvar_222;
}