rspverif.c
6.58 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
/**************************************************************************
* *
* Copyright (C) 1994, 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: rspverif.c
* Creator: hsa@sgi.com
* Create Date: Tue Apr 11 17:47:03 PDT 1995
*
*
* This application is a test-bed of single frame tests for RSP
* verification. The idea is that each frame possibly uses a different
* dataset (see static.c) to render a particular test.
*
* This is the 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 rspverif.h, rspverif.c, 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 <gu.h>
#include <em.h>
#include "rspverif.h"
u32 addrProjection, addrViewing, addrModeling;
u32 addrModel[20], addrModelPop[20], addrVP[17];
/* procedure to do the work for placebo case: */
void
testCasePlacebo(Dynamic *dynamicp, int caseno)
{
static float theta = 0.0;
u16 perspNorm;
guPerspective(&dynamicp->projection,&perspNorm,
33, 320.0/240.0, 1, 500, 1.0);
guLookAt(&dynamicp->viewing,
0, 0, 200, 0, 0, 0, 0, 1, 0);
guRotate(&dynamicp->modeling, theta, 0.0, 0.0, 1.0);
/* fix dynamic seg addresses: */
addrProjection = K0_TO_PHYS((u32) &(dynamicp->projection));
addrViewing = K0_TO_PHYS((u32) &(dynamicp->viewing));
addrModeling = K0_TO_PHYS((u32) &(dynamicp->modeling));
gSPMatrix(glistp++, addrProjection,
G_MTX_PROJECTION|G_MTX_LOAD|G_MTX_NOPUSH);
gSPMatrix(glistp++, addrViewing,
G_MTX_MODELVIEW|G_MTX_LOAD|G_MTX_NOPUSH);
gSPMatrix(glistp++, addrModeling,
G_MTX_MODELVIEW|G_MTX_MUL|G_MTX_NOPUSH);
gSPPerspNormalize(glistp++, perspNorm);
gSPDisplayList(glistp++, testList[caseno]);
gDPFullSync(glistp++);
}
/* procedure to do the work for test 0: */
void
testCaseProc0(Dynamic *dynamicp, int caseno)
{
static float theta = 0.0;
u16 perspNorm;
guPerspective(&dynamicp->projection,&perspNorm,
33, 320.0/240.0, 1, 500, 1.0);
guLookAt(&dynamicp->viewing,
0, 0, 200, 0, 0, 0, 0, 1, 0);
guRotate(&dynamicp->modeling, theta, 0.0, 0.0, 1.0);
/* fix dynamic seg addresses: */
addrProjection = K0_TO_PHYS((u32) &(dynamicp->projection));
addrViewing = K0_TO_PHYS((u32) &(dynamicp->viewing));
addrModeling = K0_TO_PHYS((u32) &(dynamicp->modeling));
gSPMatrix(glistp++, addrProjection,
G_MTX_PROJECTION|G_MTX_LOAD|G_MTX_NOPUSH);
gSPMatrix(glistp++, addrViewing,
G_MTX_MODELVIEW|G_MTX_LOAD|G_MTX_NOPUSH);
gSPMatrix(glistp++, addrModeling,
G_MTX_MODELVIEW|G_MTX_MUL|G_MTX_NOPUSH);
gSPPerspNormalize(glistp++, perspNorm);
gSPDisplayList(glistp++, testList[caseno]);
gDPFullSync(glistp++);
}
/* procedure to do the work for test 1: */
/* test of hw1 load tile problem */
void
testCaseProc1(Dynamic *dynamicp, int caseno)
{
u16 perspNorm;
guPerspective(&dynamicp->projection,&perspNorm,
33, 320.0/240.0, 10, 500, 1.0);
guLookAt(&dynamicp->viewing,
0, 0, 200, 0, 0, 0, 0, 1, 0);
gSPPerspNormalize(glistp++, perspNorm);
/* fix dynamic seg addresses: */
addrProjection = K0_TO_PHYS((u32) &(dynamicp->projection));
addrViewing = K0_TO_PHYS((u32) &(dynamicp->viewing));
gSPMatrix(glistp++, addrProjection,
G_MTX_PROJECTION|G_MTX_LOAD|G_MTX_NOPUSH);
gSPMatrix(glistp++, addrViewing,
G_MTX_MODELVIEW|G_MTX_LOAD|G_MTX_NOPUSH);
gSPDisplayList(glistp++, &(bg_dl[0]));
gSPDisplayList(glistp++, &(diag_dl[0]));
gDPFullSync(glistp++);
}
/* procedure to do the work for test 2: */
/* test of hw1 load tlut problem */
void
testCaseProc2(Dynamic *dynamicp, int caseno)
{
static float scale = 0.0625;
guOrtho(&dynamicp->projection,
-(float)SCREEN_WD/2.0F, (float)SCREEN_WD/2.0F,
-(float)SCREEN_HT/2.0F, (float)SCREEN_HT/2.0F,
1.0F, 10.0F, 1.0F);
guLookAt(&dynamicp->viewing,
128*scale, 512*scale, 5, 128*scale, 512*scale, 0, -1, 0, 0);
guScale(&dynamicp->modeling, scale, scale, 1.0);
/* fix dynamic seg addresses: */
addrProjection = K0_TO_PHYS((u32) &(dynamicp->projection));
addrViewing = K0_TO_PHYS((u32) &(dynamicp->viewing));
addrModeling = K0_TO_PHYS((u32) &(dynamicp->modeling));
gSPMatrix(glistp++, addrProjection,
G_MTX_PROJECTION|G_MTX_LOAD|G_MTX_NOPUSH);
gSPMatrix(glistp++, addrViewing,
G_MTX_MODELVIEW|G_MTX_LOAD|G_MTX_NOPUSH);
gSPMatrix(glistp++, addrModeling,
G_MTX_MODELVIEW|G_MTX_MUL|G_MTX_NOPUSH);
/*
gSPDisplayList(glistp++, &(bg_dl[0]));
*/
gSPDisplayList(glistp++, &(ci_test_dl[0]));
gDPFullSync(glistp++);
}
/* ADD TEST CASE: test frames: */
/* add procedure to do the work above here. */
/*
* ADD TEST CASE: test frames:
*
* Static display lists from static.c must be inserted in this
* table, in the same position as the test's frame number.
*
* NOTE: a test doesn't need to have a static display list, if
* the corresponding testCaseProc doesn't use. But you still
* need to put a NULL entry here in the table.
*
* It is a good idea to put your name beside the test, so others
* can track you down with questions.
*
*/
Gfx *testList[] = { /* list of specific test Gfx display lists: */
&(square0[0]), /* hsa */
&(placebo_dl[0]), /* lipes */
&(placebo_dl[0]), /* lipes */
&(placebo_dl[0]),
/* add cases above here: */
(Gfx *) NULL, /* last one, to count them... */
};
/*
* ADD TEST CASE: test frames:
* Above procedures to do the work for each test, must be
* entered in the table here, in the same position as their
* frame number.
*
*/
CaseProc_t testCaseProcs[] =
{
testCaseProc0,
testCaseProc1,
testCaseProc2,
testCasePlacebo,
testCasePlacebo,
};