cc.h
7.21 KB
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
/*
* cc.h -- definitions, structures for Color Combiner Unit
*
* This unit comprises the color combine lerps and the "alpha fixup"
* stuff for keying, and cvg * alpha.
*
* Extra added bonus: texture edge circuit!
*
* 8/16/94 RJM
*/
#ifndef CLR_COMBO_INCLD
#define CLR_COMBO_INCLD
#define ONE_POINT_OH 0x100
#define ZERO 0x000
/*
* Red/Green/Blue Muxes
*/
typedef enum {
CC_SUBA_COMBO_CLR = 0,
CC_SUBA_TEX_0 = 1,
CC_SUBA_TEX_1 = 2,
CC_SUBA_PRIM_CLR = 3,
CC_SUBA_SHADE_CLR = 4,
CC_SUBA_ENV_CLR = 5,
CC_SUBA_ONE = 6,
CC_SUBA_NOISE = 7,
CC_SUBA_ZERO = 8,
CC_SUBA_ZERO_LAST = 15
} CCSubASel;
typedef enum {
CC_SUBB_COMBO_CLR = 0,
CC_SUBB_TEX_0 = 1,
CC_SUBB_TEX_1 = 2,
CC_SUBB_PRIM_CLR = 3,
CC_SUBB_SHADE_CLR = 4,
CC_SUBB_ENV_CLR = 5,
CC_SUBB_CENTER = 6,
CC_SUBB_K4 = 7,
CC_SUBB_ZERO = 8,
CC_SUBB_ZERO_LAST = 15
} CCSubBSel;
typedef enum {
CC_MULT_COMBO_CLR = 0,
CC_MULT_TEX_0 = 1,
CC_MULT_TEX_1 = 2,
CC_MULT_PRIM_CLR = 3,
CC_MULT_SHADE_CLR = 4,
CC_MULT_ENV_CLR = 5,
CC_MULT_SCALE = 6,
CC_MULT_COMBO_ALPHA = 7,
CC_MULT_T0_ALPHA = 8,
CC_MULT_T1_ALPHA = 9,
CC_MULT_PRIM_A = 10,
CC_MULT_SHADE_A = 11,
CC_MULT_ENV_A = 12,
CC_MULT_LODF = 13,
CC_MULT_PRIM_LODF = 14,
CC_MULT_K5 = 15,
CC_MULT_ZERO = 16,
CC_MULT_ZERO_LAST = 31
} CCMultSel;
typedef enum {
CC_ADD_COMBO_CLR = 0,
CC_ADD_TEX_0 = 1,
CC_ADD_TEX_1 = 2,
CC_ADD_PRIM_CLR = 3,
CC_ADD_SHADE_CLR = 4,
CC_ADD_ENV_CLR = 5,
CC_ADD_ONE = 6,
CC_ADD_ZERO = 7
} CCAddSel;
/*
* Alpha Muxes
*/
typedef enum {
CC_SUBA_COMBO_ALPHA = 0,
CC_SUBA_TEX_0_ALPHA = 1,
CC_SUBA_TEX_1_ALPHA = 2,
CC_SUBA_PRIM_ALPHA = 3,
CC_SUBA_SHADE_ALPHA = 4,
CC_SUBA_ENV_ALPHA = 5,
CC_SUBA_ONE_ALPHA = 6,
CC_SUBA_ZERO_ALPHA = 7
} CCSubASel_A;
typedef enum {
CC_SUBB_COMBO_ALPHA = 0,
CC_SUBB_TEX_0_ALPHA = 1,
CC_SUBB_TEX_1_ALPHA = 2,
CC_SUBB_PRIM_ALPHA = 3,
CC_SUBB_SHADE_ALPHA = 4,
CC_SUBB_ENV_ALPHA = 5,
CC_SUBB_ONE_ALPHA = 6,
CC_SUBB_ZERO_ALPHA = 7
} CCSubBSel_A;
typedef enum {
CC_MULT_LODF_ALPHA = 0,
CC_MULT_TEX_0_ALPHA = 1,
CC_MULT_TEX_1_ALPHA = 2,
CC_MULT_PRIM_ALPHA = 3,
CC_MULT_SHADE_ALPHA = 4,
CC_MULT_ENV_ALPHA = 5,
CC_MULT_PRIM_LODF_ALPHA = 6,
CC_MULT_ZERO_ALPHA = 7
} CCMultSel_A;
typedef enum {
CC_ADD_COMBO_ALPHA = 0,
CC_ADD_TEX_0_ALPHA = 1,
CC_ADD_TEX_1_ALPHA = 2,
CC_ADD_PRIM_ALPHA = 3,
CC_ADD_SHADE_ALPHA = 4,
CC_ADD_ENV_ALPHA = 5,
CC_ADD_ONE_ALPHA = 6,
CC_ADD_ZERO_ALPHA = 7
} CCAddSel_A;
/********* ******* *** ** ******* **** ********** ***** ********
* Color Combiner Registers and Signals
********* ******* *** ** ******* **** ********** ***** ********/
typedef struct cc
{
/* R E Q U I R E D by C-sim */
char *label; /* label must be first */
char **argv;
int argc;
int gclk_old;
/* I N P U T signals (must be int) */
int gclk; /* rdp gates clock */
int st_span; /* start of span */
int ncyc; /* number of cycles mode */
int key_en; /* enable keying mode */
int cvg_times_alpha; /* modify pixel coverage with alpha */
int alpha_cvg_select; /* select source of pixel alpha */
int cc_x_sel_0_r; /* [3:0] cc mode */
int cc_y_sel_0_r; /* [3:0] */
int cc_a_sel_0_r; /* [4:0] */
int cc_c_sel_0_r; /* [2:0] */
int cc_x_sel_0_a; /* [2:0] cc mode */
int cc_y_sel_0_a; /* [2:0] */
int cc_a_sel_0_a; /* [2:0] */
int cc_c_sel_0_a; /* [2:0] */
int cc_x_sel_1_r; /* [3:0] cc mode */
int cc_y_sel_1_r; /* [3:0] */
int cc_a_sel_1_r; /* [4:0] */
int cc_c_sel_1_r; /* [2:0] */
int cc_x_sel_1_a; /* [2:0] cc mode */
int cc_y_sel_1_a; /* [2:0] */
int cc_a_sel_1_a; /* [2:0] */
int cc_c_sel_1_a; /* [2:0] */
int st_r; /* [7:0], shade value */
int st_g; /* [7:0], shade value */
int st_b; /* [7:0], shade value */
int st_a; /* [7:0], shade value */
int tf_r; /* [8:0], texel value */
int tf_g; /* [8:0], texel value */
int tf_b; /* [8:0], texel value */
int tf_a; /* [8:0], texel value */
int tf_lod_frac; /* [8:0], texel lod value */
int prim_lod_frac; /* [8:0] primitive LOD fraction */
int prim_r; /* [7:0] primitive color */
int prim_g; /* [7:0] primitive color */
int prim_b; /* [7:0] primitive color */
int prim_a; /* [7:0] primitive color */
int env_r; /* [7:0] environment color */
int env_g; /* [7:0] environment color */
int env_b; /* [7:0] environment color */
int env_a; /* [7:0] environment color */
int center_r; /* [7:0] color keying center */
int center_g; /* [7:0] color keying center */
int center_b; /* [7:0] color keying center */
int scale_r; /* [7:0] color keying scale */
int scale_g; /* [7:0] color keying scale */
int scale_b; /* [7:0] color keying scale */
int width_r; /* [11:0] color keying width */
int width_g; /* [11:0] color keying width */
int width_b; /* [11:0] color keying width */
int k4_coeff; /* [8:0] color conversion coefficient */
int k5_coeff; /* [8:0] color conversion coefficient */
int noise; /* [8:0] color conversion coefficient */
int cvg; /* [3:0], 1.3, pixel coverage */
int alpha_dither_sel; /* [1:0] */
int alpha_dither; /* [2:0] */
/* O U T P U T signals (must be int) */
int shade_a; /* [7:0], shade alpha delayed */
int pixel_r; /* [7:0], combined pixel, red */
int pixel_g; /* [7:0], combined pixel, green */
int pixel_b; /* [7:0], combined pixel, blue */
int pixel_a; /* [8:0], 1.8, combined pixel, alpha */
int pixel_cvg; /* [3:0], 1.3 */
/* O T H E R signals */
unsigned int cycle: 1; /* current cycle */
unsigned int cycle_d1: 1; /* cycle delayed */
unsigned int cycle_d2: 1; /* cycle delayed yet again */
unsigned int cc_x_sel_r: 4; /* sub a mux select, rgb */
unsigned int cc_y_sel_r: 4; /* sub b mux select, rgb */
unsigned int cc_a_sel_r: 5; /* mul mux select, rgb */
unsigned int cc_c_sel_r: 3; /* adder mux select, rgb */
unsigned int cc_x_sel_a: 3; /* sub a mux select, a */
unsigned int cc_y_sel_a: 3; /* sub b mux select, a */
unsigned int cc_a_sel_a: 3; /* mul mux select, a */
unsigned int cc_c_sel_a: 3; /* adder mux select, a */
unsigned int st_a_d1: 8; /* delayed shade alpha value */
unsigned int tf_r_d1: 9; /* delayed texture red value */
unsigned int tf_g_d1: 9; /* delayed texture red value */
unsigned int tf_b_d1: 9; /* delayed texture red value */
unsigned int tf_a_d1: 9; /* delayed texture red value */
unsigned int tf_lod_frac_d1: 9; /* [8:0], delayed texel lod value */
unsigned int tf_lod_frac_d2: 9; /* [8:0], (further) delayed lod value */
unsigned int suba_r: 9; /* a input of red subtract, bypass keying */
unsigned int suba_g: 9; /* a input of grn subtract, bypass keying */
unsigned int suba_b: 9; /* a input of blu subtract, bypass keying */
unsigned int cc_r: 17; /* s8.8, to keying/clamp logic */
unsigned int cc_g: 17; /* s8.8, to keying/clamp logic */
unsigned int cc_b: 17; /* s8.8, to keying/clamp logic */
unsigned int cc_a: 9; /* s8.0, to keying/clamp logic */
} cc_t;
/*
* Function prototypes
*/
int cc(cc_t **pp0, cc_t **pp1);
int cc_init(cc_t *p0, cc_t *p1);
#endif /* CLR_COMBO_INCLD */