WUT  0.1
Wii U Toolchain
surface.h
Go to the documentation of this file.
1 #pragma once
2 #include <wut.h>
3 
10 #ifdef __cplusplus
11 extern "C" {
12 #endif
13 
14 typedef struct GX2Surface GX2Surface;
17 
18 typedef enum
19 {
29 
30 typedef enum
31 {
53 
67 
77 
88 
93 
104 
105 typedef enum GX2AAMode
106 {
108 } GX2AAMode;
109 
110 typedef enum GX2SurfaceUse
111 {
116 } GX2SurfaceUse;
117 
118 typedef enum GX2RResourceFlags
119 {
142 
143 typedef enum GX2TileMode
144 {
162 } GX2TileMode;
163 
164 typedef enum GX2RenderTarget
165 {
174 
176 {
178  uint32_t width;
179  uint32_t height;
180  uint32_t depth;
181  uint32_t mipLevels;
184  union
185  {
188  };
189  uint32_t imageSize;
190  void *image;
191  uint32_t mipmapSize;
192  void *mipmaps;
194  uint32_t swizzle;
195  uint32_t alignment;
196  uint32_t pitch;
197  uint32_t mipLevelOffset[13];
198 };
199 CHECK_OFFSET(GX2Surface, 0x0, dim);
200 CHECK_OFFSET(GX2Surface, 0x4, width);
201 CHECK_OFFSET(GX2Surface, 0x8, height);
202 CHECK_OFFSET(GX2Surface, 0xc, depth);
203 CHECK_OFFSET(GX2Surface, 0x10, mipLevels);
204 CHECK_OFFSET(GX2Surface, 0x14, format);
205 CHECK_OFFSET(GX2Surface, 0x18, aa);
206 CHECK_OFFSET(GX2Surface, 0x1c, use);
207 CHECK_OFFSET(GX2Surface, 0x1c, resourceFlags);
208 CHECK_OFFSET(GX2Surface, 0x20, imageSize);
209 CHECK_OFFSET(GX2Surface, 0x24, image);
210 CHECK_OFFSET(GX2Surface, 0x28, mipmapSize);
211 CHECK_OFFSET(GX2Surface, 0x2c, mipmaps);
212 CHECK_OFFSET(GX2Surface, 0x30, tileMode);
213 CHECK_OFFSET(GX2Surface, 0x34, swizzle);
214 CHECK_OFFSET(GX2Surface, 0x38, alignment);
215 CHECK_OFFSET(GX2Surface, 0x3C, pitch);
216 CHECK_OFFSET(GX2Surface, 0x40, mipLevelOffset);
217 CHECK_SIZE(GX2Surface, 0x74);
218 
220 {
222 
223  uint32_t viewMip;
224  uint32_t viewFirstSlice;
225  uint32_t viewNumSlices;
226  void *hiZPtr;
227  uint32_t hiZSize;
228  float depthClear;
229  uint32_t stencilClear;
230 
231  uint32_t regs[7];
232 };
233 CHECK_OFFSET(GX2DepthBuffer, 0x74, viewMip);
234 CHECK_OFFSET(GX2DepthBuffer, 0x78, viewFirstSlice);
235 CHECK_OFFSET(GX2DepthBuffer, 0x7C, viewNumSlices);
236 CHECK_OFFSET(GX2DepthBuffer, 0x80, hiZPtr);
237 CHECK_OFFSET(GX2DepthBuffer, 0x84, hiZSize);
238 CHECK_OFFSET(GX2DepthBuffer, 0x88, depthClear);
239 CHECK_OFFSET(GX2DepthBuffer, 0x8C, stencilClear);
240 CHECK_OFFSET(GX2DepthBuffer, 0x90, regs);
241 CHECK_SIZE(GX2DepthBuffer, 0xAC);
242 
244 {
246 
247  uint32_t viewMip;
248  uint32_t viewFirstSlice;
249  uint32_t viewNumSlices;
250  void *aaBuffer;
251  uint32_t aaSize;
252 
253  uint32_t regs[5];
254 };
255 CHECK_OFFSET(GX2ColorBuffer, 0x74, viewMip);
256 CHECK_OFFSET(GX2ColorBuffer, 0x78, viewFirstSlice);
257 CHECK_OFFSET(GX2ColorBuffer, 0x7C, viewNumSlices);
258 CHECK_OFFSET(GX2ColorBuffer, 0x80, aaBuffer);
259 CHECK_OFFSET(GX2ColorBuffer, 0x84, aaSize);
260 CHECK_OFFSET(GX2ColorBuffer, 0x88, regs);
261 CHECK_SIZE(GX2ColorBuffer, 0x9C);
262 
263 void
265 
266 void
268  uint32_t *outSize,
269  uint32_t *outAlignment);
270 
271 void
272 GX2SetColorBuffer(GX2ColorBuffer *colorBuffer,
273  GX2RenderTarget target);
274 
275 void
276 GX2SetDepthBuffer(GX2DepthBuffer *depthBuffer);
277 
278 void
280 
281 void
283 
284 void
286  BOOL enable);
287 
288 uint32_t
290 
291 void
293  uint32_t swizzle);
294 
295 void
297  uint32_t srcLevel,
298  uint32_t srcDepth,
299  GX2Surface *dst,
300  uint32_t dstLevel,
301  uint32_t dstDepth);
302 
303 #ifdef __cplusplus
304 }
305 #endif
306 
GX2RenderTarget
Definition: surface.h:164
uint32_t viewMip
Definition: surface.h:247
GX2SurfaceUse
Definition: surface.h:110
uint32_t pitch
Definition: surface.h:196
GX2TileMode tileMode
Definition: surface.h:193
GX2Surface surface
Definition: surface.h:245
GX2SurfaceDim
Definition: surface.h:18
uint32_t stencilClear
Definition: surface.h:229
void GX2SetDepthBuffer(GX2DepthBuffer *depthBuffer)
GX2Surface surface
Definition: surface.h:221
uint32_t aaSize
Definition: surface.h:251
uint32_t viewFirstSlice
Definition: surface.h:248
void GX2SetColorBuffer(GX2ColorBuffer *colorBuffer, GX2RenderTarget target)
uint32_t viewMip
Definition: surface.h:223
uint32_t viewNumSlices
Definition: surface.h:249
uint32_t alignment
Definition: surface.h:195
GX2SurfaceFormat format
Definition: surface.h:182
void GX2SetSurfaceSwizzle(GX2Surface *surface, uint32_t swizzle)
void * mipmaps
Definition: surface.h:192
GX2TileMode
Definition: surface.h:143
void GX2InitDepthBufferRegs(GX2DepthBuffer *depthBuffer)
void * aaBuffer
Definition: surface.h:250
uint32_t height
Definition: surface.h:179
uint32_t GX2GetSurfaceSwizzle(GX2Surface *surface)
uint32_t hiZSize
Definition: surface.h:227
void GX2InitColorBufferRegs(GX2ColorBuffer *colorBuffer)
void * image
Definition: surface.h:190
GX2AAMode
Definition: surface.h:105
uint32_t viewFirstSlice
Definition: surface.h:224
uint32_t mipmapSize
Definition: surface.h:191
uint32_t regs[5]
Definition: surface.h:253
uint32_t viewNumSlices
Definition: surface.h:225
uint32_t imageSize
Definition: surface.h:189
GX2RResourceFlags resourceFlags
Definition: surface.h:187
float depthClear
Definition: surface.h:228
int BOOL
Definition: wut_types.h:4
uint32_t swizzle
Definition: surface.h:194
void GX2InitDepthBufferHiZEnable(GX2DepthBuffer *depthBuffer, BOOL enable)
void GX2CalcSurfaceSizeAndAlignment(GX2Surface *surface)
void GX2CalcDepthBufferHiZInfo(GX2DepthBuffer *depthBuffer, uint32_t *outSize, uint32_t *outAlignment)
uint32_t mipLevels
Definition: surface.h:181
GX2SurfaceDim dim
Definition: surface.h:177
void GX2CopySurface(GX2Surface *src, uint32_t srcLevel, uint32_t srcDepth, GX2Surface *dst, uint32_t dstLevel, uint32_t dstDepth)
void * hiZPtr
Definition: surface.h:226
GX2AAMode aa
Definition: surface.h:183
uint32_t depth
Definition: surface.h:180
GX2SurfaceUse use
Definition: surface.h:186
GX2RResourceFlags
Definition: surface.h:118
uint32_t width
Definition: surface.h:178
uint32_t mipLevelOffset[13]
Definition: surface.h:197
uint32_t regs[7]
Definition: surface.h:231
GX2SurfaceFormat
Definition: surface.h:30