bl.c
8.19 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
279
280
281
282
283
284
285
286
/**************************************************************************
* *
* Copyright (C) 1995, Silicon Graphics, Inc. *
* *
* These coded instructions, statements, and computer programs contain *
* unpublished proprietary information of Silicon Graphics, Inc., and *
* are protected by Federal copyright law. They may not be disclosed *
* to third parties or copied or duplicated in any form, in whole or *
* in part, without the prior written consent of Silicon Graphics, Inc. *
* *
*************************************************************************/
/*
* File: bl.c
* Creator: hal@sgi.com
* Create Date: Tue Sep 26 14:01:01 PDT 1995
* Purpose: dynamic DL tests for blender test vector generation.
*
*
* This application is a test-bed of single frame tests for RDP
* verification. The idea is that each frame possibly uses a different
* dataset (see bl_static.c) to render a particular test.
*
* This is a MODULE and TEST-SPECIFIC file, see comment in main.c for more
* information.
*
* TO ADD A TEST CASE:
*
* New test cases require that you define the display list and add
* a few simple things in the files bl.h, bl.c, bl_static.c.
*
* All locations are marked with comments that say "ADD TEST CASE"
* and give some hints what you need to do there. See main.c for
* detailed instructions.
*
*/
#include <ultra64.h>
#include <em.h>
#include "rdpvector.h"
#include "toplevel.h"
#include "bl.h"
/*
* ADD TEST CASE: test frames:
*
* Display lists from bl_static.c (which are placed in the static segment via
* the spec file) must be inserted in this table, in the same position as the
* test's frame number, along with a mneumonic name (which will be used to name
* the resulting .rdp display list file), and a pointer to the top level DL
* function which will be used to invoke this static display list.
*
* NOTE: a test doesn't need to have a static display list, if
* the corresponding testCaseProc doesn't use one. But you still
* need to put a NULL entry here in the table.
*/
GfxTest_t testList_bl[] = {
&(BL_placebo_dl[0]), "BL_placebo_dl", testCasePlacebo,
G_IM_SIZ_16b,
/*XXXblythe comment out this test for now, it hangs the display list dump*/
#if 0
&(BL_placebo_dl[0]), "BL_test1", testCaseBL1,
G_IM_SIZ_32b,
#endif
&(BL_test2_dl1[0]), "bl_vector1", testCasePlacebo,
G_IM_SIZ_32b,
&(BL_test2_dl2[0]), "bl_vector2", testCasePlacebo,
G_IM_SIZ_32b,
&(BL_test2_dl3[0]), "bl_vector3", testCasePlacebo,
G_IM_SIZ_32b,
&(BL_test2_dl4[0]), "BL_vector4", testCasePlacebo,
G_IM_SIZ_16b,
&(BL_test2_dl5[0]), "BL_vector5", testCasePlacebo,
G_IM_SIZ_32b,
&(BL_placebo_dl[0]), "rdp031small", testCaserdp031,
G_IM_SIZ_16b,
/* add new test cases above here: */
/* Last entry must be NULL, so we can count them in main.c */
(Gfx *) NULL, "", (CaseProc_t) NULL,
G_IM_SIZ_16b,
};
/* procedure to do the work for placebo case: */
extern OSTask tlist;
extern int rdp_DRAM_io;
extern long long int tspManTest1TextStart[], tspManTest1TextEnd[];
extern long long int tspManTest1DataStart[], tspManTest1DataEnd[];
extern long long int tspManTest1_dramTextStart[], tspManTest1_dramTextEnd[];
extern long long int tspManTest1_dramDataStart[], tspManTest1_dramDataEnd[];
void
testCaseBL1(Dynamic *dynamicp, Gfx *module_test)
{
tlist.t.data_ptr = (u64 *) cfb_16_a;
tlist.t.data_size = (u32) zbuffer;
tlist.t.yield_data_size = (u32) 4;
if (rdp_DRAM_io) {
/* re-direct output to DRAM: */
tlist.t.ucode = (u64 *) tspManTest1_dramTextStart;
tlist.t.ucode_data = (u64 *) tspManTest1_dramDataStart;
} else {
/* RSP output over XBUS to RDP: */
tlist.t.ucode = (u64 *) tspManTest1TextStart;
tlist.t.ucode_data = (u64 *) tspManTest1DataStart;
}
}
#include "rdp31data.h"
/*
gload -a "-m 7 -f 7"
*/
void
testCaserdp031(Dynamic *dynamicp, Gfx *module_test)
{
float theta=0.0;
guPerspective(&dynamicp->projection, &(dynamicp->perspNorm),
33, 320.0/240.0, 200, 2800, 1.0);
/* LOOK_OVERALL */
guLookAt(&dynamicp->viewing,
50, 300, 700,
0, 50, 0,
0, 1, 0);
gSPMatrix(glistp++, K0_TO_PHYS(&(dynamicp->projection)),
G_MTX_PROJECTION|G_MTX_LOAD|G_MTX_NOPUSH);
gSPMatrix(glistp++, K0_TO_PHYS(&(dynamicp->viewing)),
G_MTX_MODELVIEW|G_MTX_LOAD|G_MTX_NOPUSH);
gSPPerspNormalize(glistp++, dynamicp->perspNorm);
/* for cone */
guRotate(&dynamicp->modeling, theta, 1.0, 0.0, 0.0);
/* gDPSetScissor(glistp++, G_SC_NON_INTERLACE, 133, 102, 136, 103); */
#ifdef CONE
gSPMatrix(glistp++, K0_TO_PHYS(&(dynamicp->modeling)),
G_MTX_MODELVIEW|G_MTX_MUL|G_MTX_NOPUSH);
gSPDisplayList(glistp++, &cone_dl[0]);
#endif /* CONE */
#ifndef TORUS
gSPMatrix(glistp++, K0_TO_PHYS(&(dynamicp->viewing)),
G_MTX_MODELVIEW|G_MTX_LOAD|G_MTX_NOPUSH);
guRotate(&dynamicp->torus, 90.0, 1.0, 0.333, 0.0);
/* set the y and z translate elements by hand: */
dynamicp->torus.m[1][2] = 130;
dynamicp->torus.m[1][3] = (20 << 16) | 1;
gSPMatrix(glistp++, K0_TO_PHYS(&(dynamicp->torus)),
G_MTX_MODELVIEW|G_MTX_MUL|G_MTX_NOPUSH);
gSPDisplayList(glistp++, &torus_dl[0]);
#endif /* TORUS */
#ifdef GROUND
gSPMatrix(glistp++, K0_TO_PHYS(&(dynamicp->viewing)),
G_MTX_MODELVIEW|G_MTX_LOAD|G_MTX_NOPUSH);
gSPDisplayList(glistp++, &ground_dl[0]);
#endif /* GROUND */
#ifdef BOX1
/* BOX1, textured box */
gSPMatrix(glistp++, K0_TO_PHYS(&(dynamicp->viewing)),
G_MTX_MODELVIEW|G_MTX_LOAD|G_MTX_NOPUSH);
guRotate(&dynamicp->box1, 45.0, 1.0, 1.0, 1.0);
/* set the x, y, and z translate elements by hand: */
dynamicp->box1.m[1][2] = (50 << 16) | (10);
dynamicp->box1.m[1][3] = (100 << 16) | 1;
gSPMatrix(glistp++, K0_TO_PHYS(&(dynamicp->box1)),
G_MTX_MODELVIEW|G_MTX_MUL|G_MTX_NOPUSH);
gSPDisplayList(glistp++, &box1_dl[0]);
#endif /* BOX1 */
#ifdef ICOSA
/* ICOSAHEDRON translucent objects last */
gSPMatrix(glistp++, K0_TO_PHYS(&(dynamicp->viewing)),
G_MTX_MODELVIEW|G_MTX_LOAD|G_MTX_NOPUSH);
gSPMatrix(glistp++, K0_TO_PHYS(&(dynamicp->modeling)),
G_MTX_MODELVIEW|G_MTX_MUL|G_MTX_NOPUSH);
guRotate(&dynamicp->icosa, 90.0, 0.7, 0.8, 0.7);
/* set the x, y, and z translate elements by hand: */
dynamicp->icosa.m[1][2] = (40 << 16) | ((u16) -40);
dynamicp->icosa.m[1][3] = (50 << 16) | 1;
gSPMatrix(glistp++, K0_TO_PHYS(&(dynamicp->icosa)),
G_MTX_MODELVIEW|G_MTX_MUL|G_MTX_NOPUSH);
gSPDisplayList(glistp++, &icosa_dl[0]);
#endif /* ICOSA */
#ifdef BOX
/* BOX translucent objects last */
gSPMatrix(glistp++, K0_TO_PHYS(&(dynamicp->viewing)),
G_MTX_MODELVIEW|G_MTX_LOAD|G_MTX_NOPUSH);
guTranslate(&dynamicp->box, -35.0, 50.0, 0.0);
gSPMatrix(glistp++, K0_TO_PHYS(&(dynamicp->box)),
G_MTX_MODELVIEW|G_MTX_MUL|G_MTX_NOPUSH);
gSPDisplayList(glistp++, &box_dl[0]);
#endif /* BOX */
#ifdef TREE0
/* for trees */
guTranslate(&dynamicp->tree, 15.0, 0.0, -50.0);
gSPMatrix(glistp++, K0_TO_PHYS(&(dynamicp->viewing)),
G_MTX_MODELVIEW|G_MTX_LOAD|G_MTX_NOPUSH);
if (0) {
gSPDisplayList(glistp++, &tree0_dl[0]);
}
#endif /* TREE0 */
#ifdef TREE1
if (0) {
gSPMatrix(glistp++, K0_TO_PHYS(&(dynamicp->tree)),
G_MTX_MODELVIEW|G_MTX_MUL|G_MTX_NOPUSH);
gSPDisplayList(glistp++, &tree1_dl[0]);
}
#endif /* TREE1 */
#ifdef TREE2
if (0) {
gSPMatrix(glistp++, K0_TO_PHYS(&(dynamicp->tree)),
G_MTX_MODELVIEW|G_MTX_MUL|G_MTX_NOPUSH);
gSPDisplayList(glistp++, &tree2_dl[0]);
}
#endif /* TREE2 */
#ifdef TREE3
if (0) {
gSPMatrix(glistp++, K0_TO_PHYS(&(dynamicp->tree)),
G_MTX_MODELVIEW|G_MTX_MUL|G_MTX_NOPUSH);
gSPDisplayList(glistp++, &tree3_dl[0]);
}
#endif /* TREE3 */
gDPFullSync(glistp++);
}