// 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 _M;
COMPAT_VARYING     vec2 _DR;
COMPAT_VARYING     vec2 _DL;
COMPAT_VARYING     vec2 _UR;
COMPAT_VARYING     vec2 _UL;
COMPAT_VARYING     vec4 _color;
COMPAT_VARYING     vec2 _texCoord1;
COMPAT_VARYING     vec4 _vpos1;
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;
    vec4 _vpos1;
    vec2 _texCoord1;
};
struct output_dummy {
    vec4 _color;
};
struct deltas {
    vec2 _UL;
    vec2 _UR;
    vec2 _DL;
    vec2 _DR;
    vec2 _M;
};
VERTEX_OUTPUT _ret_0;
vec4 _r0006;
COMPAT_ATTRIBUTE vec4 VertexCoord;
COMPAT_ATTRIBUTE vec4 TexCoord;
COMPAT_VARYING vec4 TEX1;
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()
{
    _r0006 = VertexCoord.x*MVPMatrix[0];
    _r0006 = _r0006 + VertexCoord.y*MVPMatrix[1];
    _r0006 = _r0006 + VertexCoord.z*MVPMatrix[2];
    _r0006 = _r0006 + VertexCoord.w*MVPMatrix[3];
    _ret_0._position1 = _r0006;
    _ret_0._vpos1 = _r0006;
    _ret_0._texCoord1 = TexCoord.xy;
    gl_Position = _r0006;
    TEX1 = _r0006;
    TEX0.xy = TexCoord.xy;
    return;
    TEX1 = _ret_0._vpos1;
    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 _M;
COMPAT_VARYING     vec2 _DR;
COMPAT_VARYING     vec2 _DL;
COMPAT_VARYING     vec2 _UR;
COMPAT_VARYING     vec2 _UL;
COMPAT_VARYING     vec4 _color;
COMPAT_VARYING     vec2 _texCoord;
COMPAT_VARYING     vec4 _vpos;
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 _vpos;
    vec2 _texCoord;
};
struct output_dummy {
    vec4 _color;
};
struct deltas {
    vec2 _UL;
    vec2 _UR;
    vec2 _DL;
    vec2 _DR;
    vec2 _M;
};
float _TMP12;
float _TMP11;
vec4 _TMP3;
vec4 _TMP2;
vec4 _TMP1;
vec4 _TMP0;
uniform sampler2D Texture;
input_dummy _IN1;
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()
{
    output_dummy _OUT;
    vec2 _ps;
    float _lumaUL;
    float _lumaUR;
    float _lumaDL;
    float _lumaDR;
    vec2 _dir;
    deltas _TMP16;
    _ps = vec2(9.99899983E-01/TextureSize.x, 9.99899983E-01/TextureSize.y);
    _TMP16._UL = TEX0.xy + vec2(-_ps.x, -_ps.y);
    _TMP16._UR = TEX0.xy + vec2(_ps.x, -_ps.y);
    _TMP16._DL = TEX0.xy + vec2(-_ps.x, _ps.y);
    _TMP16._DR = TEX0.xy + vec2(_ps.x, _ps.y);
    _TMP0 = COMPAT_TEXTURE(Texture, _TMP16._UL);
    _TMP1 = COMPAT_TEXTURE(Texture, _TMP16._UR);
    _TMP2 = COMPAT_TEXTURE(Texture, _TMP16._DL);
    _TMP3 = COMPAT_TEXTURE(Texture, _TMP16._DR);
    _lumaUL = dot(_TMP0.xyz, vec3( 2.98999995E-01, 5.87000012E-01, 1.14000000E-01));
    _lumaUR = dot(_TMP1.xyz, vec3( 2.98999995E-01, 5.87000012E-01, 1.14000000E-01));
    _lumaDL = dot(_TMP2.xyz, vec3( 2.98999995E-01, 5.87000012E-01, 1.14000000E-01));
    _lumaDR = dot(_TMP3.xyz, vec3( 2.98999995E-01, 5.87000012E-01, 1.14000000E-01));
    _dir.x = -((_lumaUL + _lumaUR) - (_lumaDR + _lumaDL));
    _dir.y = (_lumaUR + _lumaDR) - (_lumaUL + _lumaDL);
    _TMP11 = abs(_dir.x);
    _TMP12 = abs(_dir.y);
    _OUT._color = vec4(_TMP11 + _TMP12, _TMP11 + _TMP12, _TMP11 + _TMP12, _TMP11 + _TMP12);
    FragColor = _OUT._color;
    return;
} 
#endif
