// 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     vec2 VARt1;
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;
    vec2 VARt1;
};
out_vertex _ret_0;
input_dummy _IN1;
vec4 _r0006;
COMPAT_ATTRIBUTE vec4 VertexCoord;
COMPAT_ATTRIBUTE vec4 TexCoord;
COMPAT_VARYING vec4 TEX0;
 
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;
    _r0006 = VertexCoord.x*MVPMatrix[0];
    _r0006 = _r0006 + VertexCoord.y*MVPMatrix[1];
    _r0006 = _r0006 + VertexCoord.z*MVPMatrix[2];
    _r0006 = _r0006 + VertexCoord.w*MVPMatrix[3];
    _OUT.VARt1 = 1.00000000E+00/TextureSize;
    _ret_0._position1 = _r0006;
    _ret_0._texCoord1 = TexCoord.xy;
    VARt1 = _OUT.VARt1;
    gl_Position = _r0006;
    TEX0.xy = TexCoord.xy;
    return;
    TEX0.xy = _ret_0._texCoord1;
} 
#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     vec2 VARt1;
COMPAT_VARYING     vec2 _texCoord;
struct input_dummy {
    vec2 _video_size;
    vec2 _texture_size;
    vec2 _output_dummy_size;
};
struct out_vertex {
    vec2 _texCoord;
    vec2 VARt1;
};
vec2 _ret_0;
float _TMP24;
float _TMP23;
float _TMP22;
float _TMP21;
vec4 _TMP8;
vec4 _TMP7;
vec4 _TMP6;
vec4 _TMP5;
vec4 _TMP4;
vec4 _TMP3;
vec4 _TMP2;
vec4 _TMP1;
vec4 _TMP0;
out_vertex _VAR1;
uniform sampler2D Texture;
vec2 _c0031;
vec2 _c0033;
vec2 _c0035;
vec2 _c0037;
vec2 _c0039;
vec2 _c0041;
vec2 _c0043;
vec2 _c0045;
float _TMP46;
float _TMP50;
float _TMP56;
float _TMP60;
float _TMP66;
float _TMP70;
float _TMP74;
float _TMP78;
float _TMP82;
float _TMP86;
float _TMP90;
float _TMP94;
float _TMP98;
COMPAT_VARYING vec4 TEX0;
 
uniform int FrameDirection;
uniform int FrameCount;
uniform COMPAT_PRECISION vec2 OutputSize;
uniform COMPAT_PRECISION vec2 TextureSize;
uniform COMPAT_PRECISION vec2 InputSize;
void main()
{
    _TMP0 = COMPAT_TEXTURE(Texture, TEX0.xy);
    _c0031 = TEX0.xy + vec2( -1.00000000E+00, 0.00000000E+00)*VARt1;
    _TMP1 = COMPAT_TEXTURE(Texture, _c0031);
    _c0033 = TEX0.xy + vec2( 1.00000000E+00, 0.00000000E+00)*VARt1;
    _TMP2 = COMPAT_TEXTURE(Texture, _c0033);
    _c0035 = TEX0.xy + vec2( 0.00000000E+00, 1.00000000E+00)*VARt1;
    _TMP3 = COMPAT_TEXTURE(Texture, _c0035);
    _c0037 = TEX0.xy + vec2( 0.00000000E+00, -1.00000000E+00)*VARt1;
    _TMP4 = COMPAT_TEXTURE(Texture, _c0037);
    _c0039 = TEX0.xy + -VARt1;
    _TMP5 = COMPAT_TEXTURE(Texture, _c0039);
    _c0041 = TEX0.xy + vec2( 1.00000000E+00, -1.00000000E+00)*VARt1;
    _TMP6 = COMPAT_TEXTURE(Texture, _c0041);
    _c0043 = TEX0.xy + vec2( -1.00000000E+00, 1.00000000E+00)*VARt1;
    _TMP7 = COMPAT_TEXTURE(Texture, _c0043);
    _c0045 = TEX0.xy + VARt1;
    _TMP8 = COMPAT_TEXTURE(Texture, _c0045);
    _TMP46 = max(_TMP4.x, _TMP3.x);
    _TMP21 = min(_TMP2.z, _TMP46);
    _TMP50 = min(_TMP1.z, _TMP21);
    _TMP56 = max(_TMP1.y, _TMP2.y);
    _TMP21 = min(_TMP3.z, _TMP56);
    _TMP60 = min(_TMP4.z, _TMP21);
    _TMP66 = min(_TMP5.z, _TMP6.z);
    _TMP70 = min(_TMP7.z, _TMP8.z);
    _TMP74 = max(_TMP66, _TMP70);
    _TMP78 = min(_TMP0.x, _TMP74);
    _TMP82 = min(_TMP5.z, _TMP7.z);
    _TMP86 = min(_TMP6.z, _TMP8.z);
    _TMP90 = max(_TMP82, _TMP86);
    _TMP94 = min(_TMP0.y, _TMP90);
    _TMP22 = max(_TMP78, _TMP94);
    _TMP23 = max(_TMP60, _TMP22);
    _TMP24 = max(_TMP50, _TMP23);
    _TMP98 = max(_TMP0.z, _TMP24);
    _ret_0 = vec2(_TMP0.x, _TMP98);
    FragColor.xy = _ret_0;
    return;
} 
#endif
