WUT  0.1
Wii U Toolchain
surface.h
Go to the documentation of this file.
1 #pragma once
2 #include <wut.h>
3 #include "enum.h"
4 
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
14 
15 typedef struct GX2Surface GX2Surface;
18 
19 struct GX2Surface
20 {
22  uint32_t width;
23  uint32_t height;
24  uint32_t depth;
25  uint32_t mipLevels;
29  uint32_t imageSize;
30  void *image;
31  uint32_t mipmapSize;
32  void *mipmaps;
34  uint32_t swizzle;
35  uint32_t alignment;
36  uint32_t pitch;
37  uint32_t mipLevelOffset[13];
38 };
39 CHECK_OFFSET(GX2Surface, 0x0, dim);
40 CHECK_OFFSET(GX2Surface, 0x4, width);
41 CHECK_OFFSET(GX2Surface, 0x8, height);
42 CHECK_OFFSET(GX2Surface, 0xc, depth);
43 CHECK_OFFSET(GX2Surface, 0x10, mipLevels);
44 CHECK_OFFSET(GX2Surface, 0x14, format);
45 CHECK_OFFSET(GX2Surface, 0x18, aa);
46 CHECK_OFFSET(GX2Surface, 0x1c, use);
47 CHECK_OFFSET(GX2Surface, 0x20, imageSize);
48 CHECK_OFFSET(GX2Surface, 0x24, image);
49 CHECK_OFFSET(GX2Surface, 0x28, mipmapSize);
50 CHECK_OFFSET(GX2Surface, 0x2c, mipmaps);
51 CHECK_OFFSET(GX2Surface, 0x30, tileMode);
52 CHECK_OFFSET(GX2Surface, 0x34, swizzle);
53 CHECK_OFFSET(GX2Surface, 0x38, alignment);
54 CHECK_OFFSET(GX2Surface, 0x3C, pitch);
55 CHECK_OFFSET(GX2Surface, 0x40, mipLevelOffset);
56 CHECK_SIZE(GX2Surface, 0x74);
57 
59 {
61 
62  uint32_t viewMip;
63  uint32_t viewFirstSlice;
64  uint32_t viewNumSlices;
65  void *hiZPtr;
66  uint32_t hiZSize;
67  float depthClear;
68  uint32_t stencilClear;
69 
70  uint32_t regs[7];
71 };
72 CHECK_OFFSET(GX2DepthBuffer, 0x74, viewMip);
73 CHECK_OFFSET(GX2DepthBuffer, 0x78, viewFirstSlice);
74 CHECK_OFFSET(GX2DepthBuffer, 0x7C, viewNumSlices);
75 CHECK_OFFSET(GX2DepthBuffer, 0x80, hiZPtr);
76 CHECK_OFFSET(GX2DepthBuffer, 0x84, hiZSize);
77 CHECK_OFFSET(GX2DepthBuffer, 0x88, depthClear);
78 CHECK_OFFSET(GX2DepthBuffer, 0x8C, stencilClear);
79 CHECK_OFFSET(GX2DepthBuffer, 0x90, regs);
80 CHECK_SIZE(GX2DepthBuffer, 0xAC);
81 
83 {
85 
86  uint32_t viewMip;
87  uint32_t viewFirstSlice;
88  uint32_t viewNumSlices;
89  void *aaBuffer;
90  uint32_t aaSize;
91 
92  uint32_t regs[5];
93 };
94 CHECK_OFFSET(GX2ColorBuffer, 0x74, viewMip);
95 CHECK_OFFSET(GX2ColorBuffer, 0x78, viewFirstSlice);
96 CHECK_OFFSET(GX2ColorBuffer, 0x7C, viewNumSlices);
97 CHECK_OFFSET(GX2ColorBuffer, 0x80, aaBuffer);
98 CHECK_OFFSET(GX2ColorBuffer, 0x84, aaSize);
99 CHECK_OFFSET(GX2ColorBuffer, 0x88, regs);
100 CHECK_SIZE(GX2ColorBuffer, 0x9C);
101 
102 void
104 
105 void
107  uint32_t *outSize,
108  uint32_t *outAlignment);
109 
110 void
112  uint32_t *outSize,
113  uint32_t *outAlignment);
114 
115 void
116 GX2SetColorBuffer(GX2ColorBuffer *colorBuffer,
117  GX2RenderTarget target);
118 
119 void
120 GX2SetDepthBuffer(GX2DepthBuffer *depthBuffer);
121 
122 void
124 
125 void
127 
128 void
130  BOOL enable);
131 
132 uint32_t
134 
135 void
137  uint32_t swizzle);
138 
139 void
141  uint32_t srcLevel,
142  uint32_t srcDepth,
143  GX2Surface *dst,
144  uint32_t dstLevel,
145  uint32_t dstDepth);
146 
147 #ifdef __cplusplus
148 }
149 #endif
150 
uint32_t viewMip
Definition: surface.h:86
uint32_t pitch
Definition: surface.h:36
GX2TileMode tileMode
Definition: surface.h:33
GX2Surface surface
Definition: surface.h:84
uint32_t stencilClear
Definition: surface.h:68
void GX2SetDepthBuffer(GX2DepthBuffer *depthBuffer)
GX2Surface surface
Definition: surface.h:60
uint32_t aaSize
Definition: surface.h:90
uint32_t viewFirstSlice
Definition: surface.h:87
void GX2SetColorBuffer(GX2ColorBuffer *colorBuffer, GX2RenderTarget target)
uint32_t viewMip
Definition: surface.h:62
uint32_t viewNumSlices
Definition: surface.h:88
uint32_t alignment
Definition: surface.h:35
GX2SurfaceFormat format
Definition: surface.h:26
void GX2SetSurfaceSwizzle(GX2Surface *surface, uint32_t swizzle)
GX2TileMode
Definition: enum.h:452
void * mipmaps
Definition: surface.h:32
void GX2InitDepthBufferRegs(GX2DepthBuffer *depthBuffer)
void * aaBuffer
Definition: surface.h:89
uint32_t height
Definition: surface.h:23
GX2RenderTarget
Definition: enum.h:234
GX2SurfaceUse
Definition: enum.h:385
uint32_t GX2GetSurfaceSwizzle(GX2Surface *surface)
uint32_t hiZSize
Definition: surface.h:66
void GX2InitColorBufferRegs(GX2ColorBuffer *colorBuffer)
void * image
Definition: surface.h:30
uint32_t viewFirstSlice
Definition: surface.h:63
GX2SurfaceDim
Definition: enum.h:298
uint32_t mipmapSize
Definition: surface.h:31
uint32_t regs[5]
Definition: surface.h:92
uint32_t viewNumSlices
Definition: surface.h:64
uint32_t imageSize
Definition: surface.h:29
float depthClear
Definition: surface.h:67
int BOOL
Definition: wut_types.h:5
uint32_t swizzle
Definition: surface.h:34
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:25
GX2SurfaceDim dim
Definition: surface.h:21
void GX2CopySurface(GX2Surface *src, uint32_t srcLevel, uint32_t srcDepth, GX2Surface *dst, uint32_t dstLevel, uint32_t dstDepth)
GX2AAMode
Definition: enum.h:14
void * hiZPtr
Definition: surface.h:65
GX2AAMode aa
Definition: surface.h:27
void GX2CalcColorBufferAuxInfo(GX2ColorBuffer *surface, uint32_t *outSize, uint32_t *outAlignment)
uint32_t depth
Definition: surface.h:24
GX2SurfaceUse use
Definition: surface.h:28
uint32_t width
Definition: surface.h:22
uint32_t mipLevelOffset[13]
Definition: surface.h:37
uint32_t regs[7]
Definition: surface.h:70
GX2SurfaceFormat
Definition: enum.h:310