inp009.c
3.18 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
#include <bstring.h>
#include <stdio.h>
#include "inp.h"
static void varyHighBits(void);
static void sharpenMode(void);
int
main(int argc, char *argv[])
{
printHeader();
varyHighBits();
sharpenMode();
printTrailingCycles();
}
static void
varyHighBits(void)
{
cc_t cc;
cc_t *ccp = &cc;
int i, j, k;
bzero(ccp, sizeof(cc));
ccp->ncyc = 0; /* one cycle mode */
/* Initialize mode 1 (x,y,a,c) selects to produce (0,0,0,0) */
ccp->cc_x_sel_1_r = CC_SUBA_ZERO;
ccp->cc_y_sel_1_r = CC_SUBB_ZERO;
ccp->cc_a_sel_1_r = CC_MULT_ZERO;
ccp->cc_c_sel_1_r = CC_ADD_ONE;
ccp->cc_x_sel_1_a = CC_SUBA_ZERO_ALPHA;
ccp->cc_y_sel_1_a = CC_SUBB_ZERO_ALPHA;
ccp->cc_a_sel_1_a = CC_MULT_ZERO_ALPHA;
ccp->cc_c_sel_1_a = CC_ADD_PRIM_ALPHA;
ccp->texture_edge_mode = 1;
ccp->cvg_times_alpha = 1;
ccp->alpha_cvg_select = 1;
printf("# Vary high bits of alpha, coverage, and positive lod values\n");
for (i = 0; i < 8; i++) {
ccp->prim_a = i<<5;
for (j = 0; j < 9; j++) {
ccp->cvg = j;
for (k = 0; k < 9; k++) {
if (k == 8)
ccp->tf_lge1 = 1;
else
ccp->tf_lge1 = 0;
ccp->tf_lod_frac = (k & 7) << 5;
printf("# alpha 0x%x", ccp->prim_a);
printf(" coverage 0x%x ", ccp->cvg);
printf(" tf_lge1 %d ", ccp->tf_lge1);
printf(" tf_lod_frac 0x%x\n", ccp->tf_lod_frac);
printVector(ccp, 1);
}
}
}
/* Once more with a maxed out alpha value */
ccp->prim_a = 0xff;
for (j = 0; j < 9; j++) {
ccp->cvg = j;
for (k = 0; k < 9; k++) {
if (k == 8)
ccp->tf_lge1 = 1;
else
ccp->tf_lge1 = 0;
ccp->tf_lod_frac = (k & 7) << 5;
printf("# alpha 0x%x", ccp->prim_a);
printf(" coverage 0x%x ", ccp->cvg);
printf(" tf_lge1 %d ", ccp->tf_lge1);
printf(" tf_lod_frac 0x%x\n", ccp->tf_lod_frac);
printVector(ccp, 1);
}
}
}
static void
sharpenMode(void)
{
cc_t cc;
cc_t *ccp = &cc;
int i, j, k;
bzero(ccp, sizeof(cc));
ccp->ncyc = 0; /* one cycle mode */
/* Initialize mode 1 (x,y,a,c) selects to produce (0,0,0,0) */
ccp->cc_x_sel_1_r = CC_SUBA_ZERO;
ccp->cc_y_sel_1_r = CC_SUBB_ZERO;
ccp->cc_a_sel_1_r = CC_MULT_ZERO;
ccp->cc_c_sel_1_r = CC_ADD_ONE;
ccp->cc_x_sel_1_a = CC_SUBA_ZERO_ALPHA;
ccp->cc_y_sel_1_a = CC_SUBB_ZERO_ALPHA;
ccp->cc_a_sel_1_a = CC_MULT_ZERO_ALPHA;
ccp->cc_c_sel_1_a = CC_ADD_PRIM_ALPHA;
ccp->texture_edge_mode = 1;
ccp->cvg_times_alpha = 1;
ccp->alpha_cvg_select = 1;
ccp->tf_lge1 = 0;
printf("# Vary high bits of alpha, coverage, and negative lod values\n");
for (i = 0; i < 8; i++) {
ccp->prim_a = i<<5;
for (j = 0; j < 9; j++) {
ccp->cvg = j;
for (k = 0; k < 4; k++) {
ccp->tf_lod_frac = (1<<8) | (k<<6);
printf("# alpha 0x%x", ccp->prim_a);
printf(" coverage 0x%x ", ccp->cvg);
printf(" tf_lge1 %d ", ccp->tf_lge1);
printf(" tf_lod_frac 0x%x\n", ccp->tf_lod_frac);
printVector(ccp, 1);
}
}
}
/* Once more with a maxed out alpha value */
ccp->prim_a = 0xff;
for (j = 0; j < 9; j++) {
ccp->cvg = j;
for (k = 0; k < 4; k++) {
ccp->tf_lod_frac = (1<<8) | (k<<6);
printf("# alpha 0x%x", ccp->prim_a);
printf(" coverage 0x%x ", ccp->cvg);
printf(" tf_lge1 %d ", ccp->tf_lge1);
printf(" tf_lod_frac 0x%x\n", ccp->tf_lod_frac);
printVector(ccp, 1);
}
}
}