-
Notifications
You must be signed in to change notification settings - Fork 4
/
compiler.h
279 lines (243 loc) · 5.01 KB
/
compiler.h
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
/*
* Flickernoise
* Copyright (C) 2010, 2011 Sebastien Bourdeauducq
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __COMPILER_H
#define __COMPILER_H
#ifndef STANDALONE
#include <rtems.h>
#include <bsp/milkymist_pfpu.h>
#else
#include STANDALONE
#endif /* STANDALONE */
#include <sys/stat.h>
#include <fpvm/fpvm.h>
#include "../renderer/framedescriptor.h"
#include "../renderer/stimuli.h"
#include "../pixbuf/pixbuf.h"
enum {
pfv_sx = 0,
pfv_sy,
pfv_cx,
pfv_cy,
pfv_rot,
pfv_dx,
pfv_dy,
pfv_zoom,
pfv_decay,
pfv_wave_mode,
pfv_wave_scale,
pfv_wave_additive,
pfv_wave_usedots,
pfv_wave_brighten,
pfv_wave_thick,
pfv_wave_x,
pfv_wave_y,
pfv_wave_r,
pfv_wave_g,
pfv_wave_b,
pfv_wave_a,
pfv_ob_size,
pfv_ob_r,
pfv_ob_g,
pfv_ob_b,
pfv_ob_a,
pfv_ib_size,
pfv_ib_r,
pfv_ib_g,
pfv_ib_b,
pfv_ib_a,
pfv_mv_x,
pfv_mv_y,
pfv_mv_dx,
pfv_mv_dy,
pfv_mv_l,
pfv_mv_r,
pfv_mv_g,
pfv_mv_b,
pfv_mv_a,
pfv_tex_wrap,
pfv_time,
pfv_frame,
pfv_bass,
pfv_mid,
pfv_treb,
pfv_bass_att,
pfv_mid_att,
pfv_treb_att,
pfv_warp,
pfv_warp_anim_speed,
pfv_warp_scale,
pfv_q1,
pfv_q2,
pfv_q3,
pfv_q4,
pfv_q5,
pfv_q6,
pfv_q7,
pfv_q8,
pfv_video_echo_alpha,
pfv_video_echo_zoom,
pfv_video_echo_orientation,
pfv_dmx1,
pfv_dmx2,
pfv_dmx3,
pfv_dmx4,
pfv_dmx5,
pfv_dmx6,
pfv_dmx7,
pfv_dmx8,
pfv_idmx1,
pfv_idmx2,
pfv_idmx3,
pfv_idmx4,
pfv_idmx5,
pfv_idmx6,
pfv_idmx7,
pfv_idmx8,
pfv_osc1,
pfv_osc2,
pfv_osc3,
pfv_osc4,
pfv_midi1,
pfv_midi2,
pfv_midi3,
pfv_midi4,
pfv_midi5,
pfv_midi6,
pfv_midi7,
pfv_midi8,
pfv_video_a,
pfv_image1_a,
pfv_image1_x,
pfv_image1_y,
pfv_image1_zoom,
pfv_image1_index,
pfv_image2_a,
pfv_image2_x,
pfv_image2_y,
pfv_image2_zoom,
pfv_image2_index,
COMP_PFV_COUNT /* must be last */
};
enum {
/* System */
pvv_texsize,
pvv_hmeshsize,
pvv_vmeshsize,
/* MilkDrop */
pvv_sx,
pvv_sy,
pvv_cx,
pvv_cy,
pvv_rot,
pvv_dx,
pvv_dy,
pvv_zoom,
pvv_time,
pvv_frame,
pvv_bass,
pvv_mid,
pvv_treb,
pvv_bass_att,
pvv_mid_att,
pvv_treb_att,
pvv_warp,
pvv_warp_anim_speed,
pvv_warp_scale,
pvv_q1,
pvv_q2,
pvv_q3,
pvv_q4,
pvv_q5,
pvv_q6,
pvv_q7,
pvv_q8,
pvv_idmx1,
pvv_idmx2,
pvv_idmx3,
pvv_idmx4,
pvv_idmx5,
pvv_idmx6,
pvv_idmx7,
pvv_idmx8,
pvv_osc1,
pvv_osc2,
pvv_osc3,
pvv_osc4,
pvv_midi1,
pvv_midi2,
pvv_midi3,
pvv_midi4,
pvv_midi5,
pvv_midi6,
pvv_midi7,
pvv_midi8,
COMP_PVV_COUNT /* must be last */
};
#define REQUIRE_DMX (1 << 0)
#define REQUIRE_OSC (1 << 1)
#define REQUIRE_MIDI (1 << 2)
#define REQUIRE_VIDEO (1 << 3)
struct image {
struct pixbuf *pixbuf; /* NULL if unused */
const char *filename; /* undefined if unused */
struct stat st;
};
struct patch {
/* per-frame */
struct image *images; /* images used in this patch */
int n_images; /* number of images */
float pfv_initial[COMP_PFV_COUNT]; /* patch initial conditions */
int pfv_allocation[COMP_PFV_COUNT]; /* where per-frame variables
are mapped in PFPU regf,
-1 if unmapped */
int perframe_prog_length; /* how many instructions in
perframe_prog */
unsigned int perframe_prog[PFPU_PROGSIZE];
/* PFPU per-frame microcode */
float perframe_regs[PFPU_REG_COUNT]; /* PFPU initial per-frame
register file */
/* per-vertex */
int pvv_allocation[COMP_PVV_COUNT]; /* where per-vertex variables
are mapped in PFPU regf,
-1 if unmapped */
int pervertex_prog_length; /* how many instructions in
pervertex_prog */
unsigned int pervertex_prog[PFPU_PROGSIZE];
/* PFPU per-vertex microcode */
float pervertex_regs[PFPU_REG_COUNT]; /* PFPU initial per-vertex
regf */
/* meta */
unsigned int require; /* bitmask: dmx, osc, midi, video */
void *original; /* original patch (with initial register
values) */
int ref; /* reference count */
struct patch *next; /* used when chaining patches in mashups */
/* unified input events */
struct stimuli *stim; /* control variable hierarchy */
};
typedef void (*report_message)(const char *);
struct compiler_sc;
void init_fpvm(struct fpvm_fragment *fragment, int vector_mode);
struct patch *patch_compile(const char *basedir, const char *patch_code,
report_message rmc);
struct patch *patch_compile_filename(const char *filename,
const char *patch_code, report_message rmc);
struct stimuli *compiler_get_stimulus(struct compiler_sc *sc);
struct patch *patch_copy(struct patch *p);
void patch_free(struct patch *p);
struct patch *patch_refresh(struct patch *p);
#endif /* __COMPILER_H */