// 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 _CT;
COMPAT_VARYING     vec4 _position2;
COMPAT_VARYING     vec4 _color;
COMPAT_VARYING     vec2 _texCoord1;
COMPAT_VARYING     vec4 _position1;
COMPAT_VARYING     float _frame_rotation;
struct input_dummy {
    vec2 _video_size;
    vec2 _texture_size;
    vec2 _output_dummy_size;
    float _frame_count;
    float _frame_direction;
    float _frame_rotation;
};
struct VERTEX_OUTPUT {
    vec4 _position1;
    vec2 _texCoord1;
};
struct output_dummy {
    vec4 _color;
};
struct VERTEX_INPUT {
    vec4 _position2;
    vec2 _CT;
};
VERTEX_OUTPUT _ret_0;
vec4 _r0008;
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()
{
    _r0008 = VertexCoord.x*MVPMatrix[0];
    _r0008 = _r0008 + VertexCoord.y*MVPMatrix[1];
    _r0008 = _r0008 + VertexCoord.z*MVPMatrix[2];
    _r0008 = _r0008 + VertexCoord.w*MVPMatrix[3];
    _ret_0._position1 = _r0008;
    _ret_0._texCoord1 = TexCoord.xy;
    gl_Position = _r0008;
    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 _CT;
COMPAT_VARYING     vec4 _color;
COMPAT_VARYING     vec2 _texCoord;
COMPAT_VARYING     float _frame_rotation;
struct input_dummy {
    vec2 _video_size;
    vec2 _texture_size;
    vec2 _output_dummy_size;
    float _frame_count;
    float _frame_direction;
    float _frame_rotation;
};
struct VERTEX_OUTPUT {
    vec2 _texCoord;
};
struct output_dummy {
    vec4 _color;
};
struct VERTEX_INPUT {
    vec2 _CT;
};
float _TMP6;
vec4 _TMP5;
uniform sampler2D Texture;
float _TMP15;
float _a0016;
float _x0018;
float _TMP19;
float _a0020;
float _x0022;
float _TMP23;
float _a0024;
float _x0026;
vec2 _c0028;
COMPAT_VARYING vec4 TEX0;
uniform float _threshold;
 
uniform int FrameDirection;
uniform int FrameCount;
uniform COMPAT_PRECISION vec2 OutputSize;
uniform COMPAT_PRECISION vec2 TextureSize;
uniform COMPAT_PRECISION vec2 InputSize;
void main()
{
    vec4 _Color;
    vec3 _col[9];
    float _lum[9];
    float _x;
    float _y;
    float _edge;
    _Color = COMPAT_TEXTURE(Texture, TEX0.xy);
    _a0016 = _Color.x*4.00000000E+00;
    _x0018 = _a0016 + 5.00000000E-01;
    _TMP15 = floor(_x0018);
    _Color.x = _TMP15/4.00000000E+00;
    _a0020 = _Color.y*4.00000000E+00;
    _x0022 = _a0020 + 5.00000000E-01;
    _TMP19 = floor(_x0022);
    _Color.y = _TMP19/4.00000000E+00;
    _a0024 = _Color.z*4.00000000E+00;
    _x0026 = _a0024 + 5.00000000E-01;
    _TMP23 = floor(_x0026);
    _Color.z = _TMP23/4.00000000E+00;
    _c0028 = TEX0.xy + vec2( -1.56250002E-03, 1.56250002E-03);
    _TMP5 = COMPAT_TEXTURE(Texture, _c0028);
    _col[0] = _TMP5.xyz;
    _c0028 = TEX0.xy + vec2( 0.00000000E+00, 1.56250002E-03);
    _TMP5 = COMPAT_TEXTURE(Texture, _c0028);
    _col[1] = _TMP5.xyz;
    _c0028 = TEX0.xy + vec2( 1.56250002E-03, 1.56250002E-03);
    _TMP5 = COMPAT_TEXTURE(Texture, _c0028);
    _col[2] = _TMP5.xyz;
    _c0028 = TEX0.xy + vec2( -1.56250002E-03, 0.00000000E+00);
    _TMP5 = COMPAT_TEXTURE(Texture, _c0028);
    _col[3] = _TMP5.xyz;
    _c0028 = TEX0.xy + vec2( 1.56250002E-03, 1.40000007E-03);
    _TMP5 = COMPAT_TEXTURE(Texture, _c0028);
    _col[5] = _TMP5.xyz;
    _c0028 = TEX0.xy + vec2( -1.56250002E-03, -1.56250002E-03);
    _TMP5 = COMPAT_TEXTURE(Texture, _c0028);
    _col[6] = _TMP5.xyz;
    _c0028 = TEX0.xy + vec2( 0.00000000E+00, -1.56250002E-03);
    _TMP5 = COMPAT_TEXTURE(Texture, _c0028);
    _col[7] = _TMP5.xyz;
    _c0028 = TEX0.xy + vec2( 1.56250002E-03, -1.56250002E-03);
    _TMP5 = COMPAT_TEXTURE(Texture, _c0028);
    _lum[0] = dot(_col[0].xyz, vec3( 3.00000012E-01, 5.89999974E-01, 1.09999999E-01));
    _lum[1] = dot(_col[1].xyz, vec3( 3.00000012E-01, 5.89999974E-01, 1.09999999E-01));
    _lum[2] = dot(_col[2].xyz, vec3( 3.00000012E-01, 5.89999974E-01, 1.09999999E-01));
    _lum[3] = dot(_col[3].xyz, vec3( 3.00000012E-01, 5.89999974E-01, 1.09999999E-01));
    _lum[5] = dot(_col[5].xyz, vec3( 3.00000012E-01, 5.89999974E-01, 1.09999999E-01));
    _lum[6] = dot(_col[6].xyz, vec3( 3.00000012E-01, 5.89999974E-01, 1.09999999E-01));
    _lum[7] = dot(_col[7].xyz, vec3( 3.00000012E-01, 5.89999974E-01, 1.09999999E-01));
    _lum[8] = dot(_TMP5.xyz, vec3( 3.00000012E-01, 5.89999974E-01, 1.09999999E-01));
    _x = (((_lum[2] + _lum[8] + 2.00000000E+00*_lum[5]) - _lum[0]) - 2.00000000E+00*_lum[3]) - _lum[6];
    _y = (((_lum[6] + 2.00000000E+00*_lum[7] + _lum[8]) - _lum[0]) - 2.00000000E+00*_lum[1]) - _lum[2];
    if (_x*_x + _y*_y < _threshold) { 
        _TMP6 = 1.00000000E+00;
    } else {
        _TMP6 = 0.00000000E+00;
    } 
    _edge = float(_TMP6);
    _Color.xyz = _Color.xyz*_edge;
    FragColor = _Color;
    return;
} 
#endif
