1 /*---------------------------------------------------------------------------*
2 
3   Copyright 2010-2011 Nintendo.  All rights reserved.
4 
5   These coded instructions, statements, and computer programs contain
6   proprietary information of Nintendo of America Inc. and/or Nintendo
7   Company Ltd., and are protected by Federal copyright law.  They may
8   not be disclosed to third parties or copied or duplicated in any form,
9   in whole or in part, without the prior written consent of Nintendo.
10 
11  *---------------------------------------------------------------------------*/
12 
13 #ifndef _GX2UT_H_
14 #define _GX2UT_H_
15 
16 #include <cafe/gx2ut/gx2utInline.h>
17 #include <cafe/gx2ut/gx2utCopy.h>
18 #include <cafe/gx2ut/gx2utClear.h>
19 #include <cafe/gx2ut/gx2utExpand.h>
20 #include <cafe/gx2ut/gx2utResolve.h>
21 
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 /// @addtogroup GX2UTHelperGroup
28 /// @{
29 
30 /// \brief Sets up common state parameters needed by various GX2UT functions.
31 ///
32 /// This routine sets the default state used by the \ref GX2UTGX2ReplacementsSect.
33 ///
34 /// It attempts to restore the minimum state needed to guarantee that
35 /// the function works as expected.
36 ///
37 /// \note This function does not restore state that has been changed by
38 ///       \ref GX2DisablesStateShadowingPage "GX2 Functions Which Disable State Shadowing".
39 ///       If any of these routines are called before this function, it is
40 ///       necessary to call \ref GX2SetContextState to restore the state first.
41 ///
42 /// \donotcall \gx2_typical \enddonotcall
43 ///
44 /// \clobberstate
45 ///
46 /// \writesgpu
47 /// \alwayswritesgpu
48 ///
49 void GX2UTSetCommonState();
50 
51 /// @}
52 
53 /// @addtogroup GX2UTSurfaceHelperGroup
54 /// @{
55 
56 /// \brief Returns the pointer to a given slice in the mip-map chain.
57 ///
58 /// \param pSurf Surface to find the swizzle for.
59 /// \param mipLevel Mipmap level
60 /// \param slice Slice
61 ///
62 /// \donotcall \threadsafe \devonly \enddonotcall
63 ///
64 void* GX2UTGetSurfaceMipSlicePtr(const GX2Surface* pSurf, u32 mipLevel, u32 slice);
65 
66 /// \brief Determine the swizzle value of a given slice and mipmap level in a surface.
67 ///
68 /// \param pSurf Surface to find the swizzle for.
69 /// \param mipLevel Mipmap level
70 /// \param slice Slice
71 ///
72 /// \donotcall \threadsafe \devonly \enddonotcall
73 ///
74 u32 GX2UTGetSurfaceMipSliceSwizzle(const GX2Surface* pSurf, u32 mipLevel, u32 slice);
75 
76 /// \brief Determine the size of a given mipmap level.
77 ///
78 /// \param pSurf Surface to find the mipmap size of
79 /// \param mipLevel Mipmap level
80 ///
81 /// \donotcall \threadsafe \devonly \enddonotcall
82 ///
83 u32 GX2UTGetSurfaceMipSize(const GX2Surface* pSurf, u32 mipLevel);
84 
85 /// \brief Determine the tiling mode of a mipmap level.
86 ///
87 /// \param pSurf Surface to select the tiling mode from
88 /// \param mipLevel Mip-map level to select
89 ///
90 /// This function determines the \ref GX2Surface.tileMode for the given
91 /// \p mipLevel. This is based on the tiling mode of \p pSurf.
92 ///
93 /// \donotcall \threadsafe \devonly \enddonotcall
94 ///
95 GX2TileMode GX2UTGetSurfaceMipSliceTileMode(const GX2Surface* pSurf, u32 mipLevel);
96 
97 /// \brief Determines if the tiling mode of a surface is *_THICK.
98 ///
99 /// \donotcall \threadsafe \devonly \enddonotcall
100 ///
101 GX2Boolean GX2UTIsTileModeThick(const GX2Surface* pSurf);
102 
103 /// @}
104 
105 #ifdef __cplusplus
106 }
107 #endif // __cplusplus
108 
109 #endif // _GX2UT_H_
110