PS2SDK
PS2 Homebrew Libraries
Loading...
Searching...
No Matches
gif_tags.h
Go to the documentation of this file.
1
6#ifndef __GIF_TAGS_H__
7#define __GIF_TAGS_H__
8
9#include <tamtypes.h>
10
12#define GIF_BLOCK_SIZE 0x7FFF
13
15#define GIF_PRE_DISABLE 0x00
17#define GIF_PRE_ENABLE 0x01
18
20#define GIF_PRIM_POINT 0x00
22#define GIF_PRIM_LINE 0x01
24#define GIF_PRIM_LINE_STRIP 0x02
26#define GIF_PRIM_TRIANGLE 0x03
28#define GIF_PRIM_TRIANGLE_STRIP 0x04
30#define GIF_PRIM_TRIANGLE_FAN 0x05
32#define GIF_PRIM_SPRITE 0x06
33
35#define GIF_FLG_PACKED 0x00
37#define GIF_FLG_REGLIST 0x01
39#define GIF_FLG_IMAGE 0x02
40
42#define GIF_REG_PRIM 0x00
44#define GIF_REG_RGBAQ 0x01
46#define GIF_REG_ST 0x02
48#define GIF_REG_UV 0x03
50#define GIF_REG_XYZF2 0x04
52#define GIF_REG_XYZ2 0x05
54#define GIF_REG_TEX0 0x06
56#define GIF_REG_TEX0_1 0x06
58#define GIF_REG_TEX0_2 0x07
60#define GIF_REG_CLAMP 0x08
62#define GIF_REG_CLAMP_1 0x08
64#define GIF_REG_CLAMP_2 0x09
66#define GIF_REG_FOG 0x0A
68#define GIF_REG_XYZF3 0x0C
70#define GIF_REG_XYZ3 0x0D
72#define GIF_REG_AD 0x0E
74#define GIF_REG_NOP 0x0F
75
76#define PACK_GIFTAG(Q, D0, D1) \
77 Q->dw[0] = (u64)(D0), \
78 Q->dw[1] = (u64)(D1)
79
80#define GIF_SET_TAG(NLOOP, EOP, PRE, PRIM, FLG, NREG) \
81 (u64)((NLOOP)&0x00007FFF) << 0 | (u64)((EOP)&0x00000001) << 15 | \
82 (u64)((PRE)&0x00000001) << 46 | (u64)((PRIM)&0x000007FF) << 47 | \
83 (u64)((FLG)&0x00000003) << 58 | (u64)((NREG)&0x0000000F) << 60
84
85#define GIF_SET_PRIM(PRIM, IIP, TME, FGE, ABE, AA1, FST, CTXT, FIX) \
86 (u64)((PRIM)&0x00000007) << 0 | (u64)((IIP)&0x00000001) << 3 | \
87 (u64)((TME)&0x00000001) << 4 | (u64)((FGE)&0x00000001) << 5 | \
88 (u64)((ABE)&0x00000001) << 6 | (u64)((AA1)&0x00000001) << 7 | \
89 (u64)((FST)&0x00000001) << 8 | (u64)((CTXT)&0x00000001) << 9 | \
90 (u64)((FIX)&0x00000001) << 10
91
92#define GIF_SET_RGBAQ(R, G, B, A, Q) \
93 (u64)((R)&0x000000FF) << 0 | (u64)((G)&0x000000FF) << 8 | \
94 (u64)((B)&0x000000FF) << 16 | (u64)((A)&0x000000FF) << 24 | \
95 (u64)((Q)&0xFFFFFFFF) << 32
96
97#define GIF_SET_ST(S, T) \
98 (u64)((S)&0xFFFFFFFF) << 0 | (u64)((T)&0xFFFFFFFF) << 32
99
100#define GIF_SET_UV(U, V) \
101 (u64)((U)&0x00003FFF) << 0 | (u64)((V)&0x00003FFF) << 16
102
103#define GIF_SET_XYZ(X, Y, Z) \
104 (u64)((X)&0x0000FFFF) << 0 | (u64)((Y)&0x0000FFFF) << 16 | \
105 (u64)((Z)&0xFFFFFFFF) << 32
106
107#define GIF_SET_XYZF(X, Y, Z, F) \
108 (u64)((X)&0x0000FFFF) << 0 | (u64)((Y)&0x0000FFFF) << 16 | \
109 (u64)((Z)&0x00FFFFFF) << 32 | (u64)((F)&0x000000FF) << 56
110
111#define GIF_SET_TEX0(TBA, TBW, PSM, TW, TH, TCC, TFNCT, CBA, CPSM, CSM, CSA, CLD) \
112 (u64)((TBA)&0x00003FFF) << 0 | (u64)((TBW)&0x0000003F) << 14 | \
113 (u64)((PSM)&0x0000003F) << 20 | (u64)((TW)&0x0000000F) << 26 | \
114 (u64)((TH)&0x0000000F) << 30 | (u64)((TCC)&0x00000001) << 34 | \
115 (u64)((TFNCT)&0x00000003) << 35 | (u64)((CBA)&0x00003FFF) << 37 | \
116 (u64)((CPSM)&0x0000000F) << 51 | (u64)((CSM)&0x00000001) << 55 | \
117 (u64)((CSA)&0x0000001F) << 56 | (u64)((CLD)&0x00000007) << 61
118
119#define GIF_SET_CLAMP(WMS, WMT, MINU, MAXU, MINV, MAXV) \
120 (u64)((WMS)&0x00000003) << 0 | (u64)((WMT)&0x00000003) << 2 | \
121 (u64)((MINU)&0x000003FF) << 4 | (u64)((MAXU)&0x000003FF) << 14 | \
122 (u64)((MINV)&0x000003FF) << 24 | (u64)((MAXV)&0x000003FF) << 34
123
124#define GIF_SET_FOG(FOG) (u64)((FOG)&0x000000FF) << 56
125
126#endif /* __GIFTAGS_H__ */