-
Notifications
You must be signed in to change notification settings - Fork 28
/
cgwg-CRT-flat.glsl
executable file
·597 lines (303 loc) · 9.89 KB
/
cgwg-CRT-flat.glsl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
// GLSL shader autogenerated by cg2glsl.py.
#if defined(VERTEX)
varying vec3 VARmod_factor_ratio_scale;
varying vec4 VARc22_32;
varying vec4 VARc02_12;
varying vec4 VARc21_31;
varying vec4 VARc01_11;
struct tex_coords {
vec4 VARc01_11;
vec4 VARc21_31;
vec4 VARc02_12;
vec4 VARc22_32;
vec3 VARmod_factor_ratio_scale;
};
struct input_dummy {
vec2 _video_size;
vec2 _texture_size;
vec2 _output_dummy_size;
};
vec4 _oPosition1;
tex_coords _coords1;
uniform mat4 MVPMatrix;
input_dummy _IN1;
vec4 _r0013;
attribute vec4 VertexCoord;
attribute vec4 COLOR;
varying vec4 COL0;
attribute vec4 TexCoord;
mat4 transpose_(mat4 matrix)
{
mat4 ret;
for (int i = 0; i != 4; i++)
for (int j = 0; j != 4; j++)
ret[i][j] = matrix[j][i];
return ret;
}
uniform int FrameDirection;
uniform int FrameCount;
#ifdef GL_ES
uniform mediump vec2 OutputSize;
uniform mediump vec2 TextureSize;
uniform mediump vec2 InputSize;
#else
uniform vec2 OutputSize;
uniform vec2 TextureSize;
uniform vec2 InputSize;
#endif
void main()
{
mat4 MVPMatrix_ = transpose_(MVPMatrix);
vec4 _oColor;
vec2 _delta;
vec2 _TMP2;
vec2 _TMP3;
vec2 _TMP4;
vec2 _TMP5;
vec2 _TMP6;
vec2 _TMP7;
vec2 _TMP8;
vec2 _TMP9;
tex_coords _TMP11;
_r0013.x = dot(MVPMatrix_[0], VertexCoord);
_r0013.y = dot(MVPMatrix_[1], VertexCoord);
_r0013.z = dot(MVPMatrix_[2], VertexCoord);
_r0013.w = dot(MVPMatrix_[3], VertexCoord);
_oPosition1 = _r0013;
_oColor = COLOR;
_delta = 1.00000000E+000/TextureSize;
_TMP9 = TexCoord.xy + vec2(-_delta.x, 0.00000000E+000);
_TMP11.VARc01_11 = vec4(_TMP9.x, _TMP9.y, TexCoord.x, TexCoord.y);
_TMP7 = TexCoord.xy + vec2(_delta.x, 0.00000000E+000);
_TMP8 = TexCoord.xy + vec2(2.00000000E+000*_delta.x, 0.00000000E+000);
_TMP11.VARc21_31 = vec4(_TMP7.x, _TMP7.y, _TMP8.x, _TMP8.y);
_TMP5 = TexCoord.xy + vec2(-_delta.x, _delta.y);
_TMP6 = TexCoord.xy + vec2(0.00000000E+000, _delta.y);
_TMP11.VARc02_12 = vec4(_TMP5.x, _TMP5.y, _TMP6.x, _TMP6.y);
_TMP3 = TexCoord.xy + vec2(_delta.x, _delta.y);
_TMP4 = TexCoord.xy + vec2(2.00000000E+000*_delta.x, _delta.y);
_TMP11.VARc22_32 = vec4(_TMP3.x, _TMP3.y, _TMP4.x, _TMP4.y);
_TMP2 = TexCoord.xy*TextureSize;
_TMP11.VARmod_factor_ratio_scale = vec3((TexCoord.x*OutputSize.x*TextureSize.x)/InputSize.x, _TMP2.x, _TMP2.y);
VARc01_11 = _TMP11.VARc01_11;
VARc21_31 = _TMP11.VARc21_31;
VARc02_12 = _TMP11.VARc02_12;
VARc22_32 = _TMP11.VARc22_32;
VARmod_factor_ratio_scale = _TMP11.VARmod_factor_ratio_scale;
gl_Position = _r0013;
COL0 = COLOR;
}
#elif defined(FRAGMENT)
#ifdef GL_ES
precision mediump float;
#endif
varying vec3 VARmod_factor_ratio_scale;
varying vec4 VARc22_32;
varying vec4 VARc02_12;
varying vec4 VARc21_31;
varying vec4 VARc01_11;
struct tex_coords {
vec4 VARc01_11;
vec4 VARc21_31;
vec4 VARc02_12;
vec4 VARc22_32;
vec3 VARmod_factor_ratio_scale;
};
struct input_dummy {
vec2 _video_size;
vec2 _texture_size;
vec2 _output_dummy_size;
};
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 _c0188;
float _a0190;
vec3 _a0200;
uniform int FrameDirection;
uniform int FrameCount;
#ifdef GL_ES
uniform mediump vec2 OutputSize;
uniform mediump vec2 TextureSize;
uniform mediump vec2 InputSize;
#else
uniform vec2 OutputSize;
uniform vec2 TextureSize;
uniform vec2 InputSize;
#endif
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(VARmod_factor_ratio_scale.yz);
_TMP0 = texture2D(Texture, VARc01_11.xy);
_TMP1 = texture2D(Texture, VARc01_11.zw);
_TMP2 = texture2D(Texture, VARc21_31.xy);
_TMP3 = texture2D(Texture, VARc21_31.zw);
_TMP4 = texture2D(Texture, VARc02_12.xy);
_TMP5 = texture2D(Texture, VARc02_12.zw);
_TMP6 = texture2D(Texture, VARc22_32.xy);
_TMP7 = texture2D(Texture, VARc22_32.zw);
_coeffs = vec4(1.00000000E+000 + _uv_ratio.x, _uv_ratio.x, 1.00000000E+000 - _uv_ratio.x, 2.00000000E+000 - _uv_ratio.x) + 4.99999989E-003;
_x0062 = 3.14159274E+000*_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+000*_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+000, 1.00000000E+000, 1.00000000E+000, 1.00000000E+000));
_coeffs = _coeffs/_TMP10;
_weights = vec3(3.32999992E+000*_uv_ratio.y, 3.32999992E+000*_uv_ratio.y, 3.32999992E+000*_uv_ratio.y);
_weights2 = vec3(_uv_ratio.y*-3.32999992E+000 + 3.32999992E+000, _uv_ratio.y*-3.32999992E+000 + 3.32999992E+000, _uv_ratio.y*-3.32999992E+000 + 3.32999992E+000);
_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+000, 1.00000000E+000, 1.00000000E+000), _r0084);
_TMP87 = max(vec3( 0.00000000E+000, 0.00000000E+000, 0.00000000E+000), _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+000, 1.00000000E+000, 1.00000000E+000), _r0094);
_TMP97 = max(vec3( 0.00000000E+000, 0.00000000E+000, 0.00000000E+000), _TMP36);
_TMP26 = pow(_TMP87.x, 4.00000000E+000);
_TMP27 = pow(_TMP87.y, 4.00000000E+000);
_TMP28 = pow(_TMP87.z, 4.00000000E+000);
_TMP13 = vec3(_TMP26, _TMP27, _TMP28);
_wid = 2.00000000E+000*_TMP13 + 2.00000000E+000;
_TMP26 = pow(_TMP97.x, 4.00000000E+000);
_TMP27 = pow(_TMP97.y, 4.00000000E+000);
_TMP28 = pow(_TMP97.z, 4.00000000E+000);
_TMP14 = vec3(_TMP26, _TMP27, _TMP28);
_wid2 = 2.00000000E+000*_TMP14 + 2.00000000E+000;
_TMP26 = pow(_TMP87.x, 2.70000005E+000);
_TMP27 = pow(_TMP87.y, 2.70000005E+000);
_TMP28 = pow(_TMP87.z, 2.70000005E+000);
_col = vec3(_TMP26, _TMP27, _TMP28);
_TMP26 = pow(_TMP97.x, 2.70000005E+000);
_TMP27 = pow(_TMP97.y, 2.70000005E+000);
_TMP28 = pow(_TMP97.z, 2.70000005E+000);
_col2 = vec3(_TMP26, _TMP27, _TMP28);
_x0136 = 5.00000000E-001*_wid;
_TMP29 = inversesqrt(_x0136.x);
_TMP30 = inversesqrt(_x0136.y);
_TMP31 = inversesqrt(_x0136.z);
_sqrt1 = vec3(_TMP29, _TMP30, _TMP31);
_x0144 = 5.00000000E-001*_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-001*_wid + 3.91999990E-001;
_div2 = 1.31999999E-001*_wid2 + 3.91999990E-001;
_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+000, _pow1.x);
_TMP27 = pow(2.71828198E+000, _pow1.y);
_TMP28 = pow(2.71828198E+000, _pow1.z);
_TMP167 = vec3(_TMP26, _TMP27, _TMP28);
_weights = _TMP167/_div1;
_TMP26 = pow(2.71828198E+000, _pow2.x);
_TMP27 = pow(2.71828198E+000, _pow2.y);
_TMP28 = pow(2.71828198E+000, _pow2.z);
_TMP177 = vec3(_TMP26, _TMP27, _TMP28);
_weights2 = _TMP177/_div2;
_multi = _col*_weights + _col2*_weights2;
_a0190 = VARmod_factor_ratio_scale.x/2.00000000E+000;
_TMP32 = abs(_a0190);
_TMP33 = fract(_TMP32);
_TMP34 = abs(2.00000000E+000);
_c0188 = _TMP33*_TMP34;
if (VARmod_factor_ratio_scale.x < 0.00000000E+000) {
_TMP35 = -_c0188;
} else {
_TMP35 = _c0188;
}
_TMP20 = floor(_TMP35);
_mcol = vec3( 1.00000000E+000, 6.99999988E-001, 1.00000000E+000) + _TMP20*vec3( -3.00000012E-001, 3.00000012E-001, -3.00000012E-001);
_a0200 = _mcol*_multi;
_TMP26 = pow(_a0200.x, 4.54544991E-001);
_TMP27 = pow(_a0200.y, 4.54544991E-001);
_TMP28 = pow(_a0200.z, 4.54544991E-001);
_TMP21 = vec3(_TMP26, _TMP27, _TMP28);
_ret_0 = vec4(_TMP21.x, _TMP21.y, _TMP21.z, 1.00000000E+000);
gl_FragColor = _ret_0;
return;
}
#endif