Gobligine/tools/shaders/crt-cgwg-fast.cg.glsl
2016-05-26 01:57:32 +02:00

323 lines
9.6 KiB
GLSL

// 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 float _frame_rotation;
COMPAT_VARYING vec2 VARratio_scale;
COMPAT_VARYING float VARmod_factor;
COMPAT_VARYING vec2 VARc32;
COMPAT_VARYING vec2 VARc22;
COMPAT_VARYING vec2 VARc12;
COMPAT_VARYING vec2 VARc02;
COMPAT_VARYING vec2 VARc31;
COMPAT_VARYING vec2 VARc21;
COMPAT_VARYING vec2 VARc11;
COMPAT_VARYING vec2 VARc01;
struct tex_coords {
vec2 VARc01;
vec2 VARc11;
vec2 VARc21;
vec2 VARc31;
vec2 VARc02;
vec2 VARc12;
vec2 VARc22;
vec2 VARc32;
float VARmod_factor;
vec2 VARratio_scale;
};
struct input_dummy {
vec2 _video_size;
vec2 _texture_size;
vec2 _output_dummy_size;
float _frame_count;
float _frame_direction;
float _frame_rotation;
};
vec4 _oPosition1;
tex_coords _coords1;
input_dummy _IN1;
vec4 _r0006;
COMPAT_ATTRIBUTE vec4 gl_Vertex;
COMPAT_ATTRIBUTE vec4 gl_MultiTexCoord0;
uniform int FrameDirection;
uniform int FrameCount;
uniform COMPAT_PRECISION vec2 OutputSize;
uniform COMPAT_PRECISION vec2 TextureSize;
uniform COMPAT_PRECISION vec2 InputSize;
void main()
{
vec2 _delta;
_r0006 = gl_Vertex.x*gl_ModelViewProjectionMatrix[0];
_r0006 = _r0006 + gl_Vertex.y*gl_ModelViewProjectionMatrix[1];
_r0006 = _r0006 + gl_Vertex.z*gl_ModelViewProjectionMatrix[2];
_r0006 = _r0006 + gl_Vertex.w*gl_ModelViewProjectionMatrix[3];
_oPosition1 = _r0006;
_delta = 1.00000000E+00/TextureSize;
VARc01 = gl_MultiTexCoord0.xy + vec2(-_delta.x, 0.00000000E+00);
VARc11 = gl_MultiTexCoord0.xy;
VARc21 = gl_MultiTexCoord0.xy + vec2(_delta.x, 0.00000000E+00);
VARc31 = gl_MultiTexCoord0.xy + vec2(2.00000000E+00*_delta.x, 0.00000000E+00);
VARc02 = gl_MultiTexCoord0.xy + vec2(-_delta.x, _delta.y);
VARc12 = gl_MultiTexCoord0.xy + vec2(0.00000000E+00, _delta.y);
VARc22 = gl_MultiTexCoord0.xy + vec2(_delta.x, _delta.y);
VARc32 = gl_MultiTexCoord0.xy + vec2(2.00000000E+00*_delta.x, _delta.y);
VARmod_factor = (gl_MultiTexCoord0.x*OutputSize.x*TextureSize.x)/InputSize.x;
VARratio_scale = gl_MultiTexCoord0.xy*TextureSize;
gl_Position = _r0006;
}
#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 float _frame_rotation;
COMPAT_VARYING vec2 VARratio_scale;
COMPAT_VARYING float VARmod_factor;
COMPAT_VARYING vec2 VARc32;
COMPAT_VARYING vec2 VARc22;
COMPAT_VARYING vec2 VARc12;
COMPAT_VARYING vec2 VARc02;
COMPAT_VARYING vec2 VARc31;
COMPAT_VARYING vec2 VARc21;
COMPAT_VARYING vec2 VARc11;
COMPAT_VARYING vec2 VARc01;
struct tex_coords {
vec2 VARc01;
vec2 VARc11;
vec2 VARc21;
vec2 VARc31;
vec2 VARc02;
vec2 VARc12;
vec2 VARc22;
vec2 VARc32;
float VARmod_factor;
vec2 VARratio_scale;
};
struct input_dummy {
vec2 _video_size;
vec2 _texture_size;
vec2 _output_dummy_size;
float _frame_count;
float _frame_direction;
float _frame_rotation;
};
vec4 _ret_0;
vec3 _TMP21;
float _TMP28;
float _TMP27;
float _TMP26;
float _TMP20;
float _TMP35;
float _TMP34;
float _TMP33;
float _TMP32;
vec3 _TMP16;
vec3 _TMP15;
float _TMP31;
float _TMP30;
float _TMP29;
vec3 _TMP14;
vec3 _TMP13;
vec3 _TMP36;
float _TMP10;
vec4 _TMP9;
vec4 _TMP8;
float _TMP25;
float _TMP24;
float _TMP23;
float _TMP22;
vec4 _TMP7;
vec4 _TMP6;
vec4 _TMP5;
vec4 _TMP4;
vec4 _TMP3;
vec4 _TMP2;
vec4 _TMP1;
vec4 _TMP0;
tex_coords _co1;
uniform sampler2D Texture;
vec4 _x0062;
vec4 _x0072;
vec3 _r0084;
vec3 _TMP87;
vec3 _r0094;
vec3 _TMP97;
vec3 _x0136;
vec3 _x0144;
vec3 _TMP167;
vec3 _TMP177;
float VARc0188;
float _a0190;
vec3 _a0200;
uniform int FrameDirection;
uniform int FrameCount;
uniform COMPAT_PRECISION vec2 OutputSize;
uniform COMPAT_PRECISION vec2 TextureSize;
uniform COMPAT_PRECISION vec2 InputSize;
void main()
{
vec2 _uv_ratio;
vec3 _col;
vec3 _col2;
vec4 _coeffs;
vec3 _weights;
vec3 _weights2;
vec3 _wid;
vec3 _wid2;
vec3 _sqrt1;
vec3 _sqrt2;
vec3 _pow_mul1;
vec3 _pow_mul2;
vec3 _div1;
vec3 _div2;
vec3 _pow1;
vec3 _pow2;
vec3 _multi;
vec3 _mcol;
_uv_ratio = fract(VARratio_scale);
_TMP0 = COMPAT_TEXTURE(Texture, VARc01);
_TMP1 = COMPAT_TEXTURE(Texture, VARc11);
_TMP2 = COMPAT_TEXTURE(Texture, VARc21);
_TMP3 = COMPAT_TEXTURE(Texture, VARc31);
_TMP4 = COMPAT_TEXTURE(Texture, VARc02);
_TMP5 = COMPAT_TEXTURE(Texture, VARc12);
_TMP6 = COMPAT_TEXTURE(Texture, VARc22);
_TMP7 = COMPAT_TEXTURE(Texture, VARc32);
_coeffs = vec4(1.00000000E+00 + _uv_ratio.x, _uv_ratio.x, 1.00000000E+00 - _uv_ratio.x, 2.00000000E+00 - _uv_ratio.x) + 4.99999989E-03;
_x0062 = 3.14159274E+00*_coeffs;
_TMP22 = sin(_x0062.x);
_TMP23 = sin(_x0062.y);
_TMP24 = sin(_x0062.z);
_TMP25 = sin(_x0062.w);
_TMP8 = vec4(_TMP22, _TMP23, _TMP24, _TMP25);
_x0072 = 1.57079637E+00*_coeffs;
_TMP22 = sin(_x0072.x);
_TMP23 = sin(_x0072.y);
_TMP24 = sin(_x0072.z);
_TMP25 = sin(_x0072.w);
_TMP9 = vec4(_TMP22, _TMP23, _TMP24, _TMP25);
_coeffs = (_TMP8*_TMP9)/(_coeffs*_coeffs);
_TMP10 = dot(_coeffs, vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));
_coeffs = _coeffs/_TMP10;
_weights = vec3(3.32999992E+00*_uv_ratio.y, 3.32999992E+00*_uv_ratio.y, 3.32999992E+00*_uv_ratio.y);
_weights2 = vec3(_uv_ratio.y*-3.32999992E+00 + 3.32999992E+00, _uv_ratio.y*-3.32999992E+00 + 3.32999992E+00, _uv_ratio.y*-3.32999992E+00 + 3.32999992E+00);
_r0084 = _coeffs.x*_TMP0.xyz;
_r0084 = _r0084 + _coeffs.y*_TMP1.xyz;
_r0084 = _r0084 + _coeffs.z*_TMP2.xyz;
_r0084 = _r0084 + _coeffs.w*_TMP3.xyz;
_TMP36 = min(vec3( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00), _r0084);
_TMP87 = max(vec3( 0.00000000E+00, 0.00000000E+00, 0.00000000E+00), _TMP36);
_r0094 = _coeffs.x*_TMP4.xyz;
_r0094 = _r0094 + _coeffs.y*_TMP5.xyz;
_r0094 = _r0094 + _coeffs.z*_TMP6.xyz;
_r0094 = _r0094 + _coeffs.w*_TMP7.xyz;
_TMP36 = min(vec3( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00), _r0094);
_TMP97 = max(vec3( 0.00000000E+00, 0.00000000E+00, 0.00000000E+00), _TMP36);
_TMP26 = pow(_TMP87.x, 4.00000000E+00);
_TMP27 = pow(_TMP87.y, 4.00000000E+00);
_TMP28 = pow(_TMP87.z, 4.00000000E+00);
_TMP13 = vec3(_TMP26, _TMP27, _TMP28);
_wid = 2.00000000E+00*_TMP13 + 2.00000000E+00;
_TMP26 = pow(_TMP97.x, 4.00000000E+00);
_TMP27 = pow(_TMP97.y, 4.00000000E+00);
_TMP28 = pow(_TMP97.z, 4.00000000E+00);
_TMP14 = vec3(_TMP26, _TMP27, _TMP28);
_wid2 = 2.00000000E+00*_TMP14 + 2.00000000E+00;
_TMP26 = pow(_TMP87.x, 2.70000005E+00);
_TMP27 = pow(_TMP87.y, 2.70000005E+00);
_TMP28 = pow(_TMP87.z, 2.70000005E+00);
_col = vec3(_TMP26, _TMP27, _TMP28);
_TMP26 = pow(_TMP97.x, 2.70000005E+00);
_TMP27 = pow(_TMP97.y, 2.70000005E+00);
_TMP28 = pow(_TMP97.z, 2.70000005E+00);
_col2 = vec3(_TMP26, _TMP27, _TMP28);
_x0136 = 5.00000000E-01*_wid;
_TMP29 = inversesqrt(_x0136.x);
_TMP30 = inversesqrt(_x0136.y);
_TMP31 = inversesqrt(_x0136.z);
_sqrt1 = vec3(_TMP29, _TMP30, _TMP31);
_x0144 = 5.00000000E-01*_wid2;
_TMP29 = inversesqrt(_x0144.x);
_TMP30 = inversesqrt(_x0144.y);
_TMP31 = inversesqrt(_x0144.z);
_sqrt2 = vec3(_TMP29, _TMP30, _TMP31);
_pow_mul1 = _weights*_sqrt1;
_pow_mul2 = _weights2*_sqrt2;
_div1 = 1.31999999E-01*_wid + 3.91999990E-01;
_div2 = 1.31999999E-01*_wid2 + 3.91999990E-01;
_TMP26 = pow(_pow_mul1.x, _wid.x);
_TMP27 = pow(_pow_mul1.y, _wid.y);
_TMP28 = pow(_pow_mul1.z, _wid.z);
_TMP15 = vec3(_TMP26, _TMP27, _TMP28);
_pow1 = -_TMP15;
_TMP26 = pow(_pow_mul2.x, _wid2.x);
_TMP27 = pow(_pow_mul2.y, _wid2.y);
_TMP28 = pow(_pow_mul2.z, _wid2.z);
_TMP16 = vec3(_TMP26, _TMP27, _TMP28);
_pow2 = -_TMP16;
_TMP26 = pow(2.71828198E+00, _pow1.x);
_TMP27 = pow(2.71828198E+00, _pow1.y);
_TMP28 = pow(2.71828198E+00, _pow1.z);
_TMP167 = vec3(_TMP26, _TMP27, _TMP28);
_weights = _TMP167/_div1;
_TMP26 = pow(2.71828198E+00, _pow2.x);
_TMP27 = pow(2.71828198E+00, _pow2.y);
_TMP28 = pow(2.71828198E+00, _pow2.z);
_TMP177 = vec3(_TMP26, _TMP27, _TMP28);
_weights2 = _TMP177/_div2;
_multi = _col*_weights + _col2*_weights2;
_a0190 = VARmod_factor/2.00000000E+00;
_TMP32 = abs(_a0190);
_TMP33 = fract(_TMP32);
_TMP34 = abs(2.00000000E+00);
VARc0188 = _TMP33*_TMP34;
if (VARmod_factor < 0.00000000E+00) {
_TMP35 = -VARc0188;
} else {
_TMP35 = VARc0188;
}
_TMP20 = floor(_TMP35);
_mcol = vec3( 1.00000000E+00, 6.99999988E-01, 1.00000000E+00) + _TMP20*vec3( -3.00000012E-01, 3.00000012E-01, -3.00000012E-01);
_a0200 = _mcol*_multi;
_TMP26 = pow(_a0200.x, 4.54544991E-01);
_TMP27 = pow(_a0200.y, 4.54544991E-01);
_TMP28 = pow(_a0200.z, 4.54544991E-01);
_TMP21 = vec3(_TMP26, _TMP27, _TMP28);
_ret_0 = vec4(_TMP21.x, _TMP21.y, _TMP21.z, 1.00000000E+00);
FragColor = _ret_0;
return;
}
#endif