PS2SDK
PS2 Homebrew Libraries
Loading...
Searching...
No Matches
gs_gp.h
Go to the documentation of this file.
1
6
#ifndef __GS_GP_H__
7
#define __GS_GP_H__
8
9
#include <
tamtypes.h
>
10
11
// General Purpose Registers
13
#define GS_REG_PRIM 0x00
15
#define GS_REG_RGBAQ 0x01
17
#define GS_REG_ST 0x02
19
#define GS_REG_UV 0x03
21
#define GS_REG_XYZF2 0x04
23
#define GS_REG_XYZ2 0x05
25
#define GS_REG_TEX0 0x06
27
#define GS_REG_TEX0_1 0x06
29
#define GS_REG_TEX0_2 0x07
31
#define GS_REG_CLAMP 0x08
33
#define GS_REG_CLAMP_1 0x08
35
#define GS_REG_CLAMP_2 0x09
37
#define GS_REG_FOG 0x0A
39
#define GS_REG_XYZF3 0x0C
41
#define GS_REG_XYZ3 0x0D
43
#define GS_REG_TEX1 0x14
45
#define GS_REG_TEX1_1 0x14
47
#define GS_REG_TEX1_2 0x15
49
#define GS_REG_TEX2 0x16
51
#define GS_REG_TEX2_1 0x16
53
#define GS_REG_TEX2_2 0x17
55
#define GS_REG_XYOFFSET 0x18
57
#define GS_REG_XYOFFSET_1 0x18
59
#define GS_REG_XYOFFSET_2 0x19
61
#define GS_REG_PRMODECONT 0x1A
63
#define GS_REG_PRMODE 0x1B
65
#define GS_REG_TEXCLUT 0x1C
67
#define GS_REG_SCANMSK 0x22
69
#define GS_REG_MIPTBP1 0x34
71
#define GS_REG_MIPTBP1_1 0x34
73
#define GS_REG_MIPTBP1_2 0x35
75
#define GS_REG_MIPTBP2 0x36
77
#define GS_REG_MIPTBP2_1 0x36
79
#define GS_REG_MIPTBP2_2 0x37
81
#define GS_REG_TEXA 0x3B
83
#define GS_REG_FOGCOL 0x3D
85
#define GS_REG_TEXFLUSH 0x3F
87
#define GS_REG_SCISSOR 0x40
89
#define GS_REG_SCISSOR_1 0x40
91
#define GS_REG_SCISSOR_2 0x41
93
#define GS_REG_ALPHA 0x42
95
#define GS_REG_ALPHA_1 0x42
97
#define GS_REG_ALPHA_2 0x43
99
#define GS_REG_DIMX 0x44
101
#define GS_REG_DTHE 0x45
103
#define GS_REG_COLCLAMP 0x46
105
#define GS_REG_TEST 0x47
107
#define GS_REG_TEST_1 0x47
109
#define GS_REG_TEST_2 0x48
111
#define GS_REG_PABE 0x49
113
#define GS_REG_FBA 0x4A
115
#define GS_REG_FBA_1 0x4A
117
#define GS_REG_FBA_2 0x4B
119
#define GS_REG_FRAME 0x4C
121
#define GS_REG_FRAME_1 0x4C
123
#define GS_REG_FRAME_2 0x4D
125
#define GS_REG_ZBUF 0x4E
127
#define GS_REG_ZBUF_1 0x4E
129
#define GS_REG_ZBUF_2 0x4F
131
#define GS_REG_BITBLTBUF 0x50
133
#define GS_REG_TRXPOS 0x51
135
#define GS_REG_TRXREG 0x52
137
#define GS_REG_TRXDIR 0x53
139
#define GS_REG_HWREG 0x54
141
#define GS_REG_SIGNAL 0x60
143
#define GS_REG_FINISH 0x61
145
#define GS_REG_LABEL 0x62
147
#define GS_REG_NOP 0x7F
148
149
// GS Primitive types
151
#define GS_PRIM_POINT 0x00
153
#define GS_PRIM_LINE 0x01
155
#define GS_PRIM_LINE_STRIP 0x02
157
#define GS_PRIM_TRIANGLE 0x03
159
#define GS_PRIM_TRIANGLE_STRIP 0x04
161
#define GS_PRIM_TRIANGLE_FAN 0x05
163
#define GS_PRIM_SPRITE 0x06
164
165
166
// For generic enabling or disabling
167
#define GS_DISABLE 0x00
168
#define GS_ENABLE 0x01
169
170
#define GS_SET_ALPHA(A, B, C, D, ALPHA) \
171
(u64)((A)&0x00000003) << 0 | (u64)((B)&0x00000003) << 2 | \
172
(u64)((C)&0x00000003) << 4 | (u64)((D)&0x00000003) << 6 | \
173
(u64)((ALPHA)&0x000000FF) << 32
174
175
#define GS_SET_BITBLTBUF(SBA, SBW, SPSM, DBA, DBW, DPSM) \
176
(u64)((SBA)&0x00003FFF) << 0 | (u64)((SBW)&0x0000003F) << 16 | \
177
(u64)((SPSM)&0x0000003F) << 24 | (u64)((DBA)&0x00003FFF) << 32 | \
178
(u64)((DBW)&0x0000003F) << 48 | (u64)((DPSM)&0x0000003F) << 56
179
180
#define GS_SET_CLAMP(WMS, WMT, MINU, MAXU, MINV, MAXV) \
181
(u64)((WMS)&0x00000003) << 0 | (u64)((WMT)&0x00000003) << 2 | \
182
(u64)((MINU)&0x000003FF) << 4 | (u64)((MAXU)&0x000003FF) << 14 | \
183
(u64)((MINV)&0x000003FF) << 24 | (u64)((MAXV)&0x000003FF) << 34
184
185
#define GS_SET_COLCLAMP(CLAMP) (u64)((CLAMP)&0x00000001)
186
187
#define GS_SET_DIMX(D00, D01, D02, D03, D10, D11, D12, D13, D20, D21, D22, D23, D30, D31, D32, D33) \
188
(u64)((D00)&0x00000003) << 0 | (u64)((D01)&0x00000003) << 4 | \
189
(u64)((D02)&0x00000003) << 8 | (u64)((D03)&0x00000003) << 12 | \
190
(u64)((D10)&0x00000003) << 16 | (u64)((D11)&0x00000003) << 20 | \
191
(u64)((D12)&0x00000003) << 24 | (u64)((D13)&0x00000003) << 28 | \
192
(u64)((D20)&0x00000003) << 32 | (u64)((D21)&0x00000003) << 36 | \
193
(u64)((D22)&0x00000003) << 40 | (u64)((D23)&0x00000003) << 44 | \
194
(u64)((D30)&0x00000003) << 48 | (u64)((D31)&0x00000003) << 52 | \
195
(u64)((D32)&0x00000003) << 56 | (u64)((D33)&0x00000003) << 60
196
197
#define GS_SET_DTHE(ENABLE) (u64)((ENABLE)&0x00000001)
198
199
#define GS_SET_FBA(ALPHA) (u64)((ALPHA)&0x00000001)
200
201
#define GS_SET_FINISH(A) (u64)((A)&0xFFFFFFFF)
202
203
#define GS_SET_FOG(FOG) (u64)((FOG)&0x000000FF) << 56
204
205
#define GS_SET_FOGCOL(R, G, B) \
206
(u64)((R)&0x000000FF) << 0 | (u64)((G)&0x000000FF) << 8 | \
207
(u64)((B)&0x000000FF) << 16
208
209
#define GS_SET_FRAME(FBA, FBW, PSM, FMSK) \
210
(u64)((FBA)&0x000001FF) << 0 | (u64)((FBW)&0x0000003F) << 16 | \
211
(u64)((PSM)&0x0000003F) << 24 | (u64)((FMSK)&0xFFFFFFFF) << 32
212
213
// PSMCT16 FMSK for GS_SET_FRAME
214
#define GS_SET_FMSK16(R, G, B, A) \
215
(u32)((R)&0x0000001F) << 3 | (u32)((G)&0x0000001F) << 11 | \
216
(u32)((G)&0x0000001F) << 19 | (u32)((A)&0x00000001) << 31
217
218
#define GS_SET_HWREG(A) (u64)((A)&0xFFFFFFFFFFFFFFFF)
219
220
#define GS_SET_LABEL(ID, MSK) \
221
(u64)((ID)&0xFFFFFFFF) << 0 | (u64)((MSK)&0xFFFFFFFF) << 32
222
223
#define GS_SET_MIPTBP1(TBA1, TBW1, TBA2, TBW2, TBA3, TBW3) \
224
(u64)((TBA1)&0x00003FFF) << 0 | (u64)((TBW1)&0x0000003F) << 14 | \
225
(u64)((TBA2)&0x00003FFF) << 20 | (u64)((TBW2)&0x0000003F) << 34 | \
226
(u64)((TBA3)&0x00003FFF) << 40 | (u64)((TBW3)&0x0000003F) << 54
227
228
#define GS_SET_MIPTBP2(TBA4, TBW4, TBA5, TBW5, TBA6, TBW6) \
229
(u64)((TBA4)&0x00003FFF) << 0 | (u64)((TBW4)&0x0000003F) << 14 | \
230
(u64)((TBA5)&0x00003FFF) << 20 | (u64)((TBW5)&0x0000003F) << 34 | \
231
(u64)((TBA6)&0x00003FFF) << 40 | (u64)((TBW6)&0x0000003F) << 54
232
233
#define GS_SET_NOP(A) (u64)((A)&0xFFFFFFFF)
234
235
#define GS_SET_PABE(ENABLE) (u64)((ENABLE)&0x00000001)
236
237
#define GS_SET_PRIM(PRIM, IIP, TME, FGE, ABE, AA1, FST, CTXT, FIX) \
238
(u64)((PRIM)&0x00000007) << 0 | (u64)((IIP)&0x00000001) << 3 | \
239
(u64)((TME)&0x00000001) << 4 | (u64)((FGE)&0x00000001) << 5 | \
240
(u64)((ABE)&0x00000001) << 6 | (u64)((AA1)&0x00000001) << 7 | \
241
(u64)((FST)&0x00000001) << 8 | (u64)((CTXT)&0x00000001) << 9 | \
242
(u64)((FIX)&0x00000001) << 10
243
244
#define GS_SET_PRMODE(IIP, TME, FGE, ABE, AA1, FST, CTXT, FIX) \
245
(u64)((IIP)&0x00000001) << 3 | (u64)((TME)&0x00000001) << 4 | \
246
(u64)((FGE)&0x00000001) << 5 | (u64)((ABE)&0x00000001) << 6 | \
247
(u64)((AA1)&0x00000001) << 7 | (u64)((FST)&0x00000001) << 8 | \
248
(u64)((CTXT)&0x00000001) << 9 | (u64)((FIX)&0x00000001) << 10
249
250
#define GS_SET_PRMODECONT(CTRL) (u64)((CTRL)&0x00000001)
251
252
#define GS_SET_RGBAQ(R, G, B, A, Q) \
253
(u64)((R)&0x000000FF) << 0 | (u64)((G)&0x000000FF) << 8 | \
254
(u64)((B)&0x000000FF) << 16 | (u64)((A)&0x000000FF) << 24 | \
255
(u64)((Q)&0xFFFFFFFF) << 32
256
257
#define GS_SET_SCANMSK(MSK) (u64)((MSK)&0x00000003)
258
259
#define GS_SET_SCISSOR(X0, X1, Y0, Y1) \
260
(u64)((X0)&0x000007FF) << 0 | (u64)((X1)&0x000007FF) << 16 | \
261
(u64)((Y0)&0x000007FF) << 32 | (u64)((Y1)&0x000007FF) << 48
262
263
#define GS_SET_SIGNAL(ID, MSK) \
264
(u64)((ID)&0xFFFFFFFF) << 0 | (u64)((MSK)&0xFFFFFFFF) << 32
265
266
#define GS_SET_ST(S, T) \
267
(u64)((S)&0xFFFFFFFF) << 0 | (u64)((T)&0xFFFFFFFF) << 32
268
269
#define GS_SET_TEST(ATEN, ATMETH, ATREF, ATFAIL, DATEN, DATMD, ZTEN, ZTMETH) \
270
(u64)((ATEN)&0x00000001) << 0 | (u64)((ATMETH)&0x00000007) << 1 | \
271
(u64)((ATREF)&0x000000FF) << 4 | (u64)((ATFAIL)&0x00000003) << 12 | \
272
(u64)((DATEN)&0x00000001) << 14 | (u64)((DATMD)&0x00000001) << 15 | \
273
(u64)((ZTEN)&0x00000001) << 16 | (u64)((ZTMETH)&0x00000003) << 17
274
275
#define GS_SET_TEX0_SMALL(TBA, TBW, PSM, TW, TH, TCC, TFNCT) \
276
(u64)((TBA)&0x00003FFF) << 0 | (u64)((TBW)&0x0000003F) << 14 | \
277
(u64)((PSM)&0x0000003F) << 20 | (u64)((TW)&0x0000000F) << 26 | \
278
(u64)((TH)&0x0000000F) << 30 | (u64)((TCC)&0x00000001) << 34 | \
279
(u64)((TFNCT)&0x00000003) << 35
280
281
#define GS_SET_TEX0(TBA, TBW, PSM, TW, TH, TCC, TFNCT, CBA, CPSM, CSM, CSA, CLD) \
282
(u64)((TBA)&0x00003FFF) << 0 | (u64)((TBW)&0x0000003F) << 14 | \
283
(u64)((PSM)&0x0000003F) << 20 | (u64)((TW)&0x0000000F) << 26 | \
284
(u64)((TH)&0x0000000F) << 30 | (u64)((TCC)&0x00000001) << 34 | \
285
(u64)((TFNCT)&0x00000003) << 35 | (u64)((CBA)&0x00003FFF) << 37 | \
286
(u64)((CPSM)&0x0000000F) << 51 | (u64)((CSM)&0x00000001) << 55 | \
287
(u64)((CSA)&0x0000001F) << 56 | (u64)((CLD)&0x00000007) << 61
288
289
#define GS_SET_TEX1(LCM, MXL, MMAG, MMIN, MTBA, L, K) \
290
(u64)((LCM)&0x00000001) << 0 | (u64)((MXL)&0x00000007) << 2 | \
291
(u64)((MMAG)&0x00000001) << 5 | (u64)((MMIN)&0x00000007) << 6 | \
292
(u64)((MTBA)&0x00000001) << 9 | (u64)((L)&0x00000003) << 19 | \
293
(u64)((K)&0x00000FFF) << 32
294
295
#define GS_SET_TEX2(PSM, CBA, CPSM, CSM, CSA, CLD) \
296
(u64)((PSM)&0x0000003F) << 20 | (u64)((CBA)&0x00003FFF) << 37 | \
297
(u64)((CPSM)&0x0000000F) << 51 | (u64)((CSM)&0x00000001) << 55 | \
298
(u64)((CSA)&0x0000001F) << 56 | (u64)((CLD)&0x00000007) << 61
299
300
#define GS_SET_TEXA(A0, AM, A1) \
301
(u64)((A0)&0x000000FF) << 0 | (u64)((AM)&0x00000001) << 15 | \
302
(u64)((A1)&0x000000FF) << 32
303
304
#define GS_SET_TEXCLUT(CBW, CU, CV) \
305
(u64)((CBW)&0x0000003F) << 0 | (u64)((CU)&0x0000003F) << 6 | \
306
(u64)((CV)&0x00000FFF) << 12
307
308
#define GS_SET_TRXDIR(DIR) (u64)((DIR)&0x00000003)
309
310
#define GS_SET_TEXFLUSH(A) (u64)((A)&0xFFFFFFFF)
311
312
#define GS_SET_TRXPOS(SX, SY, DX, DY, DIR) \
313
(u64)((SX)&0x000007FF) << 0 | (u64)((SY)&0x000007FF) << 16 | \
314
(u64)((DX)&0x000007FF) << 32 | (u64)((DY)&0x000007FF) << 48 | \
315
(u64)((DIR)&0x00000003) << 59
316
317
#define GS_SET_TRXREG(W, H) \
318
(u64)((W)&0x00000FFF) << 0 | (u64)((H)&0x00000FFF) << 32
319
320
#define GS_SET_UV(U, V) \
321
(u64)((U)&0x00003FFF) << 0 | (u64)((V)&0x00003FFF) << 16
322
323
#define GS_SET_XYOFFSET(X, Y) \
324
(u64)((X)&0x0000FFFF) << 0 | (u64)((Y)&0x0000FFFF) << 32
325
326
#define GS_SET_XYZ(X, Y, Z) \
327
(u64)((X)&0x0000FFFF) << 0 | (u64)((Y)&0x0000FFFF) << 16 | \
328
(u64)((Z)&0xFFFFFFFF) << 32
329
330
#define GS_SET_XYZF(X, Y, Z, F) \
331
(u64)((X)&0x0000FFFF) << 0 | (u64)((Y)&0x0000FFFF) << 16 | \
332
(u64)((Z)&0x00FFFFFF) << 32 | (u64)((F)&0x000000FF) << 56
333
334
#define GS_SET_ZBUF(ZBA, ZSM, ZMSK) \
335
(u64)((ZBA)&0x000001FF) << 0 | (u64)((ZSM)&0x0000000F) << 24 | \
336
(u64)((ZMSK)&0x00000001) << 32
337
338
#endif
/* __GS_GP_H__ */
tamtypes.h
common
include
gs_gp.h
Generated on Thu Nov 14 2024 05:25:24 for PS2SDK by
1.9.8