mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-29 02:55:36 -05:00
294 lines
8.9 KiB
Text
294 lines
8.9 KiB
Text
#extension GL_ARB_shader_texture_lod : enable
|
|
uniform sampler2D _MainTex;
|
|
uniform vec4 _MainTex_TexelSize;
|
|
varying vec2 xlv_TEXCOORD0;
|
|
void main ()
|
|
{
|
|
vec2 rcpFrame_1;
|
|
rcpFrame_1 = _MainTex_TexelSize.xy;
|
|
vec3 tmpvar_2;
|
|
float subPixelOffset_3;
|
|
float spanLength_4;
|
|
bool directionN_5;
|
|
bool doneP_7;
|
|
bool doneN_8;
|
|
float lumaEndP_9;
|
|
float lumaEndN_10;
|
|
vec2 offNP_11;
|
|
vec2 posP_12;
|
|
vec2 posN_13;
|
|
bool pairN_14;
|
|
float gradientN_15;
|
|
float lengthSign_16;
|
|
bool horzSpan_17;
|
|
float blendL_18;
|
|
vec3 rgbL_19;
|
|
float range_20;
|
|
float lumaS_21;
|
|
float lumaN_22;
|
|
doneN_8 = bool(0);
|
|
doneP_7 = bool(0);
|
|
vec4 tmpvar_23;
|
|
tmpvar_23.zw = vec2(0.0, 0.0);
|
|
tmpvar_23.xy = (xlv_TEXCOORD0 + (vec2(0.0, -1.0) * _MainTex_TexelSize.xy));
|
|
vec4 tmpvar_24;
|
|
tmpvar_24 = texture2DLod (_MainTex, tmpvar_23.xy, 0.0);
|
|
vec4 tmpvar_25;
|
|
tmpvar_25.zw = vec2(0.0, 0.0);
|
|
tmpvar_25.xy = (xlv_TEXCOORD0 + (vec2(-1.0, 0.0) * _MainTex_TexelSize.xy));
|
|
vec4 tmpvar_26;
|
|
tmpvar_26 = texture2DLod (_MainTex, tmpvar_25.xy, 0.0);
|
|
vec4 tmpvar_27;
|
|
tmpvar_27 = texture2DLod (_MainTex, xlv_TEXCOORD0, 0.0);
|
|
vec4 tmpvar_28;
|
|
tmpvar_28.zw = vec2(0.0, 0.0);
|
|
tmpvar_28.xy = (xlv_TEXCOORD0 + (vec2(1.0, 0.0) * _MainTex_TexelSize.xy));
|
|
vec4 tmpvar_29;
|
|
tmpvar_29 = texture2DLod (_MainTex, tmpvar_28.xy, 0.0);
|
|
vec4 tmpvar_30;
|
|
tmpvar_30.zw = vec2(0.0, 0.0);
|
|
tmpvar_30.xy = (xlv_TEXCOORD0 + (vec2(0.0, 1.0) * _MainTex_TexelSize.xy));
|
|
vec4 tmpvar_31;
|
|
tmpvar_31 = texture2DLod (_MainTex, tmpvar_30.xy, 0.0);
|
|
float tmpvar_32;
|
|
tmpvar_32 = ((tmpvar_24.y * 1.96321) + tmpvar_24.x);
|
|
lumaN_22 = tmpvar_32;
|
|
float tmpvar_33;
|
|
tmpvar_33 = ((tmpvar_26.y * 1.96321) + tmpvar_26.x);
|
|
float tmpvar_34;
|
|
tmpvar_34 = ((tmpvar_27.y * 1.96321) + tmpvar_27.x);
|
|
float tmpvar_35;
|
|
tmpvar_35 = ((tmpvar_29.y * 1.96321) + tmpvar_29.x);
|
|
float tmpvar_36;
|
|
tmpvar_36 = ((tmpvar_31.y * 1.96321) + tmpvar_31.x);
|
|
lumaS_21 = tmpvar_36;
|
|
float tmpvar_37;
|
|
tmpvar_37 = max (max (tmpvar_34, tmpvar_32), max (max (tmpvar_33, tmpvar_36), tmpvar_35));
|
|
range_20 = (tmpvar_37 - min (min (tmpvar_34, tmpvar_32), min (
|
|
min (tmpvar_33, tmpvar_36)
|
|
, tmpvar_35)));
|
|
float tmpvar_38;
|
|
tmpvar_38 = max (0.0625, (tmpvar_37 * 0.125));
|
|
if ((range_20 < tmpvar_38)) {
|
|
tmpvar_2 = tmpvar_27.xyz;
|
|
} else {
|
|
rgbL_19 = ((tmpvar_24.xyz + tmpvar_26.xyz) + ((tmpvar_27.xyz + tmpvar_29.xyz) + tmpvar_31.xyz));
|
|
blendL_18 = (max (0.0, (
|
|
(abs(((
|
|
((tmpvar_32 + tmpvar_33) + (tmpvar_35 + tmpvar_36))
|
|
* 0.25) - tmpvar_34)) / range_20)
|
|
- 0.25)) * 1.33333);
|
|
float tmpvar_39;
|
|
tmpvar_39 = min (0.75, blendL_18);
|
|
blendL_18 = tmpvar_39;
|
|
vec4 tmpvar_40;
|
|
tmpvar_40.zw = vec2(0.0, 0.0);
|
|
tmpvar_40.xy = (xlv_TEXCOORD0 - _MainTex_TexelSize.xy);
|
|
vec4 tmpvar_41;
|
|
tmpvar_41 = texture2DLod (_MainTex, tmpvar_40.xy, 0.0);
|
|
vec4 tmpvar_42;
|
|
tmpvar_42.zw = vec2(0.0, 0.0);
|
|
tmpvar_42.xy = (xlv_TEXCOORD0 + (vec2(1.0, -1.0) * _MainTex_TexelSize.xy));
|
|
vec4 tmpvar_43;
|
|
tmpvar_43 = texture2DLod (_MainTex, tmpvar_42.xy, 0.0);
|
|
vec4 tmpvar_44;
|
|
tmpvar_44.zw = vec2(0.0, 0.0);
|
|
tmpvar_44.xy = (xlv_TEXCOORD0 + (vec2(-1.0, 1.0) * _MainTex_TexelSize.xy));
|
|
vec4 tmpvar_45;
|
|
tmpvar_45 = texture2DLod (_MainTex, tmpvar_44.xy, 0.0);
|
|
vec4 tmpvar_46;
|
|
tmpvar_46.zw = vec2(0.0, 0.0);
|
|
tmpvar_46.xy = (xlv_TEXCOORD0 + _MainTex_TexelSize.xy);
|
|
vec4 tmpvar_47;
|
|
tmpvar_47 = texture2DLod (_MainTex, tmpvar_46.xy, 0.0);
|
|
rgbL_19 = ((rgbL_19 + tmpvar_41.xyz) + ((tmpvar_43.xyz + tmpvar_45.xyz) + tmpvar_47.xyz));
|
|
rgbL_19 = (rgbL_19 * vec3(0.111111, 0.111111, 0.111111));
|
|
float tmpvar_48;
|
|
tmpvar_48 = ((tmpvar_41.y * 1.96321) + tmpvar_41.x);
|
|
float tmpvar_49;
|
|
tmpvar_49 = ((tmpvar_43.y * 1.96321) + tmpvar_43.x);
|
|
float tmpvar_50;
|
|
tmpvar_50 = ((tmpvar_45.y * 1.96321) + tmpvar_45.x);
|
|
float tmpvar_51;
|
|
tmpvar_51 = ((tmpvar_47.y * 1.96321) + tmpvar_47.x);
|
|
horzSpan_17 = (((
|
|
abs((((0.25 * tmpvar_48) + (-0.5 * tmpvar_33)) + (0.25 * tmpvar_50)))
|
|
+
|
|
abs((((0.5 * tmpvar_32) - tmpvar_34) + (0.5 * tmpvar_36)))
|
|
) + abs(
|
|
(((0.25 * tmpvar_49) + (-0.5 * tmpvar_35)) + (0.25 * tmpvar_51))
|
|
)) >= ((
|
|
abs((((0.25 * tmpvar_48) + (-0.5 * tmpvar_32)) + (0.25 * tmpvar_49)))
|
|
+
|
|
abs((((0.5 * tmpvar_33) - tmpvar_34) + (0.5 * tmpvar_35)))
|
|
) + abs(
|
|
(((0.25 * tmpvar_50) + (-0.5 * tmpvar_36)) + (0.25 * tmpvar_51))
|
|
)));
|
|
float tmpvar_52;
|
|
if (horzSpan_17) {
|
|
tmpvar_52 = -(_MainTex_TexelSize.y);
|
|
} else {
|
|
tmpvar_52 = -(_MainTex_TexelSize.x);
|
|
};
|
|
lengthSign_16 = tmpvar_52;
|
|
if (!(horzSpan_17)) {
|
|
lumaN_22 = tmpvar_33;
|
|
};
|
|
if (!(horzSpan_17)) {
|
|
lumaS_21 = tmpvar_35;
|
|
};
|
|
float tmpvar_53;
|
|
tmpvar_53 = abs((lumaN_22 - tmpvar_34));
|
|
gradientN_15 = tmpvar_53;
|
|
float tmpvar_54;
|
|
tmpvar_54 = abs((lumaS_21 - tmpvar_34));
|
|
lumaN_22 = ((lumaN_22 + tmpvar_34) * 0.5);
|
|
lumaS_21 = ((lumaS_21 + tmpvar_34) * 0.5);
|
|
pairN_14 = (tmpvar_53 >= tmpvar_54);
|
|
if (!(pairN_14)) {
|
|
lumaN_22 = lumaS_21;
|
|
};
|
|
if (!(pairN_14)) {
|
|
gradientN_15 = tmpvar_54;
|
|
};
|
|
if (!(pairN_14)) {
|
|
lengthSign_16 = -(tmpvar_52);
|
|
};
|
|
float tmpvar_55;
|
|
if (horzSpan_17) {
|
|
tmpvar_55 = 0.0;
|
|
} else {
|
|
tmpvar_55 = (lengthSign_16 * 0.5);
|
|
};
|
|
posN_13.x = (xlv_TEXCOORD0.x + tmpvar_55);
|
|
float tmpvar_56;
|
|
if (horzSpan_17) {
|
|
tmpvar_56 = (lengthSign_16 * 0.5);
|
|
} else {
|
|
tmpvar_56 = 0.0;
|
|
};
|
|
posN_13.y = (xlv_TEXCOORD0.y + tmpvar_56);
|
|
gradientN_15 = (gradientN_15 * 0.25);
|
|
posP_12 = posN_13;
|
|
vec2 tmpvar_57;
|
|
if (horzSpan_17) {
|
|
vec2 tmpvar_58;
|
|
tmpvar_58.y = 0.0;
|
|
tmpvar_58.x = rcpFrame_1.x;
|
|
tmpvar_57 = tmpvar_58;
|
|
} else {
|
|
vec2 tmpvar_59;
|
|
tmpvar_59.x = 0.0;
|
|
tmpvar_59.y = rcpFrame_1.y;
|
|
tmpvar_57 = tmpvar_59;
|
|
};
|
|
lumaEndN_10 = lumaN_22;
|
|
lumaEndP_9 = lumaN_22;
|
|
posN_13 = (posN_13 + (tmpvar_57 * vec2(-2.0, -2.0)));
|
|
posP_12 = (posP_12 + (tmpvar_57 * vec2(2.0, 2.0)));
|
|
offNP_11 = (tmpvar_57 * vec2(3.0, 3.0));
|
|
for (int i_6; i_6 < 4; i_6++) {
|
|
if (!(doneN_8)) {
|
|
vec4 tmpvar_60;
|
|
tmpvar_60 = texture2DGradARB (_MainTex, posN_13, offNP_11, offNP_11);
|
|
lumaEndN_10 = ((tmpvar_60.y * 1.96321) + tmpvar_60.x);
|
|
};
|
|
if (!(doneP_7)) {
|
|
vec4 tmpvar_61;
|
|
tmpvar_61 = texture2DGradARB (_MainTex, posP_12, offNP_11, offNP_11);
|
|
lumaEndP_9 = ((tmpvar_61.y * 1.96321) + tmpvar_61.x);
|
|
};
|
|
bool tmpvar_62;
|
|
if (doneN_8) {
|
|
tmpvar_62 = bool(1);
|
|
} else {
|
|
tmpvar_62 = (abs((lumaEndN_10 - lumaN_22)) >= gradientN_15);
|
|
};
|
|
doneN_8 = tmpvar_62;
|
|
bool tmpvar_63;
|
|
if (doneP_7) {
|
|
tmpvar_63 = bool(1);
|
|
} else {
|
|
tmpvar_63 = (abs((lumaEndP_9 - lumaN_22)) >= gradientN_15);
|
|
};
|
|
doneP_7 = tmpvar_63;
|
|
if ((tmpvar_62 && tmpvar_63)) {
|
|
break;
|
|
};
|
|
if (!(tmpvar_62)) {
|
|
posN_13 = (posN_13 - offNP_11);
|
|
};
|
|
if (!(tmpvar_63)) {
|
|
posP_12 = (posP_12 + offNP_11);
|
|
};
|
|
};
|
|
float tmpvar_64;
|
|
if (horzSpan_17) {
|
|
tmpvar_64 = (xlv_TEXCOORD0.x - posN_13.x);
|
|
} else {
|
|
tmpvar_64 = (xlv_TEXCOORD0.y - posN_13.y);
|
|
};
|
|
float tmpvar_65;
|
|
if (horzSpan_17) {
|
|
tmpvar_65 = (posP_12.x - xlv_TEXCOORD0.x);
|
|
} else {
|
|
tmpvar_65 = (posP_12.y - xlv_TEXCOORD0.y);
|
|
};
|
|
directionN_5 = (tmpvar_64 < tmpvar_65);
|
|
float tmpvar_66;
|
|
if (directionN_5) {
|
|
tmpvar_66 = lumaEndN_10;
|
|
} else {
|
|
tmpvar_66 = lumaEndP_9;
|
|
};
|
|
lumaEndN_10 = tmpvar_66;
|
|
if ((((tmpvar_34 - lumaN_22) < 0.0) == ((tmpvar_66 - lumaN_22) < 0.0))) {
|
|
lengthSign_16 = 0.0;
|
|
};
|
|
spanLength_4 = (tmpvar_65 + tmpvar_64);
|
|
float tmpvar_67;
|
|
if (directionN_5) {
|
|
tmpvar_67 = tmpvar_64;
|
|
} else {
|
|
tmpvar_67 = tmpvar_65;
|
|
};
|
|
subPixelOffset_3 = ((0.5 + (tmpvar_67 *
|
|
(-1.0 / spanLength_4)
|
|
)) * lengthSign_16);
|
|
float tmpvar_68;
|
|
if (horzSpan_17) {
|
|
tmpvar_68 = 0.0;
|
|
} else {
|
|
tmpvar_68 = subPixelOffset_3;
|
|
};
|
|
float tmpvar_69;
|
|
if (horzSpan_17) {
|
|
tmpvar_69 = subPixelOffset_3;
|
|
} else {
|
|
tmpvar_69 = 0.0;
|
|
};
|
|
vec2 tmpvar_70;
|
|
tmpvar_70.x = (xlv_TEXCOORD0.x + tmpvar_68);
|
|
tmpvar_70.y = (xlv_TEXCOORD0.y + tmpvar_69);
|
|
vec4 tmpvar_71;
|
|
tmpvar_71 = texture2DLod (_MainTex, tmpvar_70, 0.0);
|
|
vec3 tmpvar_72;
|
|
tmpvar_72.x = -(tmpvar_39);
|
|
tmpvar_72.y = -(tmpvar_39);
|
|
tmpvar_72.z = -(tmpvar_39);
|
|
tmpvar_2 = ((tmpvar_72 * tmpvar_71.xyz) + ((rgbL_19 * vec3(tmpvar_39)) + tmpvar_71.xyz));
|
|
};
|
|
vec4 tmpvar_73;
|
|
tmpvar_73.w = 0.0;
|
|
tmpvar_73.xyz = tmpvar_2;
|
|
gl_FragData[0] = tmpvar_73;
|
|
}
|
|
|
|
|
|
// stats: 194 alu 12 tex 26 flow
|
|
// inputs: 1
|
|
// #0: xlv_TEXCOORD0 (high float) 2x1 [-1]
|
|
// uniforms: 1 (total size: 0)
|
|
// #0: _MainTex_TexelSize (high float) 4x1 [-1]
|
|
// textures: 1
|
|
// #0: _MainTex (high 2d) 0x0 [-1]
|