1 /*---------------------------------------------------------------------------*
2   Project:  Dolphin GX library
3   File:     GXTexture.h
4 
5   Copyright 1998- 2003 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: GXTexture.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     12    2003/04/10 21:08 Hirose
25     Added const specifier to texture-load related functions.
26 
27     10    2002/07/24 9:07 Hirose
28     Resolved version conflicts.
29 
30     11    2002/04/09 15:15 Hirose
31     const type specifier support. (worked by hiratsu@IRD)
32 
33     10    2002/03/01 17:11 Hirose
34     Added new independent GXInitTexObj* functions.
35 
36     9     2001/01/24 4:28p Carl
37     New texture init and get functions added.
38 
39     8     2001/01/18 12:21p Carl
40     Changes related to __GXSetSUTexRegs modifications.
41     Added GXSetTexCoordBias.
42 
43     7     2000/07/14 3:01p Carl
44     Added GXSetTexCoordCylWrap
45 
46     6     2000/05/03 3:41p Carl
47     Added GXSetTexCoordScaleManually prototype.
48 
49     5     2000/04/26 4:53p Carl
50     CallBacks are now Callbacks.  Set callback routines now return old
51     callbacks.  Added gets for fifo objects.
52 
53     4     2000/01/13 5:55p Alligator
54     integrate with ArtX GX library code
55 
56     3     1999/12/07 7:44p Hirose
57     added GXInitTexCacheRegion and GXInitTexPreloadRegion
58 
59     2     1999/12/02 8:13p Hirose
60     changed prototype of GXTexRegionCallBack
61 
62     13    1999/10/13 5:21p Alligator
63     add 32b mipmap flag to GXInitTexRegion
64 
65     12    1999/10/12 11:14a Hirose
66     deleted TlutObjUserData functions
67 
68     11    1999/10/04 6:47p Yasu
69     Rename -Sz to -Size
70 
71     10    1999/09/30 10:40p Yasu
72     Renamed some GX functions and enums
73 
74     9     1999/09/22 10:38p Hirose
75     added prototype of GXGetTexBufferSize
76 
77     8     1999/09/21 9:10p Hirose
78     deleted t_obj parameter of GXTlutRegionCallBack
79 
80     7     1999/09/21 5:50p Hirose
81     changed return value type of GXLoadTlut to void from u32
82 
83     6     1999/09/17 6:35p Hirose
84     changed parameters of GXInitTlutObj and GXLoadTlut
85 
86     5     1999/09/01 2:49p Ryan
87 
88     3     1999/08/17 12:02p Alligator
89     updated to reflect arbitrary tlut size
90 
91     2     1999/08/11 9:01p Hirose
92     added GXInvalidateTexAll()
93 
94     1     1999/07/14 4:20p Alligator
95     Split gx.h into individual header files for each major section of API
96   $NoKeywords: $
97  *---------------------------------------------------------------------------*/
98 
99 #ifndef __GXTEXTURE_H__
100 #define __GXTEXTURE_H__
101 
102 #ifdef __cplusplus
103 extern "C" {
104 #endif
105 
106 /*---------------------------------------------------------------------------*/
107 #include <revolution/types.h>
108 #include <revolution/gx/GXEnum.h>
109 #include <revolution/gx/GXStruct.h>
110 
111 typedef GXTexRegion*  (*GXTexRegionCallback) (const GXTexObj* t_obj, GXTexMapID id);
112 typedef GXTlutRegion* (*GXTlutRegionCallback)(u32 idx);
113 
114 /*---------------------------------------------------------------------------*/
115 void GXInitTexObj(
116          GXTexObj*      obj,
117          void*          image_ptr,
118          u16            width,
119          u16            height,
120          GXTexFmt       format,
121          GXTexWrapMode  wrap_s,
122          GXTexWrapMode  wrap_t,
123          GXBool         mipmap);
124 
125 void GXInitTexObjCI(
126          GXTexObj*      obj,
127          void*          image_ptr,
128          u16            width,
129          u16            height,
130          GXCITexFmt     format,
131          GXTexWrapMode  wrap_s,
132          GXTexWrapMode  wrap_t,
133          GXBool         mipmap,
134          u32            tlut_name);
135 
136 void GXInitTexObjLOD(
137          GXTexObj*      obj,
138          GXTexFilter    min_filt,
139          GXTexFilter    mag_filt,
140          f32            min_lod,
141          f32            max_lod,
142          f32            lod_bias,
143          GXBool         bias_clamp,
144          GXBool         do_edge_lod,
145          GXAnisotropy   max_aniso );
146 
147 void  GXInitTexObjData     ( GXTexObj* obj, void* image_ptr );
148 void  GXInitTexObjWrapMode ( GXTexObj* obj, GXTexWrapMode s, GXTexWrapMode t );
149 void  GXInitTexObjTlut     ( GXTexObj* obj, u32 tlut_name );
150 void  GXInitTexObjFilter   ( GXTexObj* obj, GXTexFilter min_filt, GXTexFilter mag_filt );
151 void  GXInitTexObjMaxLOD   ( GXTexObj* obj, f32 max_lod );
152 void  GXInitTexObjMinLOD   ( GXTexObj* obj, f32 min_lod );
153 void  GXInitTexObjLODBias  ( GXTexObj* obj, f32 lod_bias );
154 void  GXInitTexObjBiasClamp( GXTexObj* obj, GXBool bias_clamp );
155 void  GXInitTexObjEdgeLOD  ( GXTexObj* obj, GXBool do_edge_lod );
156 void  GXInitTexObjMaxAniso ( GXTexObj* obj, GXAnisotropy max_aniso );
157 
158 
159 void  GXInitTexObjUserData ( GXTexObj* obj, void* user_data );
160 void* GXGetTexObjUserData  ( const GXTexObj* obj );
161 
162 void  GXLoadTexObj         ( const GXTexObj* obj, GXTexMapID id );
163 
164 u32   GXGetTexBufferSize(
165           u16           width,
166           u16           height,
167           u32           format,
168           GXBool        mipmap,
169           u8            max_lod );
170 
171 void GXInitTlutObj(
172          GXTlutObj* tlut_obj,
173          void*      lut,
174          GXTlutFmt  fmt,
175          u16        n_entries );
176 
177 void GXLoadTlut             ( const GXTlutObj* tlut_obj, u32 tlut_name );
178 
179 void GXInitTexCacheRegion(
180          GXTexRegion*      region,
181          GXBool            is_32b_mipmap,
182          u32               tmem_even,
183          GXTexCacheSize    size_even,
184          u32               tmem_odd,
185          GXTexCacheSize    size_odd );
186 
187 void GXInitTexPreLoadRegion(
188          GXTexRegion*      region,
189          u32               tmem_even,
190          u32               size_even,
191          u32               tmem_odd,
192          u32               size_odd );
193 
194 void GXInitTlutRegion(
195          GXTlutRegion*     region,
196          u32               tmem_addr,
197          GXTlutSize        tlut_size );
198 
199 void GXInvalidateTexRegion  ( const GXTexRegion* region );
200 void GXInvalidateTexAll     ( void );
201 void GXPreLoadEntireTexture ( const GXTexObj* tex_obj, const GXTexRegion* region );
202 
203 GXTexRegionCallback  GXSetTexRegionCallback ( GXTexRegionCallback f );
204 GXTlutRegionCallback GXSetTlutRegionCallback( GXTlutRegionCallback f );
205 
206 void GXLoadTexObjPreLoaded(
207          const GXTexObj*    obj,
208          const GXTexRegion* region,
209          GXTexMapID         id );
210 
211 void GXSetTexCoordScaleManually(GXTexCoordID coord,
212                                 GXBool enable,
213                                 u16 ss, u16 ts);
214 
215 void GXSetTexCoordCylWrap(GXTexCoordID coord,
216                           GXBool s_enable,
217                           GXBool t_enable);
218 
219 void GXSetTexCoordBias(GXTexCoordID coord,
220                        GXBool s_enable,
221                        GXBool t_enable);
222 
223 /*---------------------------------------------------------------------------*/
224 #ifdef __cplusplus
225 }
226 #endif
227 
228 #endif // __GXTEXTURE_H__
229