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

302 lines
9.3 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 vec2 _texCoord1;
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 out_vertex {
vec2 _texCoord1;
};
vec4 _oPosition1;
out_vertex _ret_0;
vec4 _r0008;
COMPAT_ATTRIBUTE vec4 gl_Vertex;
COMPAT_ATTRIBUTE vec4 gl_MultiTexCoord0;
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()
{
_r0008 = gl_Vertex.x*gl_ModelViewProjectionMatrix[0];
_r0008 = _r0008 + gl_Vertex.y*gl_ModelViewProjectionMatrix[1];
_r0008 = _r0008 + gl_Vertex.z*gl_ModelViewProjectionMatrix[2];
_r0008 = _r0008 + gl_Vertex.w*gl_ModelViewProjectionMatrix[3];
_oPosition1 = _r0008;
_ret_0._texCoord1 = gl_MultiTexCoord0.xy;
gl_Position = _r0008;
TEX0.xy = gl_MultiTexCoord0.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 _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 out_vertex {
vec2 _texCoord;
};
vec4 _ret_0;
float _TMP21;
float _TMP20;
float _TMP19;
vec3 _TMP18;
float _TMP17;
float _TMP27;
float _TMP26;
float _TMP25;
float _TMP24;
vec3 _TMP23;
vec3 _TMP22;
vec3 _TMP15;
vec3 _TMP14;
vec3 _TMP13;
vec3 _TMP12;
vec4 _TMP11;
vec4 _TMP10;
vec4 _TMP9;
vec4 _TMP8;
vec4 _TMP7;
vec4 _TMP6;
vec4 _TMP5;
vec4 _TMP4;
vec2 _TMP2;
vec2 _TMP0;
uniform sampler2D Texture;
input_dummy _IN1;
vec2 _a0037;
vec2 _a0039;
vec2 _a0045;
vec2 _c0053;
vec2 _c0063;
vec2 _c0073;
vec2 _c0083;
vec2 _c0093;
vec2 _c0113;
vec2 _c0123;
vec4 _r0145;
vec4 _v0145;
vec3 _r0155;
vec3 _r0157;
vec3 _TMP158;
vec3 _TMP166;
vec3 _TMP178;
vec3 _x0179;
vec3 _TMP184;
vec3 _x0185;
vec3 _TMP190;
vec3 _x0191;
vec3 _TMP200;
vec3 _x0201;
vec3 _TMP210;
vec3 _x0211;
float _a0217;
float _c0219;
float _a0221;
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()
{
vec3 _color;
vec2 _TextureSize;
vec2 _pix_coord;
vec3 _c00;
vec3 _c01;
vec3 _c02;
vec3 _c03;
vec3 _c10;
vec3 _c11;
vec3 _c12;
vec3 _c13;
vec3 _min_sample;
vec3 _max_sample;
vec3 _color0;
vec3 _color1;
float _pos1;
vec3 _lum0;
vec3 _lum1;
vec3 _dotMaskWeights;
_TextureSize = vec2(TextureSize.x, TextureSize.y);
_a0037 = vec2(1.00000000E+00/_TextureSize.x, 0.00000000E+00);
_a0039 = vec2(0.00000000E+00, 1.00000000E+00/_TextureSize.y);
_pix_coord = TEX0.xy*_TextureSize + vec2( -5.00000000E-01, 5.00000000E-01);
_TMP0 = floor(_pix_coord);
_a0045 = (_TMP0 + vec2( 5.00000000E-01, 5.00000000E-01))/_TextureSize;
_TMP2 = fract(_pix_coord);
_c0053 = (_a0045 - _a0037) - _a0039;
_TMP4 = COMPAT_TEXTURE(Texture, _c0053);
_TMP19 = pow(_TMP4.x, 2.50000000E+00);
_TMP20 = pow(_TMP4.y, 2.50000000E+00);
_TMP21 = pow(_TMP4.z, 2.50000000E+00);
_c00 = vec3(_TMP19, _TMP20, _TMP21);
_c0063 = _a0045 - _a0039;
_TMP5 = COMPAT_TEXTURE(Texture, _c0063);
_TMP19 = pow(_TMP5.x, 2.50000000E+00);
_TMP20 = pow(_TMP5.y, 2.50000000E+00);
_TMP21 = pow(_TMP5.z, 2.50000000E+00);
_c01 = vec3(_TMP19, _TMP20, _TMP21);
_c0073 = (_a0045 + _a0037) - _a0039;
_TMP6 = COMPAT_TEXTURE(Texture, _c0073);
_TMP19 = pow(_TMP6.x, 2.50000000E+00);
_TMP20 = pow(_TMP6.y, 2.50000000E+00);
_TMP21 = pow(_TMP6.z, 2.50000000E+00);
_c02 = vec3(_TMP19, _TMP20, _TMP21);
_c0083 = (_a0045 + 2.00000000E+00*_a0037) - _a0039;
_TMP7 = COMPAT_TEXTURE(Texture, _c0083);
_TMP19 = pow(_TMP7.x, 2.50000000E+00);
_TMP20 = pow(_TMP7.y, 2.50000000E+00);
_TMP21 = pow(_TMP7.z, 2.50000000E+00);
_c03 = vec3(_TMP19, _TMP20, _TMP21);
_c0093 = _a0045 - _a0037;
_TMP8 = COMPAT_TEXTURE(Texture, _c0093);
_TMP19 = pow(_TMP8.x, 2.50000000E+00);
_TMP20 = pow(_TMP8.y, 2.50000000E+00);
_TMP21 = pow(_TMP8.z, 2.50000000E+00);
_c10 = vec3(_TMP19, _TMP20, _TMP21);
_TMP9 = COMPAT_TEXTURE(Texture, _a0045);
_TMP19 = pow(_TMP9.x, 2.50000000E+00);
_TMP20 = pow(_TMP9.y, 2.50000000E+00);
_TMP21 = pow(_TMP9.z, 2.50000000E+00);
_c11 = vec3(_TMP19, _TMP20, _TMP21);
_c0113 = _a0045 + _a0037;
_TMP10 = COMPAT_TEXTURE(Texture, _c0113);
_TMP19 = pow(_TMP10.x, 2.50000000E+00);
_TMP20 = pow(_TMP10.y, 2.50000000E+00);
_TMP21 = pow(_TMP10.z, 2.50000000E+00);
_c12 = vec3(_TMP19, _TMP20, _TMP21);
_c0123 = _a0045 + 2.00000000E+00*_a0037;
_TMP11 = COMPAT_TEXTURE(Texture, _c0123);
_TMP19 = pow(_TMP11.x, 2.50000000E+00);
_TMP20 = pow(_TMP11.y, 2.50000000E+00);
_TMP21 = pow(_TMP11.z, 2.50000000E+00);
_c13 = vec3(_TMP19, _TMP20, _TMP21);
_TMP12 = min(_c01, _c11);
_TMP13 = min(_c02, _c12);
_min_sample = min(_TMP12, _TMP13);
_TMP14 = max(_c01, _c11);
_TMP15 = max(_c02, _c12);
_max_sample = max(_TMP14, _TMP15);
_v0145 = vec4(_TMP2.x*_TMP2.x*_TMP2.x, _TMP2.x*_TMP2.x, _TMP2.x, 1.00000000E+00);
_r0145.x = dot(vec4( -5.00000000E-01, 1.00000000E+00, -5.00000000E-01, 0.00000000E+00), _v0145);
_r0145.y = dot(vec4( 1.50000000E+00, -2.50000000E+00, 0.00000000E+00, 1.00000000E+00), _v0145);
_r0145.z = dot(vec4( -1.50000000E+00, 2.00000000E+00, 5.00000000E-01, 0.00000000E+00), _v0145);
_r0145.w = dot(vec4( 5.00000000E-01, -5.00000000E-01, 0.00000000E+00, 0.00000000E+00), _v0145);
_r0155 = _r0145.x*_c00;
_r0155 = _r0155 + _r0145.y*_c01;
_r0155 = _r0155 + _r0145.z*_c02;
_r0155 = _r0155 + _r0145.w*_c03;
_r0157 = _r0145.x*_c10;
_r0157 = _r0157 + _r0145.y*_c11;
_r0157 = _r0157 + _r0145.z*_c12;
_r0157 = _r0157 + _r0145.w*_c13;
_TMP22 = min(_max_sample, _r0155);
_TMP158 = max(_min_sample, _TMP22);
_color0 = _r0155 + 8.00000012E-01*(_TMP158 - _r0155);
_TMP22 = min(_max_sample, _r0157);
_TMP166 = max(_min_sample, _TMP22);
_color1 = _r0157 + 8.00000012E-01*(_TMP166 - _r0157);
_pos1 = 1.00000000E+00 - _TMP2.y;
_lum0 = vec3( 8.60000014E-01, 8.60000014E-01, 8.60000014E-01) + _color0*vec3( 1.39999986E-01, 1.39999986E-01, 1.39999986E-01);
_lum1 = vec3( 8.60000014E-01, 8.60000014E-01, 8.60000014E-01) + _color1*vec3( 1.39999986E-01, 1.39999986E-01, 1.39999986E-01);
_x0179 = _TMP2.y/(_lum0 + 1.00000001E-07);
_TMP23 = min(vec3( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00), _x0179);
_TMP178 = max(vec3( 0.00000000E+00, 0.00000000E+00, 0.00000000E+00), _TMP23);
_x0185 = _pos1/(_lum1 + 1.00000001E-07);
_TMP23 = min(vec3( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00), _x0185);
_TMP184 = max(vec3( 0.00000000E+00, 0.00000000E+00, 0.00000000E+00), _TMP23);
_x0191 = (-5.00000000E+00*_TMP178)*_TMP178;
_TMP19 = pow(2.71828198E+00, _x0191.x);
_TMP20 = pow(2.71828198E+00, _x0191.y);
_TMP21 = pow(2.71828198E+00, _x0191.z);
_TMP190 = vec3(_TMP19, _TMP20, _TMP21);
_x0201 = (-5.00000000E+00*_TMP184)*_TMP184;
_TMP19 = pow(2.71828198E+00, _x0201.x);
_TMP20 = pow(2.71828198E+00, _x0201.y);
_TMP21 = pow(2.71828198E+00, _x0201.z);
_TMP200 = vec3(_TMP19, _TMP20, _TMP21);
_x0211 = _color0*_TMP190 + _color1*_TMP200;
_TMP23 = min(vec3( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00), _x0211);
_TMP210 = max(vec3( 0.00000000E+00, 0.00000000E+00, 0.00000000E+00), _TMP23);
_color = _TMP210*vec3( 1.50000000E+00, 1.50000000E+00, 1.50000000E+00);
_a0217 = (TEX0.x*OutputSize.x*TextureSize.x)/InputSize.x;
_a0221 = _a0217/2.00000000E+00;
_TMP24 = abs(_a0221);
_TMP25 = fract(_TMP24);
_TMP26 = abs(2.00000000E+00);
_c0219 = _TMP25*_TMP26;
if (_a0217 < 0.00000000E+00) {
_TMP27 = -_c0219;
} else {
_TMP27 = _c0219;
}
_TMP17 = floor(_TMP27);
_dotMaskWeights = vec3( 1.00000000E+00, 6.99999988E-01, 1.00000000E+00) + _TMP17*vec3( -3.00000012E-01, 3.00000012E-01, -3.00000012E-01);
_TMP18 = vec3( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00) + (_dotMaskWeights - vec3( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));
_color.xyz = _color.xyz*_TMP18;
_TMP19 = pow(_color.x, 4.54545438E-01);
_TMP20 = pow(_color.y, 4.54545438E-01);
_TMP21 = pow(_color.z, 4.54545438E-01);
_color = vec3(_TMP19, _TMP20, _TMP21);
_ret_0 = vec4(_color.x, _color.y, _color.z, 1.00000000E+00);
FragColor = _ret_0;
return;
}
#endif