mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-29 02:55:36 -05:00
100 lines
3.7 KiB
Text
100 lines
3.7 KiB
Text
#extension GL_EXT_shader_texture_lod : enable
|
|
lowp vec4 impl_low_texture2DLodEXT(lowp sampler2D sampler, highp vec2 coord, mediump float lod)
|
|
{
|
|
#if defined(GL_EXT_shader_texture_lod)
|
|
return texture2DLodEXT(sampler, coord, lod);
|
|
#else
|
|
return texture2D(sampler, coord, lod);
|
|
#endif
|
|
}
|
|
|
|
uniform sampler2D _MainTex;
|
|
uniform highp vec4 _MainTex_TexelSize;
|
|
varying highp vec2 xlv_TEXCOORD0;
|
|
varying highp vec4 xlv_TEXCOORD1;
|
|
void main ()
|
|
{
|
|
highp vec4 fxaaConsoleRcpFrameOpt_1;
|
|
fxaaConsoleRcpFrameOpt_1 = (_MainTex_TexelSize.xyxy * vec4(-0.5, -0.5, 0.5, 0.5));
|
|
highp vec4 fxaaConsoleRcpFrameOpt2_2;
|
|
fxaaConsoleRcpFrameOpt2_2 = (_MainTex_TexelSize.xyxy * vec4(-2.0, -2.0, 2.0, 2.0));
|
|
lowp vec4 tmpvar_3;
|
|
lowp vec4 rgbyB_4;
|
|
lowp vec4 rgbyA_5;
|
|
highp vec2 dir_6;
|
|
highp float dirSeMinusNw_7;
|
|
highp float lumaMaxSubMinM_8;
|
|
highp float dirSwMinusNe_9;
|
|
highp float lumaM_10;
|
|
highp float lumaNe_11;
|
|
lowp vec4 tmpvar_12;
|
|
tmpvar_12 = impl_low_texture2DLodEXT (_MainTex, xlv_TEXCOORD1.xy, 0.0);
|
|
highp float tmpvar_13;
|
|
tmpvar_13 = tmpvar_12.y;
|
|
lowp vec4 tmpvar_14;
|
|
tmpvar_14 = impl_low_texture2DLodEXT (_MainTex, xlv_TEXCOORD1.xw, 0.0);
|
|
highp float tmpvar_15;
|
|
tmpvar_15 = tmpvar_14.y;
|
|
lowp vec4 tmpvar_16;
|
|
tmpvar_16 = impl_low_texture2DLodEXT (_MainTex, xlv_TEXCOORD1.zy, 0.0);
|
|
highp float tmpvar_17;
|
|
tmpvar_17 = tmpvar_16.y;
|
|
lowp vec4 tmpvar_18;
|
|
tmpvar_18 = impl_low_texture2DLodEXT (_MainTex, xlv_TEXCOORD1.zw, 0.0);
|
|
highp float tmpvar_19;
|
|
tmpvar_19 = tmpvar_18.y;
|
|
lowp vec4 tmpvar_20;
|
|
tmpvar_20 = impl_low_texture2DLodEXT (_MainTex, xlv_TEXCOORD0, 0.0);
|
|
lumaM_10 = tmpvar_20.y;
|
|
lumaNe_11 = (tmpvar_17 + 0.00260417);
|
|
highp float tmpvar_21;
|
|
tmpvar_21 = max (max (lumaNe_11, tmpvar_19), max (tmpvar_13, tmpvar_15));
|
|
highp float tmpvar_22;
|
|
tmpvar_22 = min (min (lumaNe_11, tmpvar_19), min (tmpvar_13, tmpvar_15));
|
|
highp float tmpvar_23;
|
|
tmpvar_23 = max (0.05, (tmpvar_21 * 0.125));
|
|
dirSwMinusNe_9 = (tmpvar_15 - lumaNe_11);
|
|
lumaMaxSubMinM_8 = (max (tmpvar_21, lumaM_10) - min (tmpvar_22, lumaM_10));
|
|
dirSeMinusNw_7 = (tmpvar_19 - tmpvar_13);
|
|
if ((lumaMaxSubMinM_8 < tmpvar_23)) {
|
|
tmpvar_3 = tmpvar_20;
|
|
} else {
|
|
dir_6.x = (dirSwMinusNe_9 + dirSeMinusNw_7);
|
|
dir_6.y = (dirSwMinusNe_9 - dirSeMinusNw_7);
|
|
highp vec2 tmpvar_24;
|
|
tmpvar_24 = normalize(dir_6);
|
|
highp vec4 tmpvar_25;
|
|
tmpvar_25.zw = vec2(0.0, 0.0);
|
|
tmpvar_25.xy = (xlv_TEXCOORD0 - (tmpvar_24 * fxaaConsoleRcpFrameOpt_1.zw));
|
|
highp vec4 tmpvar_26;
|
|
tmpvar_26.zw = vec2(0.0, 0.0);
|
|
tmpvar_26.xy = (xlv_TEXCOORD0 + (tmpvar_24 * fxaaConsoleRcpFrameOpt_1.zw));
|
|
highp vec2 tmpvar_27;
|
|
tmpvar_27 = clamp ((tmpvar_24 / (
|
|
min (abs(tmpvar_24.x), abs(tmpvar_24.y))
|
|
* 8.0)), vec2(-2.0, -2.0), vec2(2.0, 2.0));
|
|
highp vec4 tmpvar_28;
|
|
tmpvar_28.zw = vec2(0.0, 0.0);
|
|
tmpvar_28.xy = (xlv_TEXCOORD0 - (tmpvar_27 * fxaaConsoleRcpFrameOpt2_2.zw));
|
|
highp vec4 tmpvar_29;
|
|
tmpvar_29.zw = vec2(0.0, 0.0);
|
|
tmpvar_29.xy = (xlv_TEXCOORD0 + (tmpvar_27 * fxaaConsoleRcpFrameOpt2_2.zw));
|
|
rgbyA_5 = (impl_low_texture2DLodEXT (_MainTex, tmpvar_25.xy, 0.0) + impl_low_texture2DLodEXT (_MainTex, tmpvar_26.xy, 0.0));
|
|
rgbyB_4 = (((impl_low_texture2DLodEXT (_MainTex, tmpvar_28.xy, 0.0) + impl_low_texture2DLodEXT (_MainTex, tmpvar_29.xy, 0.0)) * 0.25) + (rgbyA_5 * 0.25));
|
|
if (((rgbyB_4.y < tmpvar_22) || (rgbyB_4.y > tmpvar_21))) {
|
|
rgbyB_4.xyz = (rgbyA_5.xyz * 0.5);
|
|
};
|
|
tmpvar_3 = rgbyB_4;
|
|
};
|
|
gl_FragData[0] = tmpvar_3;
|
|
}
|
|
|
|
|
|
// stats: 47 alu 9 tex 2 flow
|
|
// inputs: 2
|
|
// #0: xlv_TEXCOORD0 (high float) 2x1 [-1]
|
|
// #1: xlv_TEXCOORD1 (high float) 4x1 [-1]
|
|
// uniforms: 1 (total size: 0)
|
|
// #0: _MainTex_TexelSize (high float) 4x1 [-1]
|
|
// textures: 1
|
|
// #0: _MainTex (low 2d) 0x0 [-1]
|