1 /*---------------------------------------------------------------------------*
2 
3   Copyright (C) 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 #pragma once
13 #ifndef __GFDFILESHADER_H__
14 #define __GFDFILESHADER_H__
15 
16 #ifdef __cplusplus
17 extern "C"
18 {
19 #endif // __cplusplus
20 
21 /// @addtogroup GFDFileShaderGroup
22 /// @{
23 
24 /// \brief Struct for containing GX2 Shaders
25 ///
26 
27 /// \brief Creates a gsh file based on the passed in GFDShaders
28 ///
29 /// \param pFilename     Name of the output file
30 /// \param gpuVer        GPU version
31 /// \param swapMode      Endian swap mode for shader data (GPU data)
32 /// \param alignMode     Align mode for adding data specific alignment size padding block before image data (GPU data)
33 /// \param numShader     Number of shaders in pShaders
34 /// \param pShaders      Input GFDShaders array pointer used to create gsh file.
35 ///                      If it's includes GX2XXXShader with NULL pointer, it's ignored.
36 //                       It's used for creating a separate shader binary file.
37 /// \return true or false
38 ///
39 /// \donotcall \notthreadsafe \hostonly \enddonotcall
40 ///
41 GFD_DECLSPEC bool GFD_API GFDWriteFileShader(char* pFilename, GFDGPUVersion gpuVer, GFDEndianSwapMode swapMode, GFDAlignMode alignMode, u32 numShader, const GFDShaders *pShaders);
42 
43 /// \brief Creates a gsh file based on the passed in GFDShaders2
44 ///
45 /// \param pFilename     Name of the output file
46 /// \param gpuVer        GPU version
47 /// \param swapMode      Endian swap mode for shader data (GPU data)
48 /// \param alignMode     Align mode for adding data specific alignment size padding block before image data (GPU data)
49 /// \param numShader     Number of shaders in pShaders
50 /// \param pShaders      Input GFDShaders2 array pointer used to create gsh file.
51 ///                      If it's includes GX2XXXShader with NULL pointer, it's ignored.
52 //                       It's used for creating a separate shader binary file.
53 /// \return true or false
54 ///
55 /// \donotcall \notthreadsafe \hostonly \enddonotcall
56 ///
57 GFD_DECLSPEC bool GFD_API GFDWriteFileShader2(char* pFilename, GFDGPUVersion gpuVer, GFDEndianSwapMode swapMode, GFDAlignMode alignMode, u32 numShader, const GFDShaders2 *pShaders);
58 
59 /// \brief Appends shaders based on the passed in GFDShaders to an existing gsh file
60 ///
61 /// \param pFilename     Name of the file to append shaders
62 /// \param gpuVer        GPU version
63 /// \param swapMode      Endian swap mode for shader data (GPU data)
64 /// \param alignMode     Align mode for adding data specific alignment size padding block before image data (GPU data)
65 /// \param numShader     Number of shaders in pShaders
66 /// \param pShaders      Input GFDShaders array pointer used to create gsh file.
67 ///                      If it includes GX2XXXShader with NULL pointer, it's ignored.
68 //                       It's used for creating a separate shader binary file.
69 /// \return true or false
70 ///
71 /// \donotcall \notthreadsafe \hostonly \enddonotcall
72 ///
73 GFD_DECLSPEC bool GFD_API GFDAppendWriteFileShader(char* pFilename, GFDGPUVersion gpuVer, GFDEndianSwapMode swapMode, GFDAlignMode alignMode, u32 numShader, const GFDShaders *pShaders);
74 
75 /// \brief Appends shaders based on the passed in GFDShaders2 to an existing gsh file
76 ///
77 /// \param pFilename     Name of the file to append shaders
78 /// \param gpuVer        GPU version
79 /// \param swapMode      Endian swap mode for shader data (GPU data)
80 /// \param alignMode     Align mode for adding data specific alignment size padding block before image data (GPU data)
81 /// \param numShader     Number of shaders in pShaders
82 /// \param pShaders      Input GFDShaders2 array pointer used to create gsh file.
83 ///                      If it includes GX2XXXShader with NULL pointer, it's ignored.
84 //                       It's used for creating a separate shader binary file.
85 /// \return true or false
86 ///
87 /// \donotcall \notthreadsafe \hostonly \enddonotcall
88 ///
89 GFD_DECLSPEC bool GFD_API GFDAppendWriteFileShader2(char* pFilename, GFDGPUVersion gpuVer, GFDEndianSwapMode swapMode, GFDAlignMode alignMode, u32 numShader, const GFDShaders2 *pShaders);
90 
91 /// \brief Write out a header file containing all the attributes, uniforms, samplers, and even the code as compilable code.
92 ///
93 /// \param pFilename     Name of the output file
94 /// \param swapMode      Endian swap mode for shader data (GPU data)
95 /// \param pShaders      Input GFDShaders array pointer used to create gsh file.
96 ///                      If it includes GX2XXXShader with NULL pointer, it's ignored.
97 ///                       It's used for creating a separate shader binary file.
98 /// \return true or false
99 ///
100 /// \donotcall \notthreadsafe \hostonly \enddonotcall
101 ///
102 GFD_DECLSPEC bool GFD_API GFDWriteFileShaderAsCode(char* pFilename, GFDEndianSwapMode swapMode, const GFDShaders *pShaders);
103 
104 /// \brief Write out a header file containing all the attributes, uniforms, samplers, and even the code as compilable code.
105 ///
106 /// \param pFilename     Name of the output file
107 /// \param swapMode      Endian swap mode for shader data (GPU data)
108 /// \param pShaders      Input GFDShaders2 array pointer used to create gsh file.
109 ///                      If it includes GX2XXXShader with NULL pointer, it's ignored.
110 ///                       It's used for creating a separate shader binary file.
111 /// \return true or false
112 ///
113 /// \donotcall \notthreadsafe \hostonly \enddonotcall
114 ///
115 GFD_DECLSPEC bool GFD_API GFDWriteFileShaderAsCode2(char* pFilename, GFDEndianSwapMode swapMode, const GFDShaders2 *pShaders);
116 
117 /// \brief Write out a header file containing all the attributes, uniforms, samplers, and even the code as compilable code.
118 ///
119 /// \param pFilename     Name of the output file
120 /// \param swapMode      Endian swap mode for shader data (GPU data)
121 /// \param pShaders      Input GFDShaders2 array pointer used to create gsh file.
122 ///                      If it includes GX2XXXShader with NULL pointer, it's ignored.
123 //                       It's used for creating a separate shader binary file.
124 /// \param pShadersSrc   Original source used to create shaders
125 /// \return true or false
126 //
127 GFD_DECLSPEC bool GFD_API GFDWriteFileShaderAsCodeWithSource(char* pFilename, GFDEndianSwapMode swapMode, const GFDShaders2 *pShaders, const GFDShadersSrc *pShadersSrc);
128 
129 /// @}
130 
131 #ifdef __cplusplus
132 }
133 #endif // __cplusplus
134 
135 #endif  // __GFDFILESHADER_H__
136