-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy path5xbr-retro.glsl
287 lines (281 loc) · 7.53 KB
/
5xbr-retro.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
// 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 vec4 _t1;
COMPAT_VARYING vec2 _texCoord2;
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 out_vertex {
vec4 _position1;
vec2 _texCoord2;
vec4 _t1;
};
out_vertex _ret_0;
input_dummy _IN1;
vec4 _r0008;
COMPAT_ATTRIBUTE vec4 VertexCoord;
COMPAT_ATTRIBUTE vec4 TexCoord;
COMPAT_VARYING vec4 TEX0;
COMPAT_VARYING vec4 TEX1;
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()
{
out_vertex _OUT;
vec2 _ps;
vec2 _texCoord;
_r0008 = VertexCoord.x*MVPMatrix[0];
_r0008 = _r0008 + VertexCoord.y*MVPMatrix[1];
_r0008 = _r0008 + VertexCoord.z*MVPMatrix[2];
_r0008 = _r0008 + VertexCoord.w*MVPMatrix[3];
_ps = vec2(1.00000000E+00/TextureSize.x, 1.00000000E+00/TextureSize.y);
_texCoord = TexCoord.xy + vec2( 1.00000001E-07, 1.00000001E-07);
_OUT._t1.xy = vec2(0.00000000E+00, -_ps.y);
_OUT._t1.zw = vec2(-_ps.x, 0.00000000E+00);
_ret_0._position1 = _r0008;
_ret_0._texCoord2 = _texCoord;
_ret_0._t1 = _OUT._t1;
gl_Position = _r0008;
TEX0.xy = _texCoord;
TEX1 = _OUT._t1;
return;
TEX0.xy = _ret_0._texCoord2;
TEX1 = _ret_0._t1;
}
#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 vec4 _t1;
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 _t1;
};
vec4 _ret_0;
vec3 _TMP18;
vec3 _TMP19;
float _TMP15;
float _TMP14;
float _TMP13;
vec4 _TMP12;
vec4 _TMP11;
vec4 _TMP10;
vec4 _TMP9;
vec4 _TMP8;
vec4 _TMP7;
vec4 _TMP6;
vec4 _TMP5;
vec4 _TMP4;
vec4 _TMP3;
vec4 _TMP2;
vec4 _TMP1;
vec2 _TMP0;
uniform sampler2D Texture;
input_dummy _IN1;
vec2 _x0032;
vec2 _val0034;
vec2 _c0036;
vec2 _c0038;
vec2 _c0040;
vec2 _c0044;
vec2 _c0046;
vec2 _c0048;
vec2 _c0050;
vec2 _c0052;
vec2 _c0054;
vec2 _c0056;
vec2 _c0058;
float _TMP59;
float _TMP63;
float _TMP67;
float _TMP71;
float _TMP75;
float _TMP79;
float _TMP83;
float _TMP87;
float _TMP91;
float _TMP95;
float _TMP99;
float _TMP103;
float _TMP111;
float _a0114;
float _TMP115;
float _a0118;
float _TMP119;
float _a0122;
float _TMP123;
float _a0126;
float _TMP127;
float _a0130;
float _TMP133;
float _a0136;
float _TMP137;
float _a0140;
float _TMP141;
float _a0144;
float _TMP145;
float _a0148;
float _TMP149;
float _a0152;
float _TMP153;
float _a0156;
float _TMP157;
float _a0160;
COMPAT_VARYING vec4 TEX0;
COMPAT_VARYING vec4 TEX1;
uniform int FrameDirection;
uniform int FrameCount;
uniform COMPAT_PRECISION vec2 OutputSize;
uniform COMPAT_PRECISION vec2 TextureSize;
uniform COMPAT_PRECISION vec2 InputSize;
void main()
{
bool _edr;
bool _px;
bool _interp_restriction_lv1;
bool _nc;
bool _fx;
vec2 _pos;
vec2 _dir;
vec2 _g1;
vec2 _g2;
_x0032 = TEX0.xy*TextureSize;
_TMP0 = fract(_x0032);
_pos = _TMP0 - vec2( 5.00000000E-01, 5.00000000E-01);
_val0034 = vec2(float((_pos.x > 0.00000000E+00)), float((_pos.y > 0.00000000E+00)));
_dir = _val0034 - vec2(float((_pos.x < 0.00000000E+00)), float((_pos.y < 0.00000000E+00)));
_g1 = _dir*TEX1.xy;
_g2 = _dir*TEX1.zw;
_c0036 = TEX0.xy + _g1;
_TMP1 = COMPAT_TEXTURE(Texture, _c0036);
_c0038 = (TEX0.xy + _g1) - _g2;
_TMP2 = COMPAT_TEXTURE(Texture, _c0038);
_c0040 = TEX0.xy + _g2;
_TMP3 = COMPAT_TEXTURE(Texture, _c0040);
_TMP4 = COMPAT_TEXTURE(Texture, TEX0.xy);
_c0044 = TEX0.xy - _g2;
_TMP5 = COMPAT_TEXTURE(Texture, _c0044);
_c0046 = (TEX0.xy - _g1) + _g2;
_TMP6 = COMPAT_TEXTURE(Texture, _c0046);
_c0048 = TEX0.xy - _g1;
_TMP7 = COMPAT_TEXTURE(Texture, _c0048);
_c0050 = (TEX0.xy - _g1) - _g2;
_TMP8 = COMPAT_TEXTURE(Texture, _c0050);
_c0052 = TEX0.xy - 2.00000000E+00*_g2;
_TMP9 = COMPAT_TEXTURE(Texture, _c0052);
_c0054 = (TEX0.xy - _g1) - 2.00000000E+00*_g2;
_TMP10 = COMPAT_TEXTURE(Texture, _c0054);
_c0056 = TEX0.xy - 2.00000000E+00*_g1;
_TMP11 = COMPAT_TEXTURE(Texture, _c0056);
_c0058 = (TEX0.xy - 2.00000000E+00*_g1) - _g2;
_TMP12 = COMPAT_TEXTURE(Texture, _c0058);
_TMP59 = dot(_TMP1.xyz, vec3( 1.43519993E+01, 2.81760006E+01, 5.47200012E+00));
_TMP63 = dot(_TMP2.xyz, vec3( 1.43519993E+01, 2.81760006E+01, 5.47200012E+00));
_TMP67 = dot(_TMP3.xyz, vec3( 1.43519993E+01, 2.81760006E+01, 5.47200012E+00));
_TMP71 = dot(_TMP4.xyz, vec3( 1.43519993E+01, 2.81760006E+01, 5.47200012E+00));
_TMP75 = dot(_TMP5.xyz, vec3( 1.43519993E+01, 2.81760006E+01, 5.47200012E+00));
_TMP79 = dot(_TMP6.xyz, vec3( 1.43519993E+01, 2.81760006E+01, 5.47200012E+00));
_TMP83 = dot(_TMP7.xyz, vec3( 1.43519993E+01, 2.81760006E+01, 5.47200012E+00));
_TMP87 = dot(_TMP8.xyz, vec3( 1.43519993E+01, 2.81760006E+01, 5.47200012E+00));
_TMP91 = dot(_TMP10.xyz, vec3( 1.43519993E+01, 2.81760006E+01, 5.47200012E+00));
_TMP95 = dot(_TMP12.xyz, vec3( 1.43519993E+01, 2.81760006E+01, 5.47200012E+00));
_TMP99 = dot(_TMP11.xyz, vec3( 1.43519993E+01, 2.81760006E+01, 5.47200012E+00));
_TMP103 = dot(_TMP9.xyz, vec3( 1.43519993E+01, 2.81760006E+01, 5.47200012E+00));
_TMP13 = dot(_dir, _pos);
_fx = _TMP13 > 7.50000000E-01;
_interp_restriction_lv1 = _TMP71 != _TMP75 && _TMP71 != _TMP83;
_a0114 = _TMP71 - _TMP63;
_TMP111 = abs(_a0114);
_a0118 = _TMP71 - _TMP79;
_TMP115 = abs(_a0118);
_a0122 = _TMP87 - _TMP99;
_TMP119 = abs(_a0122);
_a0126 = _TMP87 - _TMP103;
_TMP123 = abs(_a0126);
_a0130 = _TMP83 - _TMP75;
_TMP127 = abs(_a0130);
_TMP14 = _TMP111 + _TMP115 + _TMP119 + _TMP123 + 4.00000000E+00*_TMP127;
_a0136 = _TMP83 - _TMP67;
_TMP133 = abs(_a0136);
_a0140 = _TMP83 - _TMP95;
_TMP137 = abs(_a0140);
_a0144 = _TMP75 - _TMP91;
_TMP141 = abs(_a0144);
_a0148 = _TMP75 - _TMP59;
_TMP145 = abs(_a0148);
_a0152 = _TMP71 - _TMP87;
_TMP149 = abs(_a0152);
_TMP15 = _TMP133 + _TMP137 + _TMP141 + _TMP145 + 4.00000000E+00*_TMP149;
_edr = _TMP14 < _TMP15 && _interp_restriction_lv1;
_nc = _edr && _fx;
_a0156 = _TMP71 - _TMP75;
_TMP153 = abs(_a0156);
_a0160 = _TMP71 - _TMP83;
_TMP157 = abs(_a0160);
_px = _TMP153 <= _TMP157;
if (_nc) {
if (_px) {
_TMP19 = _TMP5.xyz;
} else {
_TMP19 = _TMP7.xyz;
}
_TMP18 = _TMP19;
} else {
_TMP18 = _TMP4.xyz;
}
_ret_0 = vec4(_TMP18.x, _TMP18.y, _TMP18.z, 1.00000000E+00);
FragColor = _ret_0;
return;
}
#endif