mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-12-11 00:31:28 -05:00
315 lines
8.4 KiB
Text
315 lines
8.4 KiB
Text
|
#extension GL_ARB_shader_texture_lod : enable
|
||
|
struct v2f {
|
||
|
vec4 pos;
|
||
|
vec2 uv;
|
||
|
vec4 uvPosPos;
|
||
|
};
|
||
|
varying vec4 xlv_TEXCOORD1;
|
||
|
varying vec2 xlv_TEXCOORD0;
|
||
|
varying vec4 xlv_SV_POSITION;
|
||
|
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;
|
||
|
}
|
||
|
|
||
|
float FxaaLuma (
|
||
|
in vec4 rgba_4
|
||
|
)
|
||
|
{
|
||
|
return rgba_4.y;
|
||
|
}
|
||
|
|
||
|
vec4 FxaaPixelShader (
|
||
|
in vec2 pos_5,
|
||
|
in vec4 fxaaConsolePosPos_6,
|
||
|
in sampler2D tex_7,
|
||
|
in sampler2D fxaaConsole360TexExpBiasNegOne_8,
|
||
|
in sampler2D fxaaConsole360TexExpBiasNegTwo_9,
|
||
|
in vec2 fxaaQualityRcpFrame_10,
|
||
|
in vec4 fxaaConsoleRcpFrameOpt_11,
|
||
|
in vec4 fxaaConsoleRcpFrameOpt2_12,
|
||
|
in vec4 fxaaConsole360RcpFrameOpt2_13,
|
||
|
in float fxaaQualitySubpix_14,
|
||
|
in float fxaaQualityEdgeThreshold_15,
|
||
|
in float fxaaQualityEdgeThresholdMin_16,
|
||
|
in float fxaaConsoleEdgeSharpness_17,
|
||
|
in float fxaaConsoleEdgeThreshold_18,
|
||
|
in float fxaaConsoleEdgeThresholdMin_19,
|
||
|
in vec4 fxaaConsole360ConstDir_20
|
||
|
)
|
||
|
{
|
||
|
bool twoTap_21;
|
||
|
vec4 rgbyB_22;
|
||
|
vec4 rgbyA_23;
|
||
|
vec4 rgbyP2_24;
|
||
|
vec4 rgbyN2_25;
|
||
|
vec2 dir2_26;
|
||
|
float dirAbsMinTimesC_27;
|
||
|
vec4 rgbyP1_28;
|
||
|
vec4 rgbyN1_29;
|
||
|
vec2 dir1_30;
|
||
|
vec2 dir_31;
|
||
|
float dirSeMinusNw_32;
|
||
|
float lumaMaxSubMinM_33;
|
||
|
float dirSwMinusNe_34;
|
||
|
float lumaMaxM_35;
|
||
|
float lumaMaxScaledClamped_36;
|
||
|
float lumaMinM_37;
|
||
|
float lumaMaxScaled_38;
|
||
|
float lumaMin_39;
|
||
|
float lumaMax_40;
|
||
|
float lumaMinNeSe_41;
|
||
|
float lumaMaxNeSe_42;
|
||
|
float lumaMinNwSw_43;
|
||
|
float lumaMaxNwSw_44;
|
||
|
float lumaM_45;
|
||
|
vec4 rgbyM_46;
|
||
|
float lumaSe_47;
|
||
|
float lumaNe_48;
|
||
|
float lumaSw_49;
|
||
|
float lumaNw_50;
|
||
|
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);
|
||
|
float tmpvar_53;
|
||
|
tmpvar_53 = FxaaLuma (tmpvar_52);
|
||
|
float tmpvar_54;
|
||
|
tmpvar_54 = tmpvar_53;
|
||
|
lumaNw_50 = tmpvar_54;
|
||
|
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);
|
||
|
float tmpvar_57;
|
||
|
tmpvar_57 = FxaaLuma (tmpvar_56);
|
||
|
float tmpvar_58;
|
||
|
tmpvar_58 = tmpvar_57;
|
||
|
lumaSw_49 = tmpvar_58;
|
||
|
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);
|
||
|
float tmpvar_61;
|
||
|
tmpvar_61 = FxaaLuma (tmpvar_60);
|
||
|
float tmpvar_62;
|
||
|
tmpvar_62 = tmpvar_61;
|
||
|
lumaNe_48 = tmpvar_62;
|
||
|
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);
|
||
|
float tmpvar_65;
|
||
|
tmpvar_65 = FxaaLuma (tmpvar_64);
|
||
|
float tmpvar_66;
|
||
|
tmpvar_66 = tmpvar_65;
|
||
|
lumaSe_47 = tmpvar_66;
|
||
|
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;
|
||
|
float tmpvar_70;
|
||
|
tmpvar_70 = rgbyM_46.y;
|
||
|
lumaM_45 = tmpvar_70;
|
||
|
float tmpvar_71;
|
||
|
tmpvar_71 = max (lumaNw_50, lumaSw_49);
|
||
|
float tmpvar_72;
|
||
|
tmpvar_72 = tmpvar_71;
|
||
|
lumaMaxNwSw_44 = tmpvar_72;
|
||
|
float tmpvar_73;
|
||
|
tmpvar_73 = (lumaNe_48 + 0.00260417);
|
||
|
lumaNe_48 = tmpvar_73;
|
||
|
float tmpvar_74;
|
||
|
tmpvar_74 = min (lumaNw_50, lumaSw_49);
|
||
|
float tmpvar_75;
|
||
|
tmpvar_75 = tmpvar_74;
|
||
|
lumaMinNwSw_43 = tmpvar_75;
|
||
|
float tmpvar_76;
|
||
|
tmpvar_76 = max (lumaNe_48, lumaSe_47);
|
||
|
float tmpvar_77;
|
||
|
tmpvar_77 = tmpvar_76;
|
||
|
lumaMaxNeSe_42 = tmpvar_77;
|
||
|
float tmpvar_78;
|
||
|
tmpvar_78 = min (lumaNe_48, lumaSe_47);
|
||
|
float tmpvar_79;
|
||
|
tmpvar_79 = tmpvar_78;
|
||
|
lumaMinNeSe_41 = tmpvar_79;
|
||
|
float tmpvar_80;
|
||
|
tmpvar_80 = max (lumaMaxNeSe_42, lumaMaxNwSw_44);
|
||
|
float tmpvar_81;
|
||
|
tmpvar_81 = tmpvar_80;
|
||
|
lumaMax_40 = tmpvar_81;
|
||
|
float tmpvar_82;
|
||
|
tmpvar_82 = min (lumaMinNeSe_41, lumaMinNwSw_43);
|
||
|
float tmpvar_83;
|
||
|
tmpvar_83 = tmpvar_82;
|
||
|
lumaMin_39 = tmpvar_83;
|
||
|
float tmpvar_84;
|
||
|
tmpvar_84 = (lumaMax_40 * fxaaConsoleEdgeThreshold_18);
|
||
|
lumaMaxScaled_38 = tmpvar_84;
|
||
|
float tmpvar_85;
|
||
|
tmpvar_85 = min (lumaMin_39, lumaM_45);
|
||
|
float tmpvar_86;
|
||
|
tmpvar_86 = tmpvar_85;
|
||
|
lumaMinM_37 = tmpvar_86;
|
||
|
float tmpvar_87;
|
||
|
tmpvar_87 = max (fxaaConsoleEdgeThresholdMin_19, lumaMaxScaled_38);
|
||
|
float tmpvar_88;
|
||
|
tmpvar_88 = tmpvar_87;
|
||
|
lumaMaxScaledClamped_36 = tmpvar_88;
|
||
|
float tmpvar_89;
|
||
|
tmpvar_89 = max (lumaMax_40, lumaM_45);
|
||
|
float tmpvar_90;
|
||
|
tmpvar_90 = tmpvar_89;
|
||
|
lumaMaxM_35 = tmpvar_90;
|
||
|
float tmpvar_91;
|
||
|
tmpvar_91 = (lumaSw_49 - lumaNe_48);
|
||
|
dirSwMinusNe_34 = tmpvar_91;
|
||
|
float tmpvar_92;
|
||
|
tmpvar_92 = (lumaMaxM_35 - lumaMinM_37);
|
||
|
lumaMaxSubMinM_33 = tmpvar_92;
|
||
|
float tmpvar_93;
|
||
|
tmpvar_93 = (lumaSe_47 - lumaNw_50);
|
||
|
dirSeMinusNw_32 = tmpvar_93;
|
||
|
if ((lumaMaxSubMinM_33 < lumaMaxScaledClamped_36)) {
|
||
|
return rgbyM_46;
|
||
|
};
|
||
|
float tmpvar_94;
|
||
|
tmpvar_94 = (dirSwMinusNe_34 + dirSeMinusNw_32);
|
||
|
dir_31.x = tmpvar_94;
|
||
|
float tmpvar_95;
|
||
|
tmpvar_95 = (dirSwMinusNe_34 - dirSeMinusNw_32);
|
||
|
dir_31.y = vec2(tmpvar_95).y;
|
||
|
vec2 tmpvar_96;
|
||
|
tmpvar_96 = normalize (dir_31.xy);
|
||
|
vec2 tmpvar_97;
|
||
|
tmpvar_97 = tmpvar_96;
|
||
|
dir1_30 = tmpvar_97;
|
||
|
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;
|
||
|
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;
|
||
|
float tmpvar_104;
|
||
|
tmpvar_104 = abs (dir1_30.x);
|
||
|
float tmpvar_105;
|
||
|
tmpvar_105 = abs (dir1_30.y);
|
||
|
float tmpvar_106;
|
||
|
tmpvar_106 = min (tmpvar_104, tmpvar_105);
|
||
|
float tmpvar_107;
|
||
|
tmpvar_107 = (tmpvar_106 * fxaaConsoleEdgeSharpness_17);
|
||
|
dirAbsMinTimesC_27 = tmpvar_107;
|
||
|
vec2 tmpvar_108;
|
||
|
tmpvar_108 = clamp ((dir1_30.xy / dirAbsMinTimesC_27), vec2(-2.0, -2.0), vec2(2.0, 2.0));
|
||
|
vec2 tmpvar_109;
|
||
|
tmpvar_109 = tmpvar_108;
|
||
|
dir2_26 = tmpvar_109;
|
||
|
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;
|
||
|
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;
|
||
|
vec4 tmpvar_116;
|
||
|
tmpvar_116 = (rgbyN1_29 + rgbyP1_28);
|
||
|
rgbyA_23 = tmpvar_116;
|
||
|
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) {
|
||
|
vec3 tmpvar_119;
|
||
|
tmpvar_119 = (rgbyA_23.xyz * 0.5);
|
||
|
rgbyB_22.xyz = tmpvar_119.xyz.xyz;
|
||
|
};
|
||
|
return rgbyB_22;
|
||
|
}
|
||
|
|
||
|
vec4 xlat_main (
|
||
|
in v2f i_120
|
||
|
)
|
||
|
{
|
||
|
float fxaaN_121;
|
||
|
float tmpvar_122;
|
||
|
tmpvar_122 = 0.5;
|
||
|
fxaaN_121 = tmpvar_122;
|
||
|
vec4 tmpvar_123;
|
||
|
tmpvar_123.x = -(fxaaN_121);
|
||
|
tmpvar_123.y = -(fxaaN_121);
|
||
|
tmpvar_123.z = fxaaN_121;
|
||
|
tmpvar_123.w = fxaaN_121;
|
||
|
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;
|
||
|
vec4 xl_retval_126;
|
||
|
vec4 tmpvar_127;
|
||
|
tmpvar_127 = xlv_SV_POSITION.xyzw;
|
||
|
vec4 tmpvar_128;
|
||
|
tmpvar_128 = tmpvar_127;
|
||
|
xlt_i_125.pos = tmpvar_128;
|
||
|
vec2 tmpvar_129;
|
||
|
tmpvar_129 = xlv_TEXCOORD0.xy;
|
||
|
vec2 tmpvar_130;
|
||
|
tmpvar_130 = tmpvar_129;
|
||
|
xlt_i_125.uv = tmpvar_130;
|
||
|
vec4 tmpvar_131;
|
||
|
tmpvar_131 = xlv_TEXCOORD1.xyzw;
|
||
|
vec4 tmpvar_132;
|
||
|
tmpvar_132 = tmpvar_131;
|
||
|
xlt_i_125.uvPosPos = tmpvar_132;
|
||
|
vec4 tmpvar_133;
|
||
|
tmpvar_133 = xlat_main (xlt_i_125);
|
||
|
vec4 tmpvar_134;
|
||
|
tmpvar_134 = tmpvar_133;
|
||
|
xl_retval_126 = tmpvar_134;
|
||
|
vec4 tmpvar_135;
|
||
|
tmpvar_135 = xl_retval_126.xyzw;
|
||
|
vec4 tmpvar_136;
|
||
|
tmpvar_136 = tmpvar_135;
|
||
|
gl_FragData[0] = tmpvar_136;
|
||
|
}
|
||
|
|