1 /*---------------------------------------------------------------------------*
2   Project:  Horizon
3   File:     gr_Texture.h
4 
5   Copyright (C)2009-2012 Nintendo Co., Ltd.  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   $Rev: 47511 $
14  *---------------------------------------------------------------------------*/
15 
16 #ifndef NN_GR_TEXTURE_H_
17 #define NN_GR_TEXTURE_H_
18 
19 #include <nn/gr/CTR/gr_Utility.h>
20 
21 namespace nn
22 {
23     namespace gr
24     {
25         namespace CTR
26         {
27 
28             /* Please see man pages for details
29 
30              */
31             class Texture
32             {
33             public :
34 
35                 /* Please see man pages for details
36 
37                  */
38                 class UnitBase
39                 {
40                 public :
41                     /* Please see man pages for details
42 
43                      */
44                     uptr physicalAddr;
45 
46 
47                     /* Please see man pages for details
48 
49                      */
50                     u16 width;
51 
52 
53                     /* Please see man pages for details
54 
55                      */
56                     u16 height;
57 
58                     /* Please see man pages for details
59 
60 
61                     */
62                     PicaDataTextureFormat format;
63 
64                     /* Please see man pages for details
65 
66 
67 
68                      */
69                     PicaDataTextureWrap wrapT;
70 
71                     /* Please see man pages for details
72 
73 
74 
75                     */
76                     PicaDataTextureWrap wrapS;
77 
78                     /* Please see man pages for details
79 
80 
81 
82                     */
83                     PicaDataTextureMagFilter magFilter;
84 
85 
86                     /* Please see man pages for details
87 
88 
89 
90                     */
91                     PicaDataTextureMinFilter minFilter;
92                     NN_PADDING3;
93 
94                     /* Please see man pages for details
95 
96 
97 
98 
99 
100 
101 
102                     */
103                     f32 lodBias;
104 
105                     /* Please see man pages for details
106 
107 
108 
109 
110 
111                      */
112                     u8 minLodLevel;
113 
114 
115                     /* Please see man pages for details
116 
117 
118 
119 
120 
121                     */
122                     u8 maxLodLevel;
123 
124 
125                     /* Please see man pages for details
126 
127 
128 
129                      */
130                     u8 borderColorR;
131 
132                     /* Please see man pages for details
133 
134 
135 
136                      */
137                     u8 borderColorG;
138 
139 
140                     /* Please see man pages for details
141 
142 
143 
144                      */
145                     u8 borderColorB;
146 
147 
148                     /* Please see man pages for details
149 
150 
151 
152                      */
153                     u8 borderColorA;
154 
155                     NN_PADDING2;
156 
157                 protected :
158                     /* Please see man pages for details
159 
160 
161 
162                     */
IsEnableMipMap()163                     bool IsEnableMipMap() const
164                     {
165                         if ( minFilter == PICA_DATA_TEXTURE_MIN_FILTER_LINEAR  )
166                         {
167                             return false;
168                         }
169 
170                         if ( minFilter == PICA_DATA_TEXTURE_MIN_FILTER_NEAREST )
171                         {
172                             return false;
173                         }
174 
175                         return true;
176                     }
177 
178                     /* Please see man pages for details
179 
180                      */
181                     UnitBase();
182                 };
183 
184             public :
185 
186                 /* Please see man pages for details
187 
188                  */
189                 class Unit0 : public UnitBase
190                 {
191                 public :
192                      /* Please see man pages for details
193 
194 
195 
196                      */
197                     PicaDataTexture0SamplerType texType;
198                     NN_PADDING3;
199 
200                     /* Please see man pages for details
201 
202 
203                     */
204                     uptr cubeMapAddrPosX;
205 
206                     /* Please see man pages for details
207 
208 
209                     */
210                     uptr cubeMapAddrNegX;
211 
212                     /* Please see man pages for details
213 
214 
215                     */
216                     uptr cubeMapAddrPosY;
217 
218                     /* Please see man pages for details
219 
220 
221                     */
222                     uptr cubeMapAddrNegY;
223 
224                     /* Please see man pages for details
225 
226 
227                     */
228                     uptr cubeMapAddrPosZ;
229 
230                     /* Please see man pages for details
231 
232 
233                     */
234                     uptr cubeMapAddrNegZ;
235 
236                 public :
237                     /* Please see man pages for details
238 
239 
240 
241 
242 
243 
244                      */
245                     bit32* MakeCommand( bit32* command, bool is_update_texture_func = true ) const;
246 
247                     /* Please see man pages for details
248 
249 
250 
251                      */
252                     explicit Unit0( const Texture& texture_ );
253 
254                 protected :
255                     const Texture& m_Texture;
256                 };
257 
258                 /* Please see man pages for details
259 
260                  */
261                 class Unit1 : public UnitBase
262                 {
263                 public :
264                     /* Please see man pages for details
265 
266 
267 
268                      */
269                     PicaDataTexture1SamplerType texType;
270                     NN_PADDING3;
271 
272                 public :
273                     /* Please see man pages for details
274 
275 
276 
277 
278 
279 
280                      */
281                     bit32* MakeCommand( bit32* command, bool is_update_texture_func = true ) const;
282 
283                     /* Please see man pages for details
284 
285 
286 
287                      */
288                     explicit Unit1( const Texture& texture_ );
289 
290                 protected :
291                     const Texture& m_Texture;
292                 };
293 
294                 /* Please see man pages for details
295 
296                  */
297                 class Unit2 : public UnitBase
298                 {
299                 public :
300                     /* Please see man pages for details
301 
302 
303                      */
304                     PicaDataTexture2SamplerType texType;
305 
306                     /* Please see man pages for details
307 
308 
309 
310                      */
311                     PicaDataTexture2TexCoord    texCoord;
312 
313                     NN_PADDING2;
314 
315                 public :
316                     /* Please see man pages for details
317 
318 
319 
320 
321 
322 
323                      */
324                      bit32* MakeCommand( bit32* command, bool is_update_texture_func = true ) const;
325 
326                     /* Please see man pages for details
327 
328 
329 
330                      */
331                     explicit Unit2( const Texture& texture_ );
332 
333                 protected :
334                     const Texture& m_Texture;
335                 };
336 
337                 /* Please see man pages for details
338 
339                  */
340                 class Unit3 : protected UnitBase
341                 {
342                 public :
343                     /* Please see man pages for details
344 
345 
346 
347                      */
348                     PicaDataTexture3SamplerType texType;
349 
350                      /* Please see man pages for details
351 
352 
353 
354                      */
355                     PicaDataTexture3TexCoord    texCoord;
356 
357                     NN_PADDING2;
358 
359                 public :
360                     /* Please see man pages for details
361 
362 
363 
364 
365 
366 
367                      */
368                     bit32* MakeCommand( bit32* command, bool is_update_texture_func = true ) const;
369 
370                     /* Please see man pages for details
371 
372 
373 
374                      */
375                     explicit Unit3( const Texture& texture_ );
376 
377                 protected :
378                     const Texture& m_Texture;
379                 };
380 
381             public :
382                 /* Please see man pages for details
383 
384 
385                 */
386                 Unit0 unit0;
387 
388                 /* Please see man pages for details
389 
390 
391                 */
392                 Unit1 unit1;
393 
394                 /* Please see man pages for details
395 
396 
397                 */
398                 Unit2 unit2;
399 
400                 /* Please see man pages for details
401 
402 
403                 */
404                 Unit3 unit3;
405 
406             public :
407                 /* Please see man pages for details
408 
409                 */
410                 Texture();
411 
412                 /* Please see man pages for details
413 
414 
415 
416 
417 
418 
419                  */
420                 bit32* MakeCommand( bit32* command, bool isAddDummyCommand = true ) const;
421 
422                 /* Please see man pages for details
423 
424 
425 
426 
427 
428 
429                  */
430                 bit32* MakeFuncCommand( bit32* command, bool isAddDummyCommand = true ) const;
431 
432                 /* Please see man pages for details
433 
434 
435 
436 
437 
438 
439                  */
440                 static bit32* MakeDisableCommand( bit32* command, bool isAddDummyCommand = true );
441 
442             protected:
443                 /* Please see man pages for details
444 
445 
446 
447 
448 
449                  */
450                  static bit32* MakeDummyCommand_( bit32* command );
451             };
452 
453         } // namespace CTR
454     } // namespace gr
455 } // namespace nn
456 
457 #endif // NN_GR_TEXTURE_H_
458