gtstate.s
5.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
/*
* Copyright 1995, Silicon Graphics, Inc.
* ALL RIGHTS RESERVED
*
* UNPUBLISHED -- Rights reserved under the copyright laws of the United
* States. Use of a copyright notice is precautionary only and does not
* imply publication or disclosure.
*
* U.S. GOVERNMENT RESTRICTED RIGHTS LEGEND:
* Use, duplication or disclosure by the Government is subject to restrictions
* as set forth in FAR 52.227.19(c)(2) or subparagraph (c)(1)(ii) of the Rights
* in Technical Data and Computer Software clause at DFARS 252.227-7013 and/or
* in similar or successor clauses in the FAR, or the DOD or NASA FAR
* Supplement. Contractor/manufacturer is Silicon Graphics, Inc.,
* 2011 N. Shoreline Blvd. Mountain View, CA 94039-7311.
*
* THE CONTENT OF THIS WORK CONTAINS CONFIDENTIAL AND PROPRIETARY
* INFORMATION OF SILICON GRAPHICS, INC. ANY DUPLICATION, MODIFICATION,
* DISTRIBUTION, OR DISCLOSURE IN ANY FORM, IN WHOLE, OR IN PART, IS STRICTLY
* PROHIBITED WITHOUT THE PRIOR EXPRESS WRITTEN PERMISSION OF SILICON
* GRAPHICS, INC.
*
*/
/*
* File: gtstate.s
* Creator: hsa@sgi.com
* Create Date: Thu Oct 12 11:04:55 PDT 1995
*
* This file processes the 'state' structures of the TURBO 3D
* ucode.
*
*/
.name dpp, $1
.name w0, $2
.name w1, $3
.name mask, $4
.name retsave, $5
.name inputp, $6
.name tmp, $7
.name outsz, $18 # used in OutputOpen
.name addr, $19
################################################################
#
# global state processing
#
GlobStateProc:
# save return, call open, get DP block pointer
add retsave, zero, return
#if !(defined(OUTPUT_DRAM)||defined(OUTPUT_FIFO))
jal OutputOpen
addi outsz, zero, RSP_SETUP_TMP_SIZE8 + 8
#endif /* !(OUTPUT_DRAM || OUTPUT_FIFO) */
lw addr, RSP_GLOB_DP_LISTP(zero)
# send othermode word first:
ldv $v0[0], RSP_GLOB_STATE_OTHERMODE(rsp_state)
sdv $v0[0], 0(outp)
addi outp, outp, 8
# check for DP block==NULL
beq addr, zero, GlobDBBlockDone
nop
jal AddrFixup
nop
addi inputp, addr, 0
# load DP block into setup tmp area
ReadGlobDPBlock:
addi addr, inputp, 0
addi dpp, zero, RSP_SETUP_TMP_OFFSET + RSP_SETUP_TMP_SIZE8
addi $20, zero, RSP_SETUP_TMP_OFFSET
# we always fetch one more command than we process, in
# case the last command is a textured rectangle and we
# need the extra 64 bits...
addi $18, zero, RSP_SETUP_TMP_SIZE8 + 8 - 1
jal DMAproc
addi $17, zero, 0
# wait for DP block to load:
jal DMAwait
nop
# process DP block
NextGlobDPCmd:
lw w0, 0($20)
lw w1, 4($20)
beq w0, zero, GlobDBBlockDone
addi $20, $20, 8
addi inputp, inputp, 8
# identify RDP command as having an address or not...
sra mask, w0, 24
addi mask, mask, G_RDP_ADDR_FIXUP
bltz mask, doGRDPSend
nop
# RDP command has an address to patch...
jal AddrFixup
add addr, w1, zero # delay slot
add w1, addr, zero
# if RDP command doesn't have an addr, copy it verbatim.
doGRDPSend:
# check for TEXRECT command (ugh!):
srl mask, w0, 24
andi mask, mask, 0xfe # handle rectflip, too
addi tmp, mask, -G_TEXRECT
bne tmp, zero, NotTEXRECT
nop
sw w0, 0(outp)
sw w1, 4(outp)
addi outp, outp, 8
# grab the next 64 bits and pass it on to the RDP also.
# it's guarenteed to be there, since we always page in 8
# more bytes than we need...
lw w0, 0($20)
lw w1, 4($20)
addi $20, $20, 8
addi inputp, inputp, 8
NotTEXRECT:
sw w0, 0(outp)
sw w1, 4(outp)
addi outp, outp, 8
# check for need to page in more cmds
bne $20, dpp, NextGlobDPCmd
nop
# process next chunk of DP block
GetMoreGlobDBCmds:
jal OutputClose
nop # close-open sequence for xbus wrap
#if !(defined(OUTPUT_DRAM)||defined(OUTPUT_FIFO))
jal OutputOpen
addi outsz, zero, RSP_SETUP_TMP_SIZE8
#endif /* !(OUTPUT_DRAM || OUTPUT_FIFO) */
j ReadGlobDPBlock
nop
GlobDBBlockDone:
jal OutputClose
nop
jr retsave
nop
#
#
################################################################
################################################################
#
# object state processing
#
# so far, the only real work to the state is to dump
# the DP data.
#
ObjStateProc:
add retsave, zero, return
# check flag, see if we can avoid loading the matrix:
lb tmp, RSP_STATE_FLAG(rsp_state)
andi tmp, tmp, 0x01
bgtz tmp, DontLoadMtx
# load the matrix:
add $19, zero, gfx0
jal AddrFixup
addi $19, $19, RSP_OBJ_STATE_SIZE8 - 64
addi $20, zero, RSP_CURR_MPMTX_OFFSET
addi $18, zero, 64 - 1
jal DMAproc
addi $17, zero, 0
# wait for matrix to load. Can't do anything while we wait
jal DMAwait
nop
DontLoadMtx:
#if !(defined(OUTPUT_DRAM)||defined(OUTPUT_FIFO))
jal OutputOpen
addi outsz, zero, 8 + RSP_SETUP_TMP_SIZE8 # worst case
#endif /* !(OUTPUT_DRAM || OUTPUT_FIFO) */
# send othermode word first:
ldv $v0[0], RSP_STATE_OTHERMODE(rsp_state)
sdv $v0[0], 0(outp)
addi outp, outp, 8
# check for rdp block:
lw addr, RSP_STATE_RDP(rsp_state)
# check for DP block==NULL
beq addr, zero, GlobDBBlockDone
nop
jal AddrFixup
nop
addi inputp, addr, 0
j ReadGlobDPBlock
nop
#
#
################################################################
.unname dpp
.unname w0
.unname w1
.unname mask
.unname retsave
.unname inputp
.unname tmp
.unname outsz
.unname addr