all repos — mgba @ c5f4b6ead2faba89851e8c104e9791992dfbbfbb

mGBA Game Boy Advance Emulator

res/shaders/xbr.shader/xbr.fs (view raw)

  1/*
  2   Hyllian's xBR-lv3 Shader
  3   
  4   Copyright (C) 2011-2015 Hyllian - sergiogdb@gmail.com
  5
  6   Permission is hereby granted, free of charge, to any person obtaining a copy
  7   of this software and associated documentation files (the "Software"), to deal
  8   in the Software without restriction, including without limitation the rights
  9   to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 10   copies of the Software, and to permit persons to whom the Software is
 11   furnished to do so, subject to the following conditions:
 12
 13   The above copyright notice and this permission notice shall be included in
 14   all copies or substantial portions of the Software.
 15
 16   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 17   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 18   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 19   AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 20   LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 21   OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 22   THE SOFTWARE.
 23
 24
 25   Incorporates some of the ideas from SABR shader. Thanks to Joshua Street.
 26*/
 27// GLSL shader autogenerated by cg2glsl.py.
 28#if __VERSION__ >= 130
 29#define COMPAT_VARYING in
 30#define COMPAT_TEXTURE texture
 31out vec4 FragColor;
 32#else
 33#define COMPAT_VARYING varying
 34#define FragColor gl_FragColor
 35#define COMPAT_TEXTURE texture2D
 36#endif
 37
 38#ifdef GL_ES
 39#ifdef GL_FRAGMENT_PRECISION_HIGH
 40precision highp float;
 41#else
 42precision mediump float;
 43#endif
 44#define COMPAT_PRECISION mediump
 45#else
 46#define COMPAT_PRECISION
 47#endif
 48COMPAT_VARYING     vec4 _t7;
 49COMPAT_VARYING     vec4 _t6;
 50COMPAT_VARYING     vec4 _t5;
 51COMPAT_VARYING     vec4 _t4;
 52COMPAT_VARYING     vec4 _t3;
 53COMPAT_VARYING     vec4 _t2;
 54COMPAT_VARYING     vec4 _t1;
 55vec4 _ret_0;
 56float _TMP57;
 57float _TMP56;
 58float _TMP55;
 59vec3 _TMP54;
 60vec3 _TMP53;
 61vec3 _TMP52;
 62vec3 _TMP51;
 63vec3 _TMP50;
 64vec3 _TMP49;
 65vec3 _TMP48;
 66vec3 _TMP47;
 67vec4 _TMP46;
 68vec4 _TMP45;
 69vec4 _TMP44;
 70vec4 _TMP37;
 71vec4 _TMP36;
 72vec4 _TMP65;
 73bvec4 _TMP35;
 74bvec4 _TMP34;
 75bvec4 _TMP33;
 76bvec4 _TMP32;
 77bvec4 _TMP31;
 78bvec4 _TMP30;
 79bvec4 _TMP29;
 80bvec4 _TMP28;
 81bvec4 _TMP27;
 82bvec4 _TMP26;
 83bvec4 _TMP25;
 84bvec4 _TMP24;
 85bvec4 _TMP23;
 86bvec4 _TMP22;
 87bvec4 _TMP21;
 88vec4 _TMP20;
 89vec4 _TMP19;
 90vec4 _TMP18;
 91vec4 _TMP17;
 92vec4 _TMP16;
 93vec4 _TMP15;
 94vec4 _TMP14;
 95vec4 _TMP13;
 96vec4 _TMP12;
 97vec4 _TMP11;
 98vec4 _TMP10;
 99vec4 _TMP9;
100vec4 _TMP8;
101vec4 _TMP7;
102vec4 _TMP6;
103vec4 _TMP5;
104vec4 _TMP4;
105vec4 _TMP3;
106vec4 _TMP2;
107vec4 _TMP1;
108vec4 _TMP0;
109uniform sampler2D tex;
110vec2 _x0078;
111vec4 _r0122;
112vec4 _r0132;
113vec4 _r0142;
114vec4 _r0152;
115vec4 _r0162;
116vec4 _r0172;
117vec4 _TMP183;
118vec4 _a0186;
119vec4 _TMP189;
120vec4 _a0192;
121vec4 _TMP195;
122vec4 _a0198;
123vec4 _TMP201;
124vec4 _a0204;
125vec4 _TMP207;
126vec4 _a0210;
127vec4 _TMP213;
128vec4 _a0216;
129vec4 _TMP219;
130vec4 _a0222;
131vec4 _TMP225;
132vec4 _a0228;
133vec4 _TMP231;
134vec4 _a0234;
135vec4 _TMP237;
136vec4 _a0240;
137vec4 _TMP243;
138vec4 _a0246;
139vec4 _TMP249;
140vec4 _a0252;
141vec4 _TMP255;
142vec4 _a0258;
143vec4 _TMP261;
144vec4 _a0264;
145vec4 _TMP267;
146vec4 _a0270;
147vec4 _x0274;
148vec4 _TMP275;
149vec4 _x0284;
150vec4 _TMP285;
151vec4 _x0294;
152vec4 _TMP295;
153vec4 _x0304;
154vec4 _TMP305;
155vec4 _x0314;
156vec4 _TMP315;
157vec4 _TMP323;
158vec4 _a0326;
159vec4 _TMP327;
160vec4 _a0330;
161vec4 _TMP331;
162vec4 _a0334;
163vec4 _TMP335;
164vec4 _a0338;
165vec4 _TMP339;
166vec4 _a0342;
167vec4 _TMP345;
168vec4 _a0348;
169vec4 _TMP349;
170vec4 _a0352;
171vec4 _TMP353;
172vec4 _a0356;
173vec4 _TMP357;
174vec4 _a0360;
175vec4 _TMP361;
176vec4 _a0364;
177vec4 _TMP365;
178vec4 _a0368;
179vec4 _TMP369;
180vec4 _a0372;
181vec4 _TMP373;
182vec4 _a0376;
183vec4 _TMP377;
184vec4 _a0380;
185vec4 _TMP381;
186vec4 _a0384;
187vec4 _TMP385;
188vec4 _a0388;
189vec3 _df0402;
190vec3 _a0404;
191vec3 _df0406;
192vec3 _a0408;
193COMPAT_VARYING vec4 TEX0;
194COMPAT_VARYING vec4 TEX1;
195COMPAT_VARYING vec4 TEX2;
196COMPAT_VARYING vec4 TEX3;
197COMPAT_VARYING vec4 TEX4;
198COMPAT_VARYING vec4 TEX5;
199COMPAT_VARYING vec4 TEX6;
200COMPAT_VARYING vec4 TEX7;
201
202const COMPAT_PRECISION vec2 TextureSize = vec2(240.0, 160.0);
203void main()
204{
205    bvec4 _edr;
206    bvec4 _edr_left;
207    bvec4 _edr_up;
208    bvec4 _px;
209    bvec4 _interp_restriction_lv1;
210    bvec4 _interp_restriction_lv2_left;
211    bvec4 _interp_restriction_lv2_up;
212    bvec4 _interp_restriction_lv3_left;
213    bvec4 _interp_restriction_lv3_up;
214    bvec4 _nc;
215    bvec4 _nc30;
216    bvec4 _nc60;
217    bvec4 _nc45;
218    bvec4 _nc15;
219    bvec4 _nc75;
220    vec4 _fx;
221    vec4 _fx_left;
222    vec4 _fx_up;
223    vec4 _fx3_left;
224    vec4 _fx3_up;
225    vec3 _res1;
226    vec3 _res2;
227    vec3 _pix1;
228    vec3 _pix2;
229    float _blend1;
230    float _blend2;
231    vec2 _fp;
232    vec4 _fx45;
233    vec4 _fx30;
234    vec4 _fx60;
235    vec4 _fx15;
236    vec4 _fx75;
237    vec4 _final45;
238    vec4 _final30;
239    vec4 _final60;
240    vec4 _final15;
241    vec4 _final75;
242    vec4 _maximo;
243    vec3 _res;
244    _x0078 = TEX0.xy*TextureSize;
245    _fp = fract(_x0078);
246    _TMP0 = COMPAT_TEXTURE(tex, TEX1.xw);
247    _TMP1 = COMPAT_TEXTURE(tex, TEX1.yw);
248    _TMP2 = COMPAT_TEXTURE(tex, TEX1.zw);
249    _TMP3 = COMPAT_TEXTURE(tex, TEX2.xw);
250    _TMP4 = COMPAT_TEXTURE(tex, TEX2.yw);
251    _TMP5 = COMPAT_TEXTURE(tex, TEX2.zw);
252    _TMP6 = COMPAT_TEXTURE(tex, TEX3.xw);
253    _TMP7 = COMPAT_TEXTURE(tex, TEX3.yw);
254    _TMP8 = COMPAT_TEXTURE(tex, TEX3.zw);
255    _TMP9 = COMPAT_TEXTURE(tex, TEX4.xw);
256    _TMP10 = COMPAT_TEXTURE(tex, TEX4.yw);
257    _TMP11 = COMPAT_TEXTURE(tex, TEX4.zw);
258    _TMP12 = COMPAT_TEXTURE(tex, TEX5.xw);
259    _TMP13 = COMPAT_TEXTURE(tex, TEX5.yw);
260    _TMP14 = COMPAT_TEXTURE(tex, TEX5.zw);
261    _TMP15 = COMPAT_TEXTURE(tex, TEX6.xy);
262    _TMP16 = COMPAT_TEXTURE(tex, TEX6.xz);
263    _TMP17 = COMPAT_TEXTURE(tex, TEX6.xw);
264    _TMP18 = COMPAT_TEXTURE(tex, TEX7.xy);
265    _TMP19 = COMPAT_TEXTURE(tex, TEX7.xz);
266    _TMP20 = COMPAT_TEXTURE(tex, TEX7.xw);
267    _r0122.x = dot(_TMP4.xyz, vec3( 1.43519993E+01, 2.81760006E+01, 5.47200012E+00));
268    _r0122.y = dot(_TMP6.xyz, vec3( 1.43519993E+01, 2.81760006E+01, 5.47200012E+00));
269    _r0122.z = dot(_TMP10.xyz, vec3( 1.43519993E+01, 2.81760006E+01, 5.47200012E+00));
270    _r0122.w = dot(_TMP8.xyz, vec3( 1.43519993E+01, 2.81760006E+01, 5.47200012E+00));
271    _r0132.x = dot(_TMP5.xyz, vec3( 1.43519993E+01, 2.81760006E+01, 5.47200012E+00));
272    _r0132.y = dot(_TMP3.xyz, vec3( 1.43519993E+01, 2.81760006E+01, 5.47200012E+00));
273    _r0132.z = dot(_TMP9.xyz, vec3( 1.43519993E+01, 2.81760006E+01, 5.47200012E+00));
274    _r0132.w = dot(_TMP11.xyz, vec3( 1.43519993E+01, 2.81760006E+01, 5.47200012E+00));
275    _r0142.x = dot(_TMP7.xyz, vec3( 1.43519993E+01, 2.81760006E+01, 5.47200012E+00));
276    _r0142.y = dot(_TMP7.xyz, vec3( 1.43519993E+01, 2.81760006E+01, 5.47200012E+00));
277    _r0142.z = dot(_TMP7.xyz, vec3( 1.43519993E+01, 2.81760006E+01, 5.47200012E+00));
278    _r0142.w = dot(_TMP7.xyz, vec3( 1.43519993E+01, 2.81760006E+01, 5.47200012E+00));
279    _r0152.x = dot(_TMP20.xyz, vec3( 1.43519993E+01, 2.81760006E+01, 5.47200012E+00));
280    _r0152.y = dot(_TMP2.xyz, vec3( 1.43519993E+01, 2.81760006E+01, 5.47200012E+00));
281    _r0152.z = dot(_TMP15.xyz, vec3( 1.43519993E+01, 2.81760006E+01, 5.47200012E+00));
282    _r0152.w = dot(_TMP12.xyz, vec3( 1.43519993E+01, 2.81760006E+01, 5.47200012E+00));
283    _r0162.x = dot(_TMP14.xyz, vec3( 1.43519993E+01, 2.81760006E+01, 5.47200012E+00));
284    _r0162.y = dot(_TMP18.xyz, vec3( 1.43519993E+01, 2.81760006E+01, 5.47200012E+00));
285    _r0162.z = dot(_TMP0.xyz, vec3( 1.43519993E+01, 2.81760006E+01, 5.47200012E+00));
286    _r0162.w = dot(_TMP17.xyz, vec3( 1.43519993E+01, 2.81760006E+01, 5.47200012E+00));
287    _r0172.x = dot(_TMP13.xyz, vec3( 1.43519993E+01, 2.81760006E+01, 5.47200012E+00));
288    _r0172.y = dot(_TMP19.xyz, vec3( 1.43519993E+01, 2.81760006E+01, 5.47200012E+00));
289    _r0172.z = dot(_TMP1.xyz, vec3( 1.43519993E+01, 2.81760006E+01, 5.47200012E+00));
290    _r0172.w = dot(_TMP16.xyz, vec3( 1.43519993E+01, 2.81760006E+01, 5.47200012E+00));
291    _fx = vec4( 1.00000000E+00, -1.00000000E+00, -1.00000000E+00, 1.00000000E+00)*_fp.y + vec4( 1.00000000E+00, 1.00000000E+00, -1.00000000E+00, -1.00000000E+00)*_fp.x;
292    _fx_left = vec4( 1.00000000E+00, -1.00000000E+00, -1.00000000E+00, 1.00000000E+00)*_fp.y + vec4( 5.00000000E-01, 2.00000000E+00, -5.00000000E-01, -2.00000000E+00)*_fp.x;
293    _fx_up = vec4( 1.00000000E+00, -1.00000000E+00, -1.00000000E+00, 1.00000000E+00)*_fp.y + vec4( 2.00000000E+00, 5.00000000E-01, -2.00000000E+00, -5.00000000E-01)*_fp.x;
294    _fx3_left = vec4( 6.00000000E+00, -2.00000000E+00, -6.00000000E+00, 2.00000000E+00)*_fp.y + vec4( 2.00000000E+00, 6.00000000E+00, -2.00000000E+00, -6.00000000E+00)*_fp.x;
295    _fx3_up = vec4( 2.00000000E+00, -6.00000000E+00, -2.00000000E+00, 6.00000000E+00)*_fp.y + vec4( 6.00000000E+00, 2.00000000E+00, -6.00000000E+00, -2.00000000E+00)*_fp.x;
296    _a0186 = _r0122.wxyz - _r0122;
297    _TMP183 = abs(_a0186);
298    _TMP21 = bvec4(_TMP183.x < 1.00000000E+01, _TMP183.y < 1.00000000E+01, _TMP183.z < 1.00000000E+01, _TMP183.w < 1.00000000E+01);
299    _a0192 = _r0122.wxyz - _r0132;
300    _TMP189 = abs(_a0192);
301    _TMP22 = bvec4(_TMP189.x < 1.00000000E+01, _TMP189.y < 1.00000000E+01, _TMP189.z < 1.00000000E+01, _TMP189.w < 1.00000000E+01);
302    _a0198 = _r0122.zwxy - _r0122.yzwx;
303    _TMP195 = abs(_a0198);
304    _TMP23 = bvec4(_TMP195.x < 1.00000000E+01, _TMP195.y < 1.00000000E+01, _TMP195.z < 1.00000000E+01, _TMP195.w < 1.00000000E+01);
305    _a0204 = _r0122.zwxy - _r0132.zwxy;
306    _TMP201 = abs(_a0204);
307    _TMP24 = bvec4(_TMP201.x < 1.00000000E+01, _TMP201.y < 1.00000000E+01, _TMP201.z < 1.00000000E+01, _TMP201.w < 1.00000000E+01);
308    _a0210 = _r0142 - _r0132.wxyz;
309    _TMP207 = abs(_a0210);
310    _TMP25 = bvec4(_TMP207.x < 1.00000000E+01, _TMP207.y < 1.00000000E+01, _TMP207.z < 1.00000000E+01, _TMP207.w < 1.00000000E+01);
311    _a0216 = _r0122.wxyz - _r0172.yzwx;
312    _TMP213 = abs(_a0216);
313    _TMP26 = bvec4(_TMP213.x < 1.00000000E+01, _TMP213.y < 1.00000000E+01, _TMP213.z < 1.00000000E+01, _TMP213.w < 1.00000000E+01);
314    _a0222 = _r0122.wxyz - _r0152;
315    _TMP219 = abs(_a0222);
316    _TMP27 = bvec4(_TMP219.x < 1.00000000E+01, _TMP219.y < 1.00000000E+01, _TMP219.z < 1.00000000E+01, _TMP219.w < 1.00000000E+01);
317    _a0228 = _r0122.zwxy - _r0172;
318    _TMP225 = abs(_a0228);
319    _TMP28 = bvec4(_TMP225.x < 1.00000000E+01, _TMP225.y < 1.00000000E+01, _TMP225.z < 1.00000000E+01, _TMP225.w < 1.00000000E+01);
320    _a0234 = _r0122.zwxy - _r0162;
321    _TMP231 = abs(_a0234);
322    _TMP29 = bvec4(_TMP231.x < 1.00000000E+01, _TMP231.y < 1.00000000E+01, _TMP231.z < 1.00000000E+01, _TMP231.w < 1.00000000E+01);
323    _a0240 = _r0142 - _r0132.zwxy;
324    _TMP237 = abs(_a0240);
325    _TMP30 = bvec4(_TMP237.x < 1.00000000E+01, _TMP237.y < 1.00000000E+01, _TMP237.z < 1.00000000E+01, _TMP237.w < 1.00000000E+01);
326    _a0246 = _r0142 - _r0132;
327    _TMP243 = abs(_a0246);
328    _TMP31 = bvec4(_TMP243.x < 1.00000000E+01, _TMP243.y < 1.00000000E+01, _TMP243.z < 1.00000000E+01, _TMP243.w < 1.00000000E+01);
329    _interp_restriction_lv1 = bvec4(_r0142.x != _r0122.w && _r0142.x != _r0122.z && (!_TMP21.x && !_TMP22.x || !_TMP23.x && !_TMP24.x || _TMP25.x && (!_TMP26.x && !_TMP27.x || !_TMP28.x && !_TMP29.x) || _TMP30.x || _TMP31.x), _r0142.y != _r0122.x && _r0142.y != _r0122.w && (!_TMP21.y && !_TMP22.y || !_TMP23.y && !_TMP24.y || _TMP25.y && (!_TMP26.y && !_TMP27.y || !_TMP28.y && !_TMP29.y) || _TMP30.y || _TMP31.y), _r0142.z != _r0122.y && _r0142.z != _r0122.x && (!_TMP21.z && !_TMP22.z || !_TMP23.z && !_TMP24.z || _TMP25.z && (!_TMP26.z && !_TMP27.z || !_TMP28.z && !_TMP29.z) || _TMP30.z || _TMP31.z), _r0142.w != _r0122.z && _r0142.w != _r0122.y && (!_TMP21.w && !_TMP22.w || !_TMP23.w && !_TMP24.w || _TMP25.w && (!_TMP26.w && !_TMP27.w || !_TMP28.w && !_TMP29.w) || _TMP30.w || _TMP31.w));
330    _interp_restriction_lv2_left = bvec4(_r0142.x != _r0132.z && _r0122.y != _r0132.z, _r0142.y != _r0132.w && _r0122.z != _r0132.w, _r0142.z != _r0132.x && _r0122.w != _r0132.x, _r0142.w != _r0132.y && _r0122.x != _r0132.y);
331    _interp_restriction_lv2_up = bvec4(_r0142.x != _r0132.x && _r0122.x != _r0132.x, _r0142.y != _r0132.y && _r0122.y != _r0132.y, _r0142.z != _r0132.z && _r0122.z != _r0132.z, _r0142.w != _r0132.w && _r0122.w != _r0132.w);
332    _a0252 = _r0132.zwxy - _r0162.wxyz;
333    _TMP249 = abs(_a0252);
334    _TMP32 = bvec4(_TMP249.x < 2.00000000E+00, _TMP249.y < 2.00000000E+00, _TMP249.z < 2.00000000E+00, _TMP249.w < 2.00000000E+00);
335    _a0258 = _r0172.wxyz - _r0162.wxyz;
336    _TMP255 = abs(_a0258);
337    _TMP33 = bvec4(_TMP255.x < 2.00000000E+00, _TMP255.y < 2.00000000E+00, _TMP255.z < 2.00000000E+00, _TMP255.w < 2.00000000E+00);
338    _interp_restriction_lv3_left = bvec4(_TMP32.x && !_TMP33.x, _TMP32.y && !_TMP33.y, _TMP32.z && !_TMP33.z, _TMP32.w && !_TMP33.w);
339    _a0264 = _r0132 - _r0152.yzwx;
340    _TMP261 = abs(_a0264);
341    _TMP34 = bvec4(_TMP261.x < 2.00000000E+00, _TMP261.y < 2.00000000E+00, _TMP261.z < 2.00000000E+00, _TMP261.w < 2.00000000E+00);
342    _a0270 = _r0172.zwxy - _r0152.yzwx;
343    _TMP267 = abs(_a0270);
344    _TMP35 = bvec4(_TMP267.x < 2.00000000E+00, _TMP267.y < 2.00000000E+00, _TMP267.z < 2.00000000E+00, _TMP267.w < 2.00000000E+00);
345    _interp_restriction_lv3_up = bvec4(_TMP34.x && !_TMP35.x, _TMP34.y && !_TMP35.y, _TMP34.z && !_TMP35.z, _TMP34.w && !_TMP35.w);
346    _x0274 = (_fx - vec4( 1.10000002E+00, 9.99999940E-02, -8.99999976E-01, 9.99999940E-02))/vec4( 7.99999952E-01, 7.99999952E-01, 7.99999952E-01, 7.99999952E-01);
347    _TMP65 = min(vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00), _x0274);
348    _TMP275 = max(vec4( 0.00000000E+00, 0.00000000E+00, 0.00000000E+00, 0.00000000E+00), _TMP65);
349    _fx45 = _TMP275*_TMP275*(3.00000000E+00 - 2.00000000E+00*_TMP275);
350    _x0284 = (_fx_left - vec4( 6.00000024E-01, 6.00000024E-01, -8.99999976E-01, -4.00000006E-01))/vec4( 7.99999952E-01, 7.99999952E-01, 7.99999952E-01, 8.00000012E-01);
351    _TMP65 = min(vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00), _x0284);
352    _TMP285 = max(vec4( 0.00000000E+00, 0.00000000E+00, 0.00000000E+00, 0.00000000E+00), _TMP65);
353    _fx30 = _TMP285*_TMP285*(3.00000000E+00 - 2.00000000E+00*_TMP285);
354    _x0294 = (_fx_up - vec4( 1.60000002E+00, -4.00000006E-01, -1.39999998E+00, 9.99999940E-02))/vec4( 8.00000072E-01, 8.00000012E-01, 7.99999952E-01, 7.99999952E-01);
355    _TMP65 = min(vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00), _x0294);
356    _TMP295 = max(vec4( 0.00000000E+00, 0.00000000E+00, 0.00000000E+00, 0.00000000E+00), _TMP65);
357    _fx60 = _TMP295*_TMP295*(3.00000000E+00 - 2.00000000E+00*_TMP295);
358    _x0304 = (_fx3_left - vec4( 4.59999990E+00, 2.59999990E+00, -3.40000010E+00, -1.39999998E+00))/vec4( 8.00000191E-01, 8.00000191E-01, 8.00000191E-01, 7.99999952E-01);
359    _TMP65 = min(vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00), _x0304);
360    _TMP305 = max(vec4( 0.00000000E+00, 0.00000000E+00, 0.00000000E+00, 0.00000000E+00), _TMP65);
361    _fx15 = _TMP305*_TMP305*(3.00000000E+00 - 2.00000000E+00*_TMP305);
362    _x0314 = (_fx3_up - vec4( 4.59999990E+00, -1.39999998E+00, -3.40000010E+00, 2.59999990E+00))/vec4( 8.00000191E-01, 7.99999952E-01, 8.00000191E-01, 8.00000191E-01);
363    _TMP65 = min(vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00), _x0314);
364    _TMP315 = max(vec4( 0.00000000E+00, 0.00000000E+00, 0.00000000E+00, 0.00000000E+00), _TMP65);
365    _fx75 = _TMP315*_TMP315*(3.00000000E+00 - 2.00000000E+00*_TMP315);
366    _a0326 = _r0142 - _r0132;
367    _TMP323 = abs(_a0326);
368    _a0330 = _r0142 - _r0132.zwxy;
369    _TMP327 = abs(_a0330);
370    _a0334 = _r0132.wxyz - _r0172;
371    _TMP331 = abs(_a0334);
372    _a0338 = _r0132.wxyz - _r0172.yzwx;
373    _TMP335 = abs(_a0338);
374    _a0342 = _r0122.zwxy - _r0122.wxyz;
375    _TMP339 = abs(_a0342);
376    _TMP36 = _TMP323 + _TMP327 + _TMP331 + _TMP335 + 4.00000000E+00*_TMP339;
377    _a0348 = _r0122.zwxy - _r0122.yzwx;
378    _TMP345 = abs(_a0348);
379    _a0352 = _r0122.zwxy - _r0162;
380    _TMP349 = abs(_a0352);
381    _a0356 = _r0122.wxyz - _r0152;
382    _TMP353 = abs(_a0356);
383    _a0360 = _r0122.wxyz - _r0122;
384    _TMP357 = abs(_a0360);
385    _a0364 = _r0142 - _r0132.wxyz;
386    _TMP361 = abs(_a0364);
387    _TMP37 = _TMP345 + _TMP349 + _TMP353 + _TMP357 + 4.00000000E+00*_TMP361;
388    _edr = bvec4(_TMP36.x < _TMP37.x && _interp_restriction_lv1.x, _TMP36.y < _TMP37.y && _interp_restriction_lv1.y, _TMP36.z < _TMP37.z && _interp_restriction_lv1.z, _TMP36.w < _TMP37.w && _interp_restriction_lv1.w);
389    _a0368 = _r0122.wxyz - _r0132.zwxy;
390    _TMP365 = abs(_a0368);
391    _a0372 = _r0122.zwxy - _r0132;
392    _TMP369 = abs(_a0372);
393    _edr_left = bvec4((2.00000000E+00*_TMP365).x <= _TMP369.x && _interp_restriction_lv2_left.x, (2.00000000E+00*_TMP365).y <= _TMP369.y && _interp_restriction_lv2_left.y, (2.00000000E+00*_TMP365).z <= _TMP369.z && _interp_restriction_lv2_left.z, (2.00000000E+00*_TMP365).w <= _TMP369.w && _interp_restriction_lv2_left.w);
394    _a0376 = _r0122.wxyz - _r0132.zwxy;
395    _TMP373 = abs(_a0376);
396    _a0380 = _r0122.zwxy - _r0132;
397    _TMP377 = abs(_a0380);
398    _edr_up = bvec4(_TMP373.x >= (2.00000000E+00*_TMP377).x && _interp_restriction_lv2_up.x, _TMP373.y >= (2.00000000E+00*_TMP377).y && _interp_restriction_lv2_up.y, _TMP373.z >= (2.00000000E+00*_TMP377).z && _interp_restriction_lv2_up.z, _TMP373.w >= (2.00000000E+00*_TMP377).w && _interp_restriction_lv2_up.w);
399    _nc45 = bvec4(_edr.x && bool(_fx45.x), _edr.y && bool(_fx45.y), _edr.z && bool(_fx45.z), _edr.w && bool(_fx45.w));
400    _nc30 = bvec4(_edr.x && _edr_left.x && bool(_fx30.x), _edr.y && _edr_left.y && bool(_fx30.y), _edr.z && _edr_left.z && bool(_fx30.z), _edr.w && _edr_left.w && bool(_fx30.w));
401    _nc60 = bvec4(_edr.x && _edr_up.x && bool(_fx60.x), _edr.y && _edr_up.y && bool(_fx60.y), _edr.z && _edr_up.z && bool(_fx60.z), _edr.w && _edr_up.w && bool(_fx60.w));
402    _nc15 = bvec4(_edr.x && _edr_left.x && _interp_restriction_lv3_left.x && bool(_fx15.x), _edr.y && _edr_left.y && _interp_restriction_lv3_left.y && bool(_fx15.y), _edr.z && _edr_left.z && _interp_restriction_lv3_left.z && bool(_fx15.z), _edr.w && _edr_left.w && _interp_restriction_lv3_left.w && bool(_fx15.w));
403    _nc75 = bvec4(_edr.x && _edr_up.x && _interp_restriction_lv3_up.x && bool(_fx75.x), _edr.y && _edr_up.y && _interp_restriction_lv3_up.y && bool(_fx75.y), _edr.z && _edr_up.z && _interp_restriction_lv3_up.z && bool(_fx75.z), _edr.w && _edr_up.w && _interp_restriction_lv3_up.w && bool(_fx75.w));
404    _a0384 = _r0142 - _r0122.wxyz;
405    _TMP381 = abs(_a0384);
406    _a0388 = _r0142 - _r0122.zwxy;
407    _TMP385 = abs(_a0388);
408    _px = bvec4(_TMP381.x <= _TMP385.x, _TMP381.y <= _TMP385.y, _TMP381.z <= _TMP385.z, _TMP381.w <= _TMP385.w);
409    _nc = bvec4(_nc75.x || _nc15.x || _nc30.x || _nc60.x || _nc45.x, _nc75.y || _nc15.y || _nc30.y || _nc60.y || _nc45.y, _nc75.z || _nc15.z || _nc30.z || _nc60.z || _nc45.z, _nc75.w || _nc15.w || _nc30.w || _nc60.w || _nc45.w);
410    _final45 = vec4(float(_nc45.x), float(_nc45.y), float(_nc45.z), float(_nc45.w))*_fx45;
411    _final30 = vec4(float(_nc30.x), float(_nc30.y), float(_nc30.z), float(_nc30.w))*_fx30;
412    _final60 = vec4(float(_nc60.x), float(_nc60.y), float(_nc60.z), float(_nc60.w))*_fx60;
413    _final15 = vec4(float(_nc15.x), float(_nc15.y), float(_nc15.z), float(_nc15.w))*_fx15;
414    _final75 = vec4(float(_nc75.x), float(_nc75.y), float(_nc75.z), float(_nc75.w))*_fx75;
415    _TMP44 = max(_final15, _final75);
416    _TMP45 = max(_final30, _final60);
417    _TMP46 = max(_TMP44, _TMP45);
418    _maximo = max(_TMP46, _final45);
419    if (_nc.x) { 
420        if (_px.x) { 
421            _TMP47 = _TMP8.xyz;
422        } else {
423            _TMP47 = _TMP10.xyz;
424        } 
425        _pix1 = _TMP47;
426        _blend1 = _maximo.x;
427    } else {
428        if (_nc.y) { 
429            if (_px.y) { 
430                _TMP48 = _TMP4.xyz;
431            } else {
432                _TMP48 = _TMP8.xyz;
433            } 
434            _pix1 = _TMP48;
435            _blend1 = _maximo.y;
436        } else {
437            if (_nc.z) { 
438                if (_px.z) { 
439                    _TMP49 = _TMP6.xyz;
440                } else {
441                    _TMP49 = _TMP4.xyz;
442                } 
443                _pix1 = _TMP49;
444                _blend1 = _maximo.z;
445            } else {
446                if (_nc.w) { 
447                    if (_px.w) { 
448                        _TMP50 = _TMP10.xyz;
449                    } else {
450                        _TMP50 = _TMP6.xyz;
451                    } 
452                    _pix1 = _TMP50;
453                    _blend1 = _maximo.w;
454                } 
455            } 
456        } 
457    } 
458    if (_nc.w) { 
459        if (_px.w) { 
460            _TMP51 = _TMP10.xyz;
461        } else {
462            _TMP51 = _TMP6.xyz;
463        } 
464        _pix2 = _TMP51;
465        _blend2 = _maximo.w;
466    } else {
467        if (_nc.z) { 
468            if (_px.z) { 
469                _TMP52 = _TMP6.xyz;
470            } else {
471                _TMP52 = _TMP4.xyz;
472            } 
473            _pix2 = _TMP52;
474            _blend2 = _maximo.z;
475        } else {
476            if (_nc.y) { 
477                if (_px.y) { 
478                    _TMP53 = _TMP4.xyz;
479                } else {
480                    _TMP53 = _TMP8.xyz;
481                } 
482                _pix2 = _TMP53;
483                _blend2 = _maximo.y;
484            } else {
485                if (_nc.x) { 
486                    if (_px.x) { 
487                        _TMP54 = _TMP8.xyz;
488                    } else {
489                        _TMP54 = _TMP10.xyz;
490                    } 
491                    _pix2 = _TMP54;
492                    _blend2 = _maximo.x;
493                } 
494            } 
495        } 
496    } 
497    _res1 = _TMP7.xyz + _blend1*(_pix1 - _TMP7.xyz);
498    _res2 = _TMP7.xyz + _blend2*(_pix2 - _TMP7.xyz);
499    _a0404 = _TMP7.xyz - _res1;
500    _df0402 = abs(_a0404);
501    _TMP55 = _df0402.x + _df0402.y + _df0402.z;
502    _a0408 = _TMP7.xyz - _res2;
503    _df0406 = abs(_a0408);
504    _TMP56 = _df0406.x + _df0406.y + _df0406.z;
505    _TMP57 = float((_TMP56 >= _TMP55));
506    _res = _res1 + _TMP57*(_res2 - _res1);
507    _ret_0 = vec4(_res.x, _res.y, _res.z, 1.00000000E+00);
508    FragColor = _ret_0;
509    return;
510}