mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-12-01 11:56:58 -05:00
317 lines
8.4 KiB
Text
317 lines
8.4 KiB
Text
#extension GL_EXT_shader_texture_lod : enable
|
|
struct v2f {
|
|
highp vec4 pos;
|
|
highp vec2 uv;
|
|
highp vec4 uvPosPos;
|
|
};
|
|
varying highp vec4 xlv_TEXCOORD1;
|
|
varying highp vec2 xlv_TEXCOORD0;
|
|
uniform highp vec4 _MainTex_TexelSize;
|
|
uniform sampler2D _MainTex;
|
|
vec4 xll_tex2Dlod (
|
|
in sampler2D s,
|
|
in vec4 coord
|
|
)
|
|
{
|
|
lowp vec4 tmpvar_1;
|
|
tmpvar_1 = texture2DLodEXT (s, coord.xy, coord.w);
|
|
return tmpvar_1;
|
|
}
|
|
|
|
float FxaaLuma (
|
|
in lowp vec4 rgba
|
|
)
|
|
{
|
|
return rgba.y;
|
|
}
|
|
|
|
lowp vec4 FxaaPixelShader (
|
|
in highp vec2 pos,
|
|
in highp vec4 fxaaConsolePosPos,
|
|
in sampler2D tex,
|
|
in sampler2D fxaaConsole360TexExpBiasNegOne,
|
|
in sampler2D fxaaConsole360TexExpBiasNegTwo,
|
|
in highp vec2 fxaaQualityRcpFrame,
|
|
in highp vec4 fxaaConsoleRcpFrameOpt,
|
|
in highp vec4 fxaaConsoleRcpFrameOpt2,
|
|
in highp vec4 fxaaConsole360RcpFrameOpt2,
|
|
in highp float fxaaQualitySubpix,
|
|
in highp float fxaaQualityEdgeThreshold,
|
|
in highp float fxaaQualityEdgeThresholdMin,
|
|
in highp float fxaaConsoleEdgeSharpness,
|
|
in highp float fxaaConsoleEdgeThreshold,
|
|
in highp float fxaaConsoleEdgeThresholdMin,
|
|
in highp vec4 fxaaConsole360ConstDir
|
|
)
|
|
{
|
|
bool twoTap;
|
|
lowp vec4 rgbyB;
|
|
lowp vec4 rgbyA;
|
|
lowp vec4 rgbyP2;
|
|
lowp vec4 rgbyN2;
|
|
highp vec2 dir2;
|
|
highp float dirAbsMinTimesC;
|
|
lowp vec4 rgbyP1;
|
|
lowp vec4 rgbyN1;
|
|
highp vec2 dir1;
|
|
highp vec2 dir;
|
|
highp float dirSeMinusNw;
|
|
highp float lumaMaxSubMinM;
|
|
highp float dirSwMinusNe;
|
|
highp float lumaMaxM;
|
|
highp float lumaMaxScaledClamped;
|
|
highp float lumaMinM;
|
|
highp float lumaMaxScaled;
|
|
highp float lumaMin;
|
|
highp float lumaMax;
|
|
highp float lumaMinNeSe;
|
|
highp float lumaMaxNeSe;
|
|
highp float lumaMinNwSw;
|
|
highp float lumaMaxNwSw;
|
|
highp float lumaM;
|
|
lowp vec4 rgbyM;
|
|
highp float lumaSe;
|
|
highp float lumaNe;
|
|
highp float lumaSw;
|
|
highp float lumaNw;
|
|
highp vec4 tmpvar_1;
|
|
tmpvar_1.zw = vec2(0.0, 0.0);
|
|
tmpvar_1.xy = fxaaConsolePosPos.xy.xy;
|
|
vec4 tmpvar_2;
|
|
tmpvar_2 = xll_tex2Dlod (tex, tmpvar_1);
|
|
highp float tmpvar_3;
|
|
tmpvar_3 = FxaaLuma (tmpvar_2);
|
|
highp float tmpvar_4;
|
|
tmpvar_4 = tmpvar_3;
|
|
lumaNw = tmpvar_4;
|
|
highp vec4 tmpvar_5;
|
|
tmpvar_5.zw = vec2(0.0, 0.0);
|
|
tmpvar_5.xy = fxaaConsolePosPos.xw.xy;
|
|
vec4 tmpvar_6;
|
|
tmpvar_6 = xll_tex2Dlod (tex, tmpvar_5);
|
|
highp float tmpvar_7;
|
|
tmpvar_7 = FxaaLuma (tmpvar_6);
|
|
highp float tmpvar_8;
|
|
tmpvar_8 = tmpvar_7;
|
|
lumaSw = tmpvar_8;
|
|
highp vec4 tmpvar_9;
|
|
tmpvar_9.zw = vec2(0.0, 0.0);
|
|
tmpvar_9.xy = fxaaConsolePosPos.zy.xy;
|
|
vec4 tmpvar_10;
|
|
tmpvar_10 = xll_tex2Dlod (tex, tmpvar_9);
|
|
highp float tmpvar_11;
|
|
tmpvar_11 = FxaaLuma (tmpvar_10);
|
|
highp float tmpvar_12;
|
|
tmpvar_12 = tmpvar_11;
|
|
lumaNe = tmpvar_12;
|
|
highp vec4 tmpvar_13;
|
|
tmpvar_13.zw = vec2(0.0, 0.0);
|
|
tmpvar_13.xy = fxaaConsolePosPos.zw.xy;
|
|
vec4 tmpvar_14;
|
|
tmpvar_14 = xll_tex2Dlod (tex, tmpvar_13);
|
|
highp float tmpvar_15;
|
|
tmpvar_15 = FxaaLuma (tmpvar_14);
|
|
highp float tmpvar_16;
|
|
tmpvar_16 = tmpvar_15;
|
|
lumaSe = tmpvar_16;
|
|
highp vec4 tmpvar_17;
|
|
tmpvar_17.zw = vec2(0.0, 0.0);
|
|
tmpvar_17.xy = pos.xy.xy;
|
|
vec4 tmpvar_18;
|
|
tmpvar_18 = xll_tex2Dlod (tex, tmpvar_17);
|
|
vec4 tmpvar_19;
|
|
tmpvar_19 = tmpvar_18;
|
|
rgbyM = tmpvar_19;
|
|
lowp float tmpvar_20;
|
|
tmpvar_20 = rgbyM.y;
|
|
lumaM = tmpvar_20;
|
|
highp float tmpvar_21;
|
|
tmpvar_21 = max (lumaNw, lumaSw);
|
|
highp float tmpvar_22;
|
|
tmpvar_22 = tmpvar_21;
|
|
lumaMaxNwSw = tmpvar_22;
|
|
highp float tmpvar_23;
|
|
tmpvar_23 = (lumaNe + 0.00260417);
|
|
lumaNe = tmpvar_23;
|
|
highp float tmpvar_24;
|
|
tmpvar_24 = min (lumaNw, lumaSw);
|
|
highp float tmpvar_25;
|
|
tmpvar_25 = tmpvar_24;
|
|
lumaMinNwSw = tmpvar_25;
|
|
highp float tmpvar_26;
|
|
tmpvar_26 = max (lumaNe, lumaSe);
|
|
highp float tmpvar_27;
|
|
tmpvar_27 = tmpvar_26;
|
|
lumaMaxNeSe = tmpvar_27;
|
|
highp float tmpvar_28;
|
|
tmpvar_28 = min (lumaNe, lumaSe);
|
|
highp float tmpvar_29;
|
|
tmpvar_29 = tmpvar_28;
|
|
lumaMinNeSe = tmpvar_29;
|
|
highp float tmpvar_30;
|
|
tmpvar_30 = max (lumaMaxNeSe, lumaMaxNwSw);
|
|
highp float tmpvar_31;
|
|
tmpvar_31 = tmpvar_30;
|
|
lumaMax = tmpvar_31;
|
|
highp float tmpvar_32;
|
|
tmpvar_32 = min (lumaMinNeSe, lumaMinNwSw);
|
|
highp float tmpvar_33;
|
|
tmpvar_33 = tmpvar_32;
|
|
lumaMin = tmpvar_33;
|
|
highp float tmpvar_34;
|
|
tmpvar_34 = (lumaMax * fxaaConsoleEdgeThreshold);
|
|
lumaMaxScaled = tmpvar_34;
|
|
highp float tmpvar_35;
|
|
tmpvar_35 = min (lumaMin, lumaM);
|
|
highp float tmpvar_36;
|
|
tmpvar_36 = tmpvar_35;
|
|
lumaMinM = tmpvar_36;
|
|
highp float tmpvar_37;
|
|
tmpvar_37 = max (fxaaConsoleEdgeThresholdMin, lumaMaxScaled);
|
|
highp float tmpvar_38;
|
|
tmpvar_38 = tmpvar_37;
|
|
lumaMaxScaledClamped = tmpvar_38;
|
|
highp float tmpvar_39;
|
|
tmpvar_39 = max (lumaMax, lumaM);
|
|
highp float tmpvar_40;
|
|
tmpvar_40 = tmpvar_39;
|
|
lumaMaxM = tmpvar_40;
|
|
highp float tmpvar_41;
|
|
tmpvar_41 = (lumaSw - lumaNe);
|
|
dirSwMinusNe = tmpvar_41;
|
|
highp float tmpvar_42;
|
|
tmpvar_42 = (lumaMaxM - lumaMinM);
|
|
lumaMaxSubMinM = tmpvar_42;
|
|
highp float tmpvar_43;
|
|
tmpvar_43 = (lumaSe - lumaNw);
|
|
dirSeMinusNw = tmpvar_43;
|
|
if ((lumaMaxSubMinM < lumaMaxScaledClamped)) {
|
|
return rgbyM;
|
|
};
|
|
highp float tmpvar_44;
|
|
tmpvar_44 = (dirSwMinusNe + dirSeMinusNw);
|
|
dir.x = tmpvar_44;
|
|
highp float tmpvar_45;
|
|
tmpvar_45 = (dirSwMinusNe - dirSeMinusNw);
|
|
dir.y = vec2(tmpvar_45).y;
|
|
highp vec2 tmpvar_46;
|
|
tmpvar_46 = normalize (dir.xy);
|
|
highp vec2 tmpvar_47;
|
|
tmpvar_47 = tmpvar_46;
|
|
dir1 = tmpvar_47;
|
|
highp vec4 tmpvar_48;
|
|
tmpvar_48.zw = vec2(0.0, 0.0);
|
|
tmpvar_48.xy = (pos.xy - (dir1 * fxaaConsoleRcpFrameOpt.zw)).xy;
|
|
vec4 tmpvar_49;
|
|
tmpvar_49 = xll_tex2Dlod (tex, tmpvar_48);
|
|
vec4 tmpvar_50;
|
|
tmpvar_50 = tmpvar_49;
|
|
rgbyN1 = tmpvar_50;
|
|
highp vec4 tmpvar_51;
|
|
tmpvar_51.zw = vec2(0.0, 0.0);
|
|
tmpvar_51.xy = (pos.xy + (dir1 * fxaaConsoleRcpFrameOpt.zw)).xy;
|
|
vec4 tmpvar_52;
|
|
tmpvar_52 = xll_tex2Dlod (tex, tmpvar_51);
|
|
vec4 tmpvar_53;
|
|
tmpvar_53 = tmpvar_52;
|
|
rgbyP1 = tmpvar_53;
|
|
highp float tmpvar_54;
|
|
tmpvar_54 = abs (dir1.x);
|
|
highp float tmpvar_55;
|
|
tmpvar_55 = abs (dir1.y);
|
|
highp float tmpvar_56;
|
|
tmpvar_56 = min (tmpvar_54, tmpvar_55);
|
|
highp float tmpvar_57;
|
|
tmpvar_57 = (tmpvar_56 * fxaaConsoleEdgeSharpness);
|
|
dirAbsMinTimesC = tmpvar_57;
|
|
highp vec2 tmpvar_58;
|
|
tmpvar_58 = clamp ((dir1.xy / dirAbsMinTimesC), vec2(-2.0, -2.0), vec2(2.0, 2.0));
|
|
highp vec2 tmpvar_59;
|
|
tmpvar_59 = tmpvar_58;
|
|
dir2 = tmpvar_59;
|
|
highp vec4 tmpvar_60;
|
|
tmpvar_60.zw = vec2(0.0, 0.0);
|
|
tmpvar_60.xy = (pos.xy - (dir2 * fxaaConsoleRcpFrameOpt2.zw)).xy;
|
|
vec4 tmpvar_61;
|
|
tmpvar_61 = xll_tex2Dlod (tex, tmpvar_60);
|
|
vec4 tmpvar_62;
|
|
tmpvar_62 = tmpvar_61;
|
|
rgbyN2 = tmpvar_62;
|
|
highp vec4 tmpvar_63;
|
|
tmpvar_63.zw = vec2(0.0, 0.0);
|
|
tmpvar_63.xy = (pos.xy + (dir2 * fxaaConsoleRcpFrameOpt2.zw)).xy;
|
|
vec4 tmpvar_64;
|
|
tmpvar_64 = xll_tex2Dlod (tex, tmpvar_63);
|
|
vec4 tmpvar_65;
|
|
tmpvar_65 = tmpvar_64;
|
|
rgbyP2 = tmpvar_65;
|
|
lowp vec4 tmpvar_66;
|
|
tmpvar_66 = (rgbyN1 + rgbyP1);
|
|
rgbyA = tmpvar_66;
|
|
lowp vec4 tmpvar_67;
|
|
tmpvar_67 = (((rgbyN2 + rgbyP2) * 0.25) + (rgbyA * 0.25));
|
|
rgbyB = tmpvar_67;
|
|
bool tmpvar_68;
|
|
if ((rgbyB.y < lumaMin)) {
|
|
tmpvar_68 = bool(1);
|
|
} else {
|
|
tmpvar_68 = (rgbyB.y > lumaMax);
|
|
};
|
|
bool tmpvar_69;
|
|
tmpvar_69 = tmpvar_68;
|
|
twoTap = tmpvar_69;
|
|
if (twoTap) {
|
|
lowp vec3 tmpvar_70;
|
|
tmpvar_70 = (rgbyA.xyz * 0.5);
|
|
rgbyB.xyz = tmpvar_70.xyz.xyz;
|
|
};
|
|
return rgbyB;
|
|
}
|
|
|
|
lowp vec4 xlat_main (
|
|
in v2f i
|
|
)
|
|
{
|
|
highp float fxaaN;
|
|
float tmpvar_1;
|
|
tmpvar_1 = 0.5;
|
|
fxaaN = tmpvar_1;
|
|
highp vec4 tmpvar_2;
|
|
tmpvar_2.x = -(fxaaN);
|
|
tmpvar_2.y = -(fxaaN);
|
|
tmpvar_2.z = fxaaN;
|
|
tmpvar_2.w = fxaaN;
|
|
lowp vec4 tmpvar_3;
|
|
tmpvar_3 = FxaaPixelShader (i.uv, i.uvPosPos, _MainTex, _MainTex, _MainTex, _MainTex_TexelSize.xy, (_MainTex_TexelSize.xyxy * tmpvar_2), (_MainTex_TexelSize.xyxy * vec4(-2.0, -2.0, 2.0, 2.0)), (_MainTex_TexelSize.xyxy * vec4(8.0, 8.0, -4.0, -4.0)), 0.75, 0.166, 0.0833, 8.0, 0.125, 0.05, vec4(1.0, -1.0, 0.25, -0.25));
|
|
return tmpvar_3;
|
|
}
|
|
|
|
void main ()
|
|
{
|
|
v2f xlt_i;
|
|
lowp vec4 xl_retval;
|
|
vec4 tmpvar_1;
|
|
tmpvar_1 = vec4(0.0, 0.0, 0.0, 0.0);
|
|
xlt_i.pos = tmpvar_1;
|
|
highp vec2 tmpvar_2;
|
|
tmpvar_2 = xlv_TEXCOORD0.xy;
|
|
highp vec2 tmpvar_3;
|
|
tmpvar_3 = tmpvar_2;
|
|
xlt_i.uv = tmpvar_3;
|
|
highp vec4 tmpvar_4;
|
|
tmpvar_4 = xlv_TEXCOORD1.xyzw;
|
|
highp vec4 tmpvar_5;
|
|
tmpvar_5 = tmpvar_4;
|
|
xlt_i.uvPosPos = tmpvar_5;
|
|
lowp vec4 tmpvar_6;
|
|
tmpvar_6 = xlat_main (xlt_i);
|
|
lowp vec4 tmpvar_7;
|
|
tmpvar_7 = tmpvar_6;
|
|
xl_retval = tmpvar_7;
|
|
lowp vec4 tmpvar_8;
|
|
tmpvar_8 = xl_retval.xyzw;
|
|
lowp vec4 tmpvar_9;
|
|
tmpvar_9 = tmpvar_8;
|
|
gl_FragData[0] = tmpvar_9;
|
|
}
|
|
|