SSBM Decomp
Loading...
Searching...
No Matches
GXVert.h
Go to the documentation of this file.
1#ifndef _DOLPHIN_GX_GXVERT_H_
2#define _DOLPHIN_GX_GXVERT_H_
3
4#include <dolphin/types.h>
5
6#ifdef __cplusplus
7extern "C" {
8#endif
9
10#define GXFIFO_ADDR 0xCC008000
11
24
25#if defined(__MWERKS__) && !defined(M2CTX)
27#else
28#define GXWGFifo (*(volatile PPCWGPipe*) GXFIFO_ADDR)
29#endif
30
31#if DEBUG
32
33// external functions
34
35#define FUNC_1PARAM(name, T) void name##1##T(T x);
36#define FUNC_2PARAM(name, T) void name##2##T(T x, T y);
37#define FUNC_3PARAM(name, T) void name##3##T(T x, T y, T z);
38#define FUNC_4PARAM(name, T) void name##4##T(T x, T y, T z, T w);
39#define FUNC_INDEX8(name) void name##1x8(u8 x);
40#define FUNC_INDEX16(name) void name##1x16(u16 x);
41
42#else
43
44// inline functions
45
46#define FUNC_1PARAM(name, T) \
47 static inline void name##1##T(T x) \
48 { \
49 GXWGFifo.T = x; \
50 }
51
52#define FUNC_2PARAM(name, T) \
53 static inline void name##2##T(T x, T y) \
54 { \
55 GXWGFifo.T = x; \
56 GXWGFifo.T = y; \
57 }
58
59#define FUNC_3PARAM(name, T) \
60 static inline void name##3##T(T x, T y, T z) \
61 { \
62 GXWGFifo.T = x; \
63 GXWGFifo.T = y; \
64 GXWGFifo.T = z; \
65 }
66
67#define FUNC_4PARAM(name, T) \
68 static inline void name##4##T(T x, T y, T z, T w) \
69 { \
70 GXWGFifo.T = x; \
71 GXWGFifo.T = y; \
72 GXWGFifo.T = z; \
73 GXWGFifo.T = w; \
74 }
75
76#define FUNC_INDEX8(name) \
77 static inline void name##1x8(u8 x) \
78 { \
79 GXWGFifo.u8 = x; \
80 }
81
82#define FUNC_INDEX16(name) \
83 static inline void name##1x16(u16 x) \
84 { \
85 GXWGFifo.u16 = x; \
86 }
87
88#endif
89
90// GXCmd
91FUNC_1PARAM(GXCmd, u8)
92FUNC_1PARAM(GXCmd, u16)
93FUNC_1PARAM(GXCmd, u32)
94
95// GXParam
96FUNC_1PARAM(GXParam, u8)
97FUNC_1PARAM(GXParam, u16)
98FUNC_1PARAM(GXParam, u32)
99FUNC_1PARAM(GXParam, s8)
100FUNC_1PARAM(GXParam, s16)
101FUNC_1PARAM(GXParam, s32)
102FUNC_1PARAM(GXParam, f32)
103FUNC_3PARAM(GXParam, f32)
104FUNC_4PARAM(GXParam, f32)
105
106// GXPosition
107FUNC_3PARAM(GXPosition, f32)
108FUNC_3PARAM(GXPosition, u8)
109FUNC_3PARAM(GXPosition, s8)
110FUNC_3PARAM(GXPosition, u16)
111FUNC_3PARAM(GXPosition, s16)
112FUNC_2PARAM(GXPosition, f32)
113FUNC_2PARAM(GXPosition, u8)
114FUNC_2PARAM(GXPosition, s8)
115FUNC_2PARAM(GXPosition, u16)
116FUNC_2PARAM(GXPosition, s16)
117FUNC_INDEX16(GXPosition)
118FUNC_INDEX8(GXPosition)
119
120// GXNormal
121FUNC_3PARAM(GXNormal, f32)
122FUNC_3PARAM(GXNormal, s16)
123FUNC_3PARAM(GXNormal, s8)
124FUNC_INDEX16(GXNormal)
125FUNC_INDEX8(GXNormal)
126
127// GXColor
134
135// GXTexCoord
136FUNC_2PARAM(GXTexCoord, f32)
137FUNC_2PARAM(GXTexCoord, s16)
138FUNC_2PARAM(GXTexCoord, u16)
139FUNC_2PARAM(GXTexCoord, s8)
140FUNC_2PARAM(GXTexCoord, u8)
141FUNC_1PARAM(GXTexCoord, f32)
142FUNC_1PARAM(GXTexCoord, s16)
143FUNC_1PARAM(GXTexCoord, u16)
144FUNC_1PARAM(GXTexCoord, s8)
145FUNC_1PARAM(GXTexCoord, u8)
146FUNC_INDEX16(GXTexCoord)
147FUNC_INDEX8(GXTexCoord)
148
149// GXMatrixIndex
150FUNC_1PARAM(GXMatrixIndex, u8)
151
152#if !defined(M2CTX) // undef not supported
153#undef FUNC_1PARAM
154#undef FUNC_2PARAM
155#undef FUNC_3PARAM
156#undef FUNC_4PARAM
157#undef FUNC_INDEX8
158#undef FUNC_INDEX16
159#endif
160
161#ifdef __cplusplus
162}
163#endif
164
165#endif
#define FUNC_2PARAM(name, T)
Definition GXVert.h:52
#define FUNC_INDEX8(name)
Definition GXVert.h:76
#define FUNC_INDEX16(name)
Definition GXVert.h:82
#define FUNC_4PARAM(name, T)
Definition GXVert.h:67
#define FUNC_3PARAM(name, T)
Definition GXVert.h:59
#define FUNC_1PARAM(name, T)
Definition GXVert.h:46
#define GXWGFifo
Definition GXVert.h:28
#define GXFIFO_ADDR
Definition GXVert.h:10
signed int s32
Definition types.h:12
unsigned int u32
Definition types.h:13
signed char s8
Definition types.h:4
signed short int s16
Definition types.h:6
float f32
Definition types.h:18
unsigned short int u16
Definition types.h:7
unsigned char u8
Definition types.h:5
Definition GXStruct.h:27
Definition GXVert.h:12
s16 s16
Definition GXVert.h:18
s8 s8
Definition GXVert.h:17
f64 f64
Definition GXVert.h:22
f32 f32
Definition GXVert.h:21
u32 u32
Definition GXVert.h:15
u16 u16
Definition GXVert.h:14
s32 s32
Definition GXVert.h:19
s64 s64
Definition GXVert.h:20
u8 u8
Definition GXVert.h:13
u64 u64
Definition GXVert.h:16