-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathphosphor-normalgamma.glsl
executable file
·500 lines (267 loc) · 8.11 KB
/
phosphor-normalgamma.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
// 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 _tex_index;
COMPAT_VARYING vec2 _coord_prev_prev;
COMPAT_VARYING vec2 _coord_prev;
COMPAT_VARYING vec2 _coord;
struct coords {
vec2 _coord;
vec2 _coord_prev;
vec2 _coord_prev_prev;
vec2 _tex_index;
};
struct input_dummy {
vec2 _video_size;
vec2 _texture_size;
vec2 _output_dummy_size;
float _frame_count;
float _frame_direction;
float _frame_rotation;
};
vec4 _oPosition1;
input_dummy _IN1;
vec4 _r0006;
COMPAT_ATTRIBUTE vec4 VertexCoord;
COMPAT_ATTRIBUTE vec4 TexCoord;
COMPAT_VARYING vec4 TEX1;
COMPAT_VARYING vec4 TEX2;
COMPAT_VARYING vec4 TEX3;
COMPAT_VARYING vec4 TEX4;
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()
{
coords _co;
vec2 _one_x;
_r0006 = VertexCoord.x*MVPMatrix[0];
_r0006 = _r0006 + VertexCoord.y*MVPMatrix[1];
_r0006 = _r0006 + VertexCoord.z*MVPMatrix[2];
_r0006 = _r0006 + VertexCoord.w*MVPMatrix[3];
_oPosition1 = _r0006;
_one_x = vec2(1.00000000E+000/(3.00000000E+000*TextureSize.x), 0.00000000E+000);
_co._coord = TexCoord.xy;
_co._coord_prev = TexCoord.xy - _one_x;
_co._coord_prev_prev = TexCoord.xy - 2.00000000E+000*_one_x;
_co._tex_index = TexCoord.xy*TextureSize;
gl_Position = _r0006;
TEX1.xy = TexCoord.xy;
TEX2.xy = _co._coord_prev;
TEX3.xy = _co._coord_prev_prev;
TEX4.xy = _co._tex_index;
}
#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 _tex_index;
COMPAT_VARYING vec2 _coord_prev_prev;
COMPAT_VARYING vec2 _coord_prev;
COMPAT_VARYING vec2 _coord;
struct coords {
vec2 _coord;
vec2 _coord_prev;
vec2 _coord_prev_prev;
vec2 _tex_index;
};
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 _TMP4;
vec3 _TMP13;
float _TMP12;
float _TMP11;
float _TMP10;
vec3 _TMP3;
float _TMP9;
float _TMP8;
float _TMP7;
float _TMP6;
vec4 _TMP2;
vec4 _TMP1;
vec4 _TMP0;
uniform sampler2D Texture;
float _c0017;
float _TMP24;
float _x0025;
vec3 _TMP58;
float _a0061;
float _c0061;
float _a0063;
vec3 _TMP68;
float _pixel0069;
float _a0071;
float _c0071;
float _a0073;
vec3 _TMP78;
float _pixel0079;
float _a0081;
float _c0081;
float _a0083;
vec3 _a0097;
vec3 _TMP104;
COMPAT_VARYING vec4 TEX1;
COMPAT_VARYING vec4 TEX2;
COMPAT_VARYING vec4 TEX3;
COMPAT_VARYING vec4 TEX4;
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;
vec3 _color_prev;
vec3 _color_prev_prev;
float _pixel_x;
vec3 _result;
_TMP6 = abs(TEX4.y);
_TMP7 = fract(_TMP6);
_TMP8 = abs(1.00000000E+000);
_c0017 = _TMP7*_TMP8;
if (TEX4.y < 0.00000000E+000) {
_TMP9 = -_c0017;
} else {
_TMP9 = _c0017;
}
_x0025 = -2.00000003E-001*_TMP9;
_TMP24 = pow(2.71828198E+000, _x0025);
_TMP0 = COMPAT_TEXTURE(Texture, TEX1.xy);
_TMP10 = pow(_TMP0.x, 2.40000010E+000);
_TMP11 = pow(_TMP0.y, 2.40000010E+000);
_TMP12 = pow(_TMP0.z, 2.40000010E+000);
_color = vec3(_TMP10, _TMP11, _TMP12);
_TMP1 = COMPAT_TEXTURE(Texture, TEX2.xy);
_TMP10 = pow(_TMP1.x, 2.40000010E+000);
_TMP11 = pow(_TMP1.y, 2.40000010E+000);
_TMP12 = pow(_TMP1.z, 2.40000010E+000);
_color_prev = vec3(_TMP10, _TMP11, _TMP12);
_TMP2 = COMPAT_TEXTURE(Texture, TEX3.xy);
_TMP10 = pow(_TMP2.x, 2.40000010E+000);
_TMP11 = pow(_TMP2.y, 2.40000010E+000);
_TMP12 = pow(_TMP2.z, 2.40000010E+000);
_color_prev_prev = vec3(_TMP10, _TMP11, _TMP12);
_pixel_x = 3.00000000E+000*TEX4.x;
_a0061 = _pixel_x + 3.00000000E+000;
_a0063 = _a0061/3.00000000E+000;
_TMP6 = abs(_a0063);
_TMP7 = fract(_TMP6);
_TMP8 = abs(3.00000000E+000);
_c0061 = _TMP7*_TMP8;
if (_a0061 < 0.00000000E+000) {
_TMP9 = -_c0061;
} else {
_TMP9 = _c0061;
}
if (_TMP9 >= 2.00000000E+000) {
_TMP58 = vec3(_TMP9 - 2.00000000E+000, 0.00000000E+000, 3.00000000E+000 - _TMP9);
} else {
if (_TMP9 >= 1.00000000E+000) {
_TMP58 = vec3(0.00000000E+000, 2.00000000E+000 - _TMP9, _TMP9 - 1.00000000E+000);
} else {
_TMP58 = vec3(1.00000000E+000 - _TMP9, _TMP9, 0.00000000E+000);
}
}
_pixel0069 = _pixel_x - 1.00000000E+000;
_a0071 = _pixel0069 + 3.00000000E+000;
_a0073 = _a0071/3.00000000E+000;
_TMP6 = abs(_a0073);
_TMP7 = fract(_TMP6);
_TMP8 = abs(3.00000000E+000);
_c0071 = _TMP7*_TMP8;
if (_a0071 < 0.00000000E+000) {
_TMP9 = -_c0071;
} else {
_TMP9 = _c0071;
}
if (_TMP9 >= 2.00000000E+000) {
_TMP68 = vec3(_TMP9 - 2.00000000E+000, 0.00000000E+000, 3.00000000E+000 - _TMP9);
} else {
if (_TMP9 >= 1.00000000E+000) {
_TMP68 = vec3(0.00000000E+000, 2.00000000E+000 - _TMP9, _TMP9 - 1.00000000E+000);
} else {
_TMP68 = vec3(1.00000000E+000 - _TMP9, _TMP9, 0.00000000E+000);
}
}
_pixel0079 = _pixel_x - 2.00000000E+000;
_a0081 = _pixel0079 + 3.00000000E+000;
_a0083 = _a0081/3.00000000E+000;
_TMP6 = abs(_a0083);
_TMP7 = fract(_TMP6);
_TMP8 = abs(3.00000000E+000);
_c0081 = _TMP7*_TMP8;
if (_a0081 < 0.00000000E+000) {
_TMP9 = -_c0081;
} else {
_TMP9 = _c0081;
}
if (_TMP9 >= 2.00000000E+000) {
_TMP78 = vec3(_TMP9 - 2.00000000E+000, 0.00000000E+000, 3.00000000E+000 - _TMP9);
} else {
if (_TMP9 >= 1.00000000E+000) {
_TMP78 = vec3(0.00000000E+000, 2.00000000E+000 - _TMP9, _TMP9 - 1.00000000E+000);
} else {
_TMP78 = vec3(1.00000000E+000 - _TMP9, _TMP9, 0.00000000E+000);
}
}
_result = (8.00000012E-001*_color)*_TMP58 + (6.00000024E-001*_color_prev)*_TMP68 + (3.00000012E-001*_color_prev_prev)*_TMP78;
_TMP10 = pow(_result.x, 1.39999998E+000);
_TMP11 = pow(_result.y, 1.39999998E+000);
_TMP12 = pow(_result.z, 1.39999998E+000);
_TMP3 = vec3(_TMP10, _TMP11, _TMP12);
_result = 2.29999995E+000*_TMP3;
_result = _result*vec3( 1.45000005E+000, 1.45000005E+000, 1.45000005E+000);
_a0097 = _TMP24*_result;
_TMP10 = pow(_a0097.x, 4.54545438E-001);
_TMP11 = pow(_a0097.y, 4.54545438E-001);
_TMP12 = pow(_a0097.z, 4.54545438E-001);
_TMP4 = vec3(_TMP10, _TMP11, _TMP12);
_TMP13 = min(vec3( 1.00000000E+000, 1.00000000E+000, 1.00000000E+000), _TMP4);
_TMP104 = max(vec3( 0.00000000E+000, 0.00000000E+000, 0.00000000E+000), _TMP13);
_ret_0 = vec4(_TMP104.x, _TMP104.y, _TMP104.z, 1.00000000E+000);
FragColor = _ret_0;
return;
}
#endif