// GLSL shader autogenerated by cg2glsl.py.
#if defined(VERTEX)

#if __VERSION__ >= 130
#define COMPAT_VARYING out
#define COMPAT_ATTRIBUTE in
#define COMPAT_TEXTURE texture
#else
#define COMPAT_VARYING varying
#define COMPAT_ATTRIBUTE attribute
#define COMPAT_TEXTURE texture2D
#endif

#ifdef GL_ES
#define COMPAT_PRECISION mediump
#else
#define COMPAT_PRECISION
#endif
COMPAT_VARYING     vec4 _t3;
COMPAT_VARYING     vec4 _t2;
COMPAT_VARYING     vec4 _t1;
COMPAT_VARYING     vec2 _texCoord1;
COMPAT_VARYING     vec4 _position1;
struct input_dummy {
    vec2 _video_size;
    vec2 _texture_size;
    vec2 _output_dummy_size;
};
struct out_vertex {
    vec4 _position1;
    vec2 _texCoord1;
    vec4 _t1;
    vec4 _t2;
    vec4 _t3;
};
out_vertex _ret_0;
input_dummy _IN1;
vec4 _r0006;
COMPAT_ATTRIBUTE vec4 VertexCoord;
COMPAT_ATTRIBUTE vec4 TexCoord;
COMPAT_VARYING vec4 TEX0;
COMPAT_VARYING vec4 TEX1;
COMPAT_VARYING vec4 TEX2;
COMPAT_VARYING vec4 TEX3;
 
uniform mat4 MVPMatrix;
uniform int FrameDirection;
uniform int FrameCount;
uniform COMPAT_PRECISION vec2 OutputSize;
uniform COMPAT_PRECISION vec2 TextureSize;
uniform COMPAT_PRECISION vec2 InputSize;
void main()
{
    out_vertex _OUT;
    vec2 _ps;
    _r0006 = VertexCoord.x*MVPMatrix[0];
    _r0006 = _r0006 + VertexCoord.y*MVPMatrix[1];
    _r0006 = _r0006 + VertexCoord.z*MVPMatrix[2];
    _r0006 = _r0006 + VertexCoord.w*MVPMatrix[3];
    _ps = vec2(1.00000000E+00/TextureSize.x, 1.00000000E+00/TextureSize.y);
    _OUT._t1 = TexCoord.xxxy + vec4(-_ps.x, 0.00000000E+00, _ps.x, -_ps.y);
    _OUT._t2 = TexCoord.xxxy + vec4(-_ps.x, 0.00000000E+00, _ps.x, 0.00000000E+00);
    _OUT._t3 = TexCoord.xxxy + vec4(-_ps.x, 0.00000000E+00, _ps.x, _ps.y);
    _ret_0._position1 = _r0006;
    _ret_0._texCoord1 = TexCoord.xy;
    _ret_0._t1 = _OUT._t1;
    _ret_0._t2 = _OUT._t2;
    _ret_0._t3 = _OUT._t3;
    gl_Position = _r0006;
    TEX0.xy = TexCoord.xy;
    TEX1 = _OUT._t1;
    TEX2 = _OUT._t2;
    TEX3 = _OUT._t3;
    return;
    TEX0.xy = _ret_0._texCoord1;
    TEX1 = _ret_0._t1;
    TEX2 = _ret_0._t2;
    TEX3 = _ret_0._t3;
} 
#elif defined(FRAGMENT)

#if __VERSION__ >= 130
#define COMPAT_VARYING in
#define COMPAT_TEXTURE texture
out vec4 FragColor;
#else
#define COMPAT_VARYING varying
#define FragColor gl_FragColor
#define COMPAT_TEXTURE texture2D
#endif

#ifdef GL_ES
#ifdef GL_FRAGMENT_PRECISION_HIGH
precision highp float;
#else
precision mediump float;
#endif
#define COMPAT_PRECISION mediump
#else
#define COMPAT_PRECISION
#endif
COMPAT_VARYING     vec4 _t3;
COMPAT_VARYING     vec4 _t2;
COMPAT_VARYING     vec4 _t1;
COMPAT_VARYING     vec2 _texCoord;
struct input_dummy {
    vec2 _video_size;
    vec2 _texture_size;
    vec2 _output_dummy_size;
};
struct out_vertex {
    vec2 _texCoord;
    vec4 _t1;
    vec4 _t2;
    vec4 _t3;
};
vec3 _TMP18;
vec3 _TMP21;
vec3 _TMP24;
vec3 _TMP27;
vec3 _TMP28;
vec3 _TMP25;
vec3 _TMP26;
vec3 _TMP22;
vec3 _TMP23;
vec3 _TMP17;
vec3 _TMP16;
vec3 _TMP15;
vec3 _TMP14;
vec3 _TMP13;
vec3 _TMP12;
vec3 _TMP11;
vec3 _TMP10;
vec4 _TMP9;
vec4 _TMP8;
vec4 _TMP7;
vec4 _TMP6;
vec4 _TMP5;
vec4 _TMP4;
vec4 _TMP3;
vec4 _TMP2;
vec4 _TMP1;
vec2 _TMP0;
uniform sampler2D Texture;
input_dummy _IN1;
vec2 _x0033;
vec2 _x0035;
bool _TMP54;
bvec3 _a0057;
bool _TMP58;
bvec3 _a0061;
bool _TMP62;
bvec3 _a0065;
bool _TMP66;
bvec3 _a0069;
bool _TMP70;
bvec3 _a0073;
bool _TMP74;
bvec3 _a0077;
bool _TMP78;
bvec3 _a0081;
bool _TMP82;
bvec3 _a0085;
bool _TMP86;
bvec3 _a0089;
bool _TMP90;
bvec3 _a0093;
COMPAT_VARYING vec4 TEX0;
COMPAT_VARYING vec4 TEX1;
COMPAT_VARYING vec4 TEX2;
COMPAT_VARYING vec4 TEX3;
 
uniform int FrameDirection;
uniform int FrameCount;
uniform COMPAT_PRECISION vec2 OutputSize;
uniform COMPAT_PRECISION vec2 TextureSize;
uniform COMPAT_PRECISION vec2 InputSize;
void main()
{
    vec2 _fp;
    _x0033 = TEX0.xy*TextureSize;
    _TMP0 = fract(_x0033);
    _x0035 = 3.00000000E+00*_TMP0;
    _fp = floor(_x0035);
    _TMP1 = COMPAT_TEXTURE(Texture, TEX1.xw);
    _TMP2 = COMPAT_TEXTURE(Texture, TEX1.yw);
    _TMP3 = COMPAT_TEXTURE(Texture, TEX1.zw);
    _TMP4 = COMPAT_TEXTURE(Texture, TEX2.xw);
    _TMP5 = COMPAT_TEXTURE(Texture, TEX2.yw);
    _TMP6 = COMPAT_TEXTURE(Texture, TEX2.zw);
    _TMP7 = COMPAT_TEXTURE(Texture, TEX3.xw);
    _TMP8 = COMPAT_TEXTURE(Texture, TEX3.yw);
    _TMP9 = COMPAT_TEXTURE(Texture, TEX3.zw);
    _a0057 = bvec3(_TMP2.x == _TMP4.x, _TMP2.y == _TMP4.y, _TMP2.z == _TMP4.z);
    _TMP54 = _a0057.x && _a0057.y && _a0057.z;
    _a0061 = bvec3(_TMP2.x == _TMP6.x, _TMP2.y == _TMP6.y, _TMP2.z == _TMP6.z);
    _TMP58 = _a0061.x && _a0061.y && _a0061.z;
    _a0065 = bvec3(_TMP8.x == _TMP4.x, _TMP8.y == _TMP4.y, _TMP8.z == _TMP4.z);
    _TMP62 = _a0065.x && _a0065.y && _a0065.z;
    _a0069 = bvec3(_TMP8.x == _TMP6.x, _TMP8.y == _TMP6.y, _TMP8.z == _TMP6.z);
    _TMP66 = _a0069.x && _a0069.y && _a0069.z;
    _a0073 = bvec3(_TMP5.x != _TMP1.x, _TMP5.y != _TMP1.y, _TMP5.z != _TMP1.z);
    _TMP70 = _a0073.x || _a0073.y || _a0073.z;
    _a0077 = bvec3(_TMP5.x != _TMP3.x, _TMP5.y != _TMP3.y, _TMP5.z != _TMP3.z);
    _TMP74 = _a0077.x || _a0077.y || _a0077.z;
    _a0081 = bvec3(_TMP5.x != _TMP7.x, _TMP5.y != _TMP7.y, _TMP5.z != _TMP7.z);
    _TMP78 = _a0081.x || _a0081.y || _a0081.z;
    _a0085 = bvec3(_TMP5.x != _TMP9.x, _TMP5.y != _TMP9.y, _TMP5.z != _TMP9.z);
    _TMP82 = _a0085.x || _a0085.y || _a0085.z;
    if (_TMP54) { 
        _TMP10 = _TMP2.xyz;
    } else {
        _TMP10 = _TMP5.xyz;
    } 
    if (_TMP54 && _TMP74 || _TMP58 && _TMP70) { 
        _TMP11 = _TMP2.xyz;
    } else {
        _TMP11 = _TMP5.xyz;
    } 
    if (_TMP58) { 
        _TMP12 = _TMP2.xyz;
    } else {
        _TMP12 = _TMP5.xyz;
    } 
    if (_TMP54 && _TMP78 || _TMP62 && _TMP70) { 
        _TMP13 = _TMP4.xyz;
    } else {
        _TMP13 = _TMP5.xyz;
    } 
    if (_TMP58 && _TMP82 || _TMP66 && _TMP74) { 
        _TMP14 = _TMP6.xyz;
    } else {
        _TMP14 = _TMP5.xyz;
    } 
    if (_TMP62) { 
        _TMP15 = _TMP8.xyz;
    } else {
        _TMP15 = _TMP5.xyz;
    } 
    if (_TMP62 && _TMP82 || _TMP66 && _TMP78) { 
        _TMP16 = _TMP8.xyz;
    } else {
        _TMP16 = _TMP5.xyz;
    } 
    if (_TMP66) { 
        _TMP17 = _TMP8.xyz;
    } else {
        _TMP17 = _TMP5.xyz;
    } 
    _a0089 = bvec3(_TMP2.x != _TMP8.x, _TMP2.y != _TMP8.y, _TMP2.z != _TMP8.z);
    _TMP86 = _a0089.x || _a0089.y || _a0089.z;
    _a0093 = bvec3(_TMP4.x != _TMP6.x, _TMP4.y != _TMP6.y, _TMP4.z != _TMP6.z);
    _TMP90 = _a0093.x || _a0093.y || _a0093.z;
    if (_TMP86 && _TMP90) { 
        if (_fp.y == 0.00000000E+00) { 
            if (_fp.x == 0.00000000E+00) { 
                _TMP22 = _TMP10;
            } else {
                if (_fp.x == 1.00000000E+00) { 
                    _TMP23 = _TMP11;
                } else {
                    _TMP23 = _TMP12;
                } 
                _TMP22 = _TMP23;
            } 
            _TMP21 = _TMP22;
        } else {
            if (_fp.y == 1.00000000E+00) { 
                if (_fp.x == 0.00000000E+00) { 
                    _TMP25 = _TMP13;
                } else {
                    if (_fp.x == 1.00000000E+00) { 
                        _TMP26 = _TMP5.xyz;
                    } else {
                        _TMP26 = _TMP14;
                    } 
                    _TMP25 = _TMP26;
                } 
                _TMP24 = _TMP25;
            } else {
                if (_fp.x == 0.00000000E+00) { 
                    _TMP27 = _TMP15;
                } else {
                    if (_fp.x == 1.00000000E+00) { 
                        _TMP28 = _TMP16;
                    } else {
                        _TMP28 = _TMP17;
                    } 
                    _TMP27 = _TMP28;
                } 
                _TMP24 = _TMP27;
            } 
            _TMP21 = _TMP24;
        } 
        _TMP18 = _TMP21;
    } else {
        _TMP18 = _TMP5.xyz;
    } 
    FragColor.xyz = _TMP18;
    return;
} 
#endif
