1 /*---------------------------------------------------------------------------*
2   Project:  Dolphin GX library
3   File:     GXGeometry.h
4 
5   Copyright 1998- 2002 Nintendo. All rights reserved.
6 
7   These coded instructions, statements, and computer programs contain
8   proprietary information of Nintendo of America Inc. and/or Nintendo
9   Company Ltd., and are protected by Federal copyright law.  They may
10   not be disclosed to third parties or copied or duplicated in any form,
11   in whole or in part, without the prior written consent of Nintendo.
12 
13   $Log: GXGeometry.h,v $
14   Revision 1.2  2006/02/04 11:56:46  hashida
15   (none)
16 
17   Revision 1.1.1.1  2005/12/29 06:53:28  hiratsu
18   Initial import.
19 
20   Revision 1.1.1.1  2005/05/12 02:41:07  yasuh-to
21   Ported from dolphin source tree.
22 
23 
24     14    2002/08/20 9:58 Hirose
25     Included os.h instead of defining prototype of OSPanic locally.
26 
27     13    2002/07/24 9:07 Hirose
28     Resolved version conflicts.
29 
30     13    2002/04/09 15:15 Hirose
31     const type specifier support. (worked by hiratsu@IRD)
32 
33     12     2001/04/17 5:29p Tian
34     Changed all inlines to static inline
35 
36     11    2001/04/04 1:10p Carl
37     Latest XF bug fix.
38 
39     10    2001/03/16 7:22p Carl
40     Changes for XF stall bug.
41 
42     9     2000/10/18 5:44p Hirose
43     Modified definition rule of GXSetTexCoordGen
44 
45     8     2000/10/18 4:05p Carl
46     Latest round of HW2 modifications and minor updates.
47 
48     7     2000/10/03 7:55p Hirose
49     Update for HW2(Rev.B) GX API extensions
50 
51     6     2000/09/29 9:51p Hirose
52     Replaced "MAC" flag by better alternatives
53 
54     5     2000/07/07 6:00p Dante
55     PC Compatibility
56 
57     4     2000/03/27 4:59p Danm
58     Made GXEnd inline in non-debug builds
59 
60     3     2000/03/14 1:36p Alligator
61     Changed GXSetTexCoordGen matrix type to u32 so developers can override
62     matrix memory map without spurious warnings.
63 
64     2     2000/03/03 4:21p Alligator
65     Integrated with ArtX source
66 
67     7     1999/10/29 3:35p Hirose
68     Added GXSetNumTexGens(u8)
69 
70     6     1999/10/13 4:32p Alligator
71     Changed GXSetViewport, GXSetScissor to use xorig, yorig, wd, ht
72 
73     5     1999/09/30 10:40p Yasu
74     Renamed some GX functions and enums
75 
76     4     1998/01/05 2:39p Ryan
77     Routine update to match header file to man pages
78 
79     3     1999/08/17 1:33p Alligator
80     Added GXSetTexGenEnables function, modified GXTexCoordID enumeration for
81     bitwise OR of enables.
82 
83     2     1999/07/28 4:07p Alligator
84     Updated header files and emulator for hw changes
85 
86     1     1999/07/14 4:20p Alligator
87     Split gx.h into individual header files for each major section of API
88   $NoKeywords: $
89  *---------------------------------------------------------------------------*/
90 
91 #ifndef __GXGEOMETRY_H__
92 #define __GXGEOMETRY_H__
93 
94 #ifdef __cplusplus
95 extern "C" {
96 #endif
97 
98 /*---------------------------------------------------------------------------*/
99 #include <revolution/types.h>
100 #include <revolution/os.h>
101 #include <revolution/gx/GXEnum.h>
102 #include <revolution/gx/GXStruct.h>
103 
104 void GXSetVtxDesc           ( GXAttr attr, GXAttrType type );
105 void GXSetVtxDescv          ( const GXVtxDescList *attrPtr );
106 void GXClearVtxDesc         ( void );
107 
108 void GXSetVtxAttrFmt(
109     GXVtxFmt       vtxfmt,
110     GXAttr         attr,
111     GXCompCnt      cnt,
112     GXCompType     type,
113     u8             frac );
114 
115 void GXSetVtxAttrFmtv       ( GXVtxFmt vtxfmt, const GXVtxAttrFmtList *list );
116 void GXSetArray             ( GXAttr attr, const void *base_ptr, u8 stride );
117 void GXBegin                ( GXPrimitive type, GXVtxFmt vtxfmt, u16 nverts );
118 
119 #if defined(EMU) || defined(WIN32)
120 void GXEnd                  ( void );
121 #else // !EMU
GXEnd(void)122 static inline void GXEnd           ( void )
123 {
124 #ifdef _DEBUG
125     extern GXBool __GXinBegin;
126     if (!__GXinBegin)
127         OSPanic(__FILE__, __LINE__, "GXEnd: called without a GXBegin");
128     __GXinBegin = GX_FALSE;
129 #endif
130 }
131 #endif // EMU
132 
133 #if ( GX_REV != 1 ) // GX revision 2 or later only
134 void GXSetTexCoordGen2(
135     GXTexCoordID     dst_coord,
136     GXTexGenType     func,
137     GXTexGenSrc      src_param,
138     u32              mtx,
139     GXBool           normalize,
140     u32              postmtx );
141 #endif // ( GX_REV != 1 )
142 
143 #if ( GX_REV == 1 || defined(EMU) ) // GX revision 1 or emulator
144 void GXSetTexCoordGen(
145     GXTexCoordID     dst_coord,
146     GXTexGenType     func,
147     GXTexGenSrc      src_param,
148     u32              mtx );
149 #else // GX revision 2 or later and real hardware
GXSetTexCoordGen(GXTexCoordID dst_coord,GXTexGenType func,GXTexGenSrc src_param,u32 mtx)150 static inline void GXSetTexCoordGen (
151     GXTexCoordID    dst_coord,
152     GXTexGenType    func,
153     GXTexGenSrc     src_param,
154     u32             mtx )
155 {
156     GXSetTexCoordGen2(dst_coord, func, src_param, mtx,
157                       GX_FALSE, GX_PTIDENTITY);
158 }
159 #endif // ( GX_REV == 1 || defined(EMU) )
160 
161 
162 void GXSetNumTexGens        ( u8 nTexGens );
163 
164 void GXInvalidateVtxCache   ( void );
165 void GXSetLineWidth         ( u8 width, GXTexOffset texOffsets );
166 void GXSetPointSize         ( u8 pointSize, GXTexOffset texOffsets );
167 void GXEnableTexOffsets	    ( GXTexCoordID coord, GXBool line_enable,
168 			      GXBool point_enable );
169 
170 /*---------------------------------------------------------------------------*/
171 #ifdef __cplusplus
172 }
173 #endif
174 
175 #endif // __GXGEOMETRY_H__
176