mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-12-01 11:56:58 -05:00
312 lines
9 KiB
Text
312 lines
9 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_1,
|
||
|
in vec4 coord_2
|
||
|
)
|
||
|
{
|
||
|
lowp vec4 tmpvar_3;
|
||
|
tmpvar_3 = texture2DLodEXT (s_1, coord_2.xy, coord_2.w);
|
||
|
return tmpvar_3;
|
||
|
}
|
||
|
|
||
|
float FxaaLuma (
|
||
|
in lowp vec4 rgba_4
|
||
|
)
|
||
|
{
|
||
|
return rgba_4.y;
|
||
|
}
|
||
|
|
||
|
lowp vec4 FxaaPixelShader (
|
||
|
in highp vec2 pos_5,
|
||
|
in highp vec4 fxaaConsolePosPos_6,
|
||
|
in sampler2D tex_7,
|
||
|
in sampler2D fxaaConsole360TexExpBiasNegOne_8,
|
||
|
in sampler2D fxaaConsole360TexExpBiasNegTwo_9,
|
||
|
in highp vec2 fxaaQualityRcpFrame_10,
|
||
|
in highp vec4 fxaaConsoleRcpFrameOpt_11,
|
||
|
in highp vec4 fxaaConsoleRcpFrameOpt2_12,
|
||
|
in highp vec4 fxaaConsole360RcpFrameOpt2_13,
|
||
|
in highp float fxaaQualitySubpix_14,
|
||
|
in highp float fxaaQualityEdgeThreshold_15,
|
||
|
in highp float fxaaQualityEdgeThresholdMin_16,
|
||
|
in highp float fxaaConsoleEdgeSharpness_17,
|
||
|
in highp float fxaaConsoleEdgeThreshold_18,
|
||
|
in highp float fxaaConsoleEdgeThresholdMin_19,
|
||
|
in highp vec4 fxaaConsole360ConstDir_20
|
||
|
)
|
||
|
{
|
||
|
bool twoTap_21;
|
||
|
lowp vec4 rgbyB_22;
|
||
|
lowp vec4 rgbyA_23;
|
||
|
lowp vec4 rgbyP2_24;
|
||
|
lowp vec4 rgbyN2_25;
|
||
|
highp vec2 dir2_26;
|
||
|
highp float dirAbsMinTimesC_27;
|
||
|
lowp vec4 rgbyP1_28;
|
||
|
lowp vec4 rgbyN1_29;
|
||
|
highp vec2 dir1_30;
|
||
|
highp vec2 dir_31;
|
||
|
highp float dirSeMinusNw_32;
|
||
|
highp float lumaMaxSubMinM_33;
|
||
|
highp float dirSwMinusNe_34;
|
||
|
highp float lumaMaxM_35;
|
||
|
highp float lumaMaxScaledClamped_36;
|
||
|
highp float lumaMinM_37;
|
||
|
highp float lumaMaxScaled_38;
|
||
|
highp float lumaMin_39;
|
||
|
highp float lumaMax_40;
|
||
|
highp float lumaMinNeSe_41;
|
||
|
highp float lumaMaxNeSe_42;
|
||
|
highp float lumaMinNwSw_43;
|
||
|
highp float lumaMaxNwSw_44;
|
||
|
highp float lumaM_45;
|
||
|
lowp vec4 rgbyM_46;
|
||
|
highp float lumaSe_47;
|
||
|
highp float lumaNe_48;
|
||
|
highp float lumaSw_49;
|
||
|
highp float lumaNw_50;
|
||
|
highp vec4 tmpvar_51;
|
||
|
tmpvar_51.zw = vec2(0.0, 0.0);
|
||
|
tmpvar_51.xy = fxaaConsolePosPos_6.xy.xy;
|
||
|
vec4 tmpvar_52;
|
||
|
tmpvar_52 = xll_tex2Dlod (tex_7, tmpvar_51);
|
||
|
highp float tmpvar_53;
|
||
|
tmpvar_53 = FxaaLuma (tmpvar_52);
|
||
|
highp float tmpvar_54;
|
||
|
tmpvar_54 = tmpvar_53;
|
||
|
lumaNw_50 = tmpvar_54;
|
||
|
highp vec4 tmpvar_55;
|
||
|
tmpvar_55.zw = vec2(0.0, 0.0);
|
||
|
tmpvar_55.xy = fxaaConsolePosPos_6.xw.xy;
|
||
|
vec4 tmpvar_56;
|
||
|
tmpvar_56 = xll_tex2Dlod (tex_7, tmpvar_55);
|
||
|
highp float tmpvar_57;
|
||
|
tmpvar_57 = FxaaLuma (tmpvar_56);
|
||
|
highp float tmpvar_58;
|
||
|
tmpvar_58 = tmpvar_57;
|
||
|
lumaSw_49 = tmpvar_58;
|
||
|
highp vec4 tmpvar_59;
|
||
|
tmpvar_59.zw = vec2(0.0, 0.0);
|
||
|
tmpvar_59.xy = fxaaConsolePosPos_6.zy.xy;
|
||
|
vec4 tmpvar_60;
|
||
|
tmpvar_60 = xll_tex2Dlod (tex_7, tmpvar_59);
|
||
|
highp float tmpvar_61;
|
||
|
tmpvar_61 = FxaaLuma (tmpvar_60);
|
||
|
highp float tmpvar_62;
|
||
|
tmpvar_62 = tmpvar_61;
|
||
|
lumaNe_48 = tmpvar_62;
|
||
|
highp vec4 tmpvar_63;
|
||
|
tmpvar_63.zw = vec2(0.0, 0.0);
|
||
|
tmpvar_63.xy = fxaaConsolePosPos_6.zw.xy;
|
||
|
vec4 tmpvar_64;
|
||
|
tmpvar_64 = xll_tex2Dlod (tex_7, tmpvar_63);
|
||
|
highp float tmpvar_65;
|
||
|
tmpvar_65 = FxaaLuma (tmpvar_64);
|
||
|
highp float tmpvar_66;
|
||
|
tmpvar_66 = tmpvar_65;
|
||
|
lumaSe_47 = tmpvar_66;
|
||
|
highp vec4 tmpvar_67;
|
||
|
tmpvar_67.zw = vec2(0.0, 0.0);
|
||
|
tmpvar_67.xy = pos_5.xy.xy;
|
||
|
vec4 tmpvar_68;
|
||
|
tmpvar_68 = xll_tex2Dlod (tex_7, tmpvar_67);
|
||
|
vec4 tmpvar_69;
|
||
|
tmpvar_69 = tmpvar_68;
|
||
|
rgbyM_46 = tmpvar_69;
|
||
|
lowp float tmpvar_70;
|
||
|
tmpvar_70 = rgbyM_46.y;
|
||
|
lumaM_45 = tmpvar_70;
|
||
|
highp float tmpvar_71;
|
||
|
tmpvar_71 = max (lumaNw_50, lumaSw_49);
|
||
|
highp float tmpvar_72;
|
||
|
tmpvar_72 = tmpvar_71;
|
||
|
lumaMaxNwSw_44 = tmpvar_72;
|
||
|
highp float tmpvar_73;
|
||
|
tmpvar_73 = (lumaNe_48 + 0.00260417);
|
||
|
lumaNe_48 = tmpvar_73;
|
||
|
highp float tmpvar_74;
|
||
|
tmpvar_74 = min (lumaNw_50, lumaSw_49);
|
||
|
highp float tmpvar_75;
|
||
|
tmpvar_75 = tmpvar_74;
|
||
|
lumaMinNwSw_43 = tmpvar_75;
|
||
|
highp float tmpvar_76;
|
||
|
tmpvar_76 = max (lumaNe_48, lumaSe_47);
|
||
|
highp float tmpvar_77;
|
||
|
tmpvar_77 = tmpvar_76;
|
||
|
lumaMaxNeSe_42 = tmpvar_77;
|
||
|
highp float tmpvar_78;
|
||
|
tmpvar_78 = min (lumaNe_48, lumaSe_47);
|
||
|
highp float tmpvar_79;
|
||
|
tmpvar_79 = tmpvar_78;
|
||
|
lumaMinNeSe_41 = tmpvar_79;
|
||
|
highp float tmpvar_80;
|
||
|
tmpvar_80 = max (lumaMaxNeSe_42, lumaMaxNwSw_44);
|
||
|
highp float tmpvar_81;
|
||
|
tmpvar_81 = tmpvar_80;
|
||
|
lumaMax_40 = tmpvar_81;
|
||
|
highp float tmpvar_82;
|
||
|
tmpvar_82 = min (lumaMinNeSe_41, lumaMinNwSw_43);
|
||
|
highp float tmpvar_83;
|
||
|
tmpvar_83 = tmpvar_82;
|
||
|
lumaMin_39 = tmpvar_83;
|
||
|
highp float tmpvar_84;
|
||
|
tmpvar_84 = (lumaMax_40 * fxaaConsoleEdgeThreshold_18);
|
||
|
lumaMaxScaled_38 = tmpvar_84;
|
||
|
highp float tmpvar_85;
|
||
|
tmpvar_85 = min (lumaMin_39, lumaM_45);
|
||
|
highp float tmpvar_86;
|
||
|
tmpvar_86 = tmpvar_85;
|
||
|
lumaMinM_37 = tmpvar_86;
|
||
|
highp float tmpvar_87;
|
||
|
tmpvar_87 = max (fxaaConsoleEdgeThresholdMin_19, lumaMaxScaled_38);
|
||
|
highp float tmpvar_88;
|
||
|
tmpvar_88 = tmpvar_87;
|
||
|
lumaMaxScaledClamped_36 = tmpvar_88;
|
||
|
highp float tmpvar_89;
|
||
|
tmpvar_89 = max (lumaMax_40, lumaM_45);
|
||
|
highp float tmpvar_90;
|
||
|
tmpvar_90 = tmpvar_89;
|
||
|
lumaMaxM_35 = tmpvar_90;
|
||
|
highp float tmpvar_91;
|
||
|
tmpvar_91 = (lumaSw_49 - lumaNe_48);
|
||
|
dirSwMinusNe_34 = tmpvar_91;
|
||
|
highp float tmpvar_92;
|
||
|
tmpvar_92 = (lumaMaxM_35 - lumaMinM_37);
|
||
|
lumaMaxSubMinM_33 = tmpvar_92;
|
||
|
highp float tmpvar_93;
|
||
|
tmpvar_93 = (lumaSe_47 - lumaNw_50);
|
||
|
dirSeMinusNw_32 = tmpvar_93;
|
||
|
if ((lumaMaxSubMinM_33 < lumaMaxScaledClamped_36)) {
|
||
|
return rgbyM_46;
|
||
|
};
|
||
|
highp float tmpvar_94;
|
||
|
tmpvar_94 = (dirSwMinusNe_34 + dirSeMinusNw_32);
|
||
|
dir_31.x = tmpvar_94;
|
||
|
highp float tmpvar_95;
|
||
|
tmpvar_95 = (dirSwMinusNe_34 - dirSeMinusNw_32);
|
||
|
dir_31.y = vec2(tmpvar_95).y;
|
||
|
highp vec2 tmpvar_96;
|
||
|
tmpvar_96 = normalize (dir_31.xy);
|
||
|
highp vec2 tmpvar_97;
|
||
|
tmpvar_97 = tmpvar_96;
|
||
|
dir1_30 = tmpvar_97;
|
||
|
highp vec4 tmpvar_98;
|
||
|
tmpvar_98.zw = vec2(0.0, 0.0);
|
||
|
tmpvar_98.xy = (pos_5.xy - (dir1_30 * fxaaConsoleRcpFrameOpt_11.zw)).xy;
|
||
|
vec4 tmpvar_99;
|
||
|
tmpvar_99 = xll_tex2Dlod (tex_7, tmpvar_98);
|
||
|
vec4 tmpvar_100;
|
||
|
tmpvar_100 = tmpvar_99;
|
||
|
rgbyN1_29 = tmpvar_100;
|
||
|
highp vec4 tmpvar_101;
|
||
|
tmpvar_101.zw = vec2(0.0, 0.0);
|
||
|
tmpvar_101.xy = (pos_5.xy + (dir1_30 * fxaaConsoleRcpFrameOpt_11.zw)).xy;
|
||
|
vec4 tmpvar_102;
|
||
|
tmpvar_102 = xll_tex2Dlod (tex_7, tmpvar_101);
|
||
|
vec4 tmpvar_103;
|
||
|
tmpvar_103 = tmpvar_102;
|
||
|
rgbyP1_28 = tmpvar_103;
|
||
|
highp float tmpvar_104;
|
||
|
tmpvar_104 = abs (dir1_30.x);
|
||
|
highp float tmpvar_105;
|
||
|
tmpvar_105 = abs (dir1_30.y);
|
||
|
highp float tmpvar_106;
|
||
|
tmpvar_106 = min (tmpvar_104, tmpvar_105);
|
||
|
highp float tmpvar_107;
|
||
|
tmpvar_107 = (tmpvar_106 * fxaaConsoleEdgeSharpness_17);
|
||
|
dirAbsMinTimesC_27 = tmpvar_107;
|
||
|
highp vec2 tmpvar_108;
|
||
|
tmpvar_108 = clamp ((dir1_30.xy / dirAbsMinTimesC_27), vec2(-2.0, -2.0), vec2(2.0, 2.0));
|
||
|
highp vec2 tmpvar_109;
|
||
|
tmpvar_109 = tmpvar_108;
|
||
|
dir2_26 = tmpvar_109;
|
||
|
highp vec4 tmpvar_110;
|
||
|
tmpvar_110.zw = vec2(0.0, 0.0);
|
||
|
tmpvar_110.xy = (pos_5.xy - (dir2_26 * fxaaConsoleRcpFrameOpt2_12.zw)).xy;
|
||
|
vec4 tmpvar_111;
|
||
|
tmpvar_111 = xll_tex2Dlod (tex_7, tmpvar_110);
|
||
|
vec4 tmpvar_112;
|
||
|
tmpvar_112 = tmpvar_111;
|
||
|
rgbyN2_25 = tmpvar_112;
|
||
|
highp vec4 tmpvar_113;
|
||
|
tmpvar_113.zw = vec2(0.0, 0.0);
|
||
|
tmpvar_113.xy = (pos_5.xy + (dir2_26 * fxaaConsoleRcpFrameOpt2_12.zw)).xy;
|
||
|
vec4 tmpvar_114;
|
||
|
tmpvar_114 = xll_tex2Dlod (tex_7, tmpvar_113);
|
||
|
vec4 tmpvar_115;
|
||
|
tmpvar_115 = tmpvar_114;
|
||
|
rgbyP2_24 = tmpvar_115;
|
||
|
lowp vec4 tmpvar_116;
|
||
|
tmpvar_116 = (rgbyN1_29 + rgbyP1_28);
|
||
|
rgbyA_23 = tmpvar_116;
|
||
|
lowp vec4 tmpvar_117;
|
||
|
tmpvar_117 = (((rgbyN2_25 + rgbyP2_24) * 0.25) + (rgbyA_23 * 0.25));
|
||
|
rgbyB_22 = tmpvar_117;
|
||
|
bool tmpvar_118;
|
||
|
tmpvar_118 = ((rgbyB_22.y < lumaMin_39) || (rgbyB_22.y > lumaMax_40));
|
||
|
twoTap_21 = tmpvar_118;
|
||
|
if (twoTap_21) {
|
||
|
lowp vec3 tmpvar_119;
|
||
|
tmpvar_119 = (rgbyA_23.xyz * 0.5);
|
||
|
rgbyB_22.xyz = tmpvar_119.xyz.xyz;
|
||
|
};
|
||
|
return rgbyB_22;
|
||
|
}
|
||
|
|
||
|
lowp vec4 xlat_main (
|
||
|
in v2f i_120
|
||
|
)
|
||
|
{
|
||
|
highp float fxaaN_121;
|
||
|
float tmpvar_122;
|
||
|
tmpvar_122 = 0.5;
|
||
|
fxaaN_121 = tmpvar_122;
|
||
|
highp vec4 tmpvar_123;
|
||
|
tmpvar_123.x = -(fxaaN_121);
|
||
|
tmpvar_123.y = -(fxaaN_121);
|
||
|
tmpvar_123.z = fxaaN_121;
|
||
|
tmpvar_123.w = fxaaN_121;
|
||
|
lowp vec4 tmpvar_124;
|
||
|
tmpvar_124 = FxaaPixelShader (i_120.uv, i_120.uvPosPos, _MainTex, _MainTex, _MainTex, _MainTex_TexelSize.xy, (_MainTex_TexelSize.xyxy * tmpvar_123), (_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_124;
|
||
|
}
|
||
|
|
||
|
void main ()
|
||
|
{
|
||
|
v2f xlt_i_125;
|
||
|
lowp vec4 xl_retval_126;
|
||
|
vec4 tmpvar_127;
|
||
|
tmpvar_127 = vec4(0.0, 0.0, 0.0, 0.0);
|
||
|
xlt_i_125.pos = tmpvar_127;
|
||
|
highp vec2 tmpvar_128;
|
||
|
tmpvar_128 = xlv_TEXCOORD0.xy;
|
||
|
highp vec2 tmpvar_129;
|
||
|
tmpvar_129 = tmpvar_128;
|
||
|
xlt_i_125.uv = tmpvar_129;
|
||
|
highp vec4 tmpvar_130;
|
||
|
tmpvar_130 = xlv_TEXCOORD1.xyzw;
|
||
|
highp vec4 tmpvar_131;
|
||
|
tmpvar_131 = tmpvar_130;
|
||
|
xlt_i_125.uvPosPos = tmpvar_131;
|
||
|
lowp vec4 tmpvar_132;
|
||
|
tmpvar_132 = xlat_main (xlt_i_125);
|
||
|
lowp vec4 tmpvar_133;
|
||
|
tmpvar_133 = tmpvar_132;
|
||
|
xl_retval_126 = tmpvar_133;
|
||
|
lowp vec4 tmpvar_134;
|
||
|
tmpvar_134 = xl_retval_126.xyzw;
|
||
|
lowp vec4 tmpvar_135;
|
||
|
tmpvar_135 = tmpvar_134;
|
||
|
gl_FragData[0] = tmpvar_135;
|
||
|
}
|
||
|
|