wut  v1.7.0
Wii U Toolchain
surface.h
Go to the documentation of this file.
1 #pragma once
2 #include <gx2r/resource.h>
3 #include <wut.h>
4 #include "enum.h"
5 
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15 
16 typedef struct GX2Surface GX2Surface;
17 typedef struct GX2DepthBuffer GX2DepthBuffer;
18 typedef struct GX2ColorBuffer GX2ColorBuffer;
19 typedef struct GX2Rect GX2Rect;
20 typedef struct GX2Point GX2Point;
21 
22 struct GX2Surface
23 {
25  uint32_t width;
26  uint32_t height;
27  uint32_t depth;
28  uint32_t mipLevels;
31  union {
32  GX2SurfaceUse use;
33  GX2RResourceFlags resourceFlags;
34  };
35  uint32_t imageSize;
36  void *image;
37  uint32_t mipmapSize;
38  void *mipmaps;
40  uint32_t swizzle;
41  uint32_t alignment;
42  uint32_t pitch;
43  uint32_t mipLevelOffset[13];
44 };
45 WUT_CHECK_OFFSET(GX2Surface, 0x0, dim);
46 WUT_CHECK_OFFSET(GX2Surface, 0x4, width);
47 WUT_CHECK_OFFSET(GX2Surface, 0x8, height);
48 WUT_CHECK_OFFSET(GX2Surface, 0xc, depth);
49 WUT_CHECK_OFFSET(GX2Surface, 0x10, mipLevels);
50 WUT_CHECK_OFFSET(GX2Surface, 0x14, format);
51 WUT_CHECK_OFFSET(GX2Surface, 0x18, aa);
52 WUT_CHECK_OFFSET(GX2Surface, 0x1c, use);
53 WUT_CHECK_OFFSET(GX2Surface, 0x1c, resourceFlags);
54 WUT_CHECK_OFFSET(GX2Surface, 0x20, imageSize);
55 WUT_CHECK_OFFSET(GX2Surface, 0x24, image);
56 WUT_CHECK_OFFSET(GX2Surface, 0x28, mipmapSize);
57 WUT_CHECK_OFFSET(GX2Surface, 0x2c, mipmaps);
58 WUT_CHECK_OFFSET(GX2Surface, 0x30, tileMode);
59 WUT_CHECK_OFFSET(GX2Surface, 0x34, swizzle);
60 WUT_CHECK_OFFSET(GX2Surface, 0x38, alignment);
61 WUT_CHECK_OFFSET(GX2Surface, 0x3C, pitch);
62 WUT_CHECK_OFFSET(GX2Surface, 0x40, mipLevelOffset);
63 WUT_CHECK_SIZE(GX2Surface, 0x74);
64 
66 {
68 
69  uint32_t viewMip;
70  uint32_t viewFirstSlice;
71  uint32_t viewNumSlices;
72  void *hiZPtr;
73  uint32_t hiZSize;
74  float depthClear;
75  uint32_t stencilClear;
76 
77  uint32_t regs[7];
78 };
79 WUT_CHECK_OFFSET(GX2DepthBuffer, 0x74, viewMip);
80 WUT_CHECK_OFFSET(GX2DepthBuffer, 0x78, viewFirstSlice);
81 WUT_CHECK_OFFSET(GX2DepthBuffer, 0x7C, viewNumSlices);
82 WUT_CHECK_OFFSET(GX2DepthBuffer, 0x80, hiZPtr);
83 WUT_CHECK_OFFSET(GX2DepthBuffer, 0x84, hiZSize);
84 WUT_CHECK_OFFSET(GX2DepthBuffer, 0x88, depthClear);
85 WUT_CHECK_OFFSET(GX2DepthBuffer, 0x8C, stencilClear);
86 WUT_CHECK_OFFSET(GX2DepthBuffer, 0x90, regs);
87 WUT_CHECK_SIZE(GX2DepthBuffer, 0xAC);
88 
90 {
92 
93  uint32_t viewMip;
94  uint32_t viewFirstSlice;
95  uint32_t viewNumSlices;
96  void *aaBuffer;
97  uint32_t aaSize;
98 
99  uint32_t regs[5];
100 };
101 WUT_CHECK_OFFSET(GX2ColorBuffer, 0x74, viewMip);
102 WUT_CHECK_OFFSET(GX2ColorBuffer, 0x78, viewFirstSlice);
103 WUT_CHECK_OFFSET(GX2ColorBuffer, 0x7C, viewNumSlices);
104 WUT_CHECK_OFFSET(GX2ColorBuffer, 0x80, aaBuffer);
105 WUT_CHECK_OFFSET(GX2ColorBuffer, 0x84, aaSize);
106 WUT_CHECK_OFFSET(GX2ColorBuffer, 0x88, regs);
107 WUT_CHECK_SIZE(GX2ColorBuffer, 0x9C);
108 
109 struct GX2Rect
110 {
111  int32_t left;
112  int32_t top;
113  int32_t right;
114  int32_t bottom;
115 };
116 WUT_CHECK_OFFSET(GX2Rect, 0x0, left);
117 WUT_CHECK_OFFSET(GX2Rect, 0x4, top);
118 WUT_CHECK_OFFSET(GX2Rect, 0x8, right);
119 WUT_CHECK_OFFSET(GX2Rect, 0xc, bottom);
120 WUT_CHECK_SIZE(GX2Rect, 0x10);
121 
122 struct GX2Point
123 {
124  int32_t x;
125  int32_t y;
126 };
127 WUT_CHECK_OFFSET(GX2Point, 0x0, x);
128 WUT_CHECK_OFFSET(GX2Point, 0x4, y);
129 WUT_CHECK_SIZE(GX2Point, 0x8);
130 
131 void
133 
134 void
136  uint32_t *outSize,
137  uint32_t *outAlignment);
138 
139 void
141  uint32_t *outSize,
142  uint32_t *outAlignment);
143 
144 void
146  GX2RenderTarget target);
147 
148 void
149 GX2SetDepthBuffer(const GX2DepthBuffer *depthBuffer);
150 
151 void
153 
154 void
156 
157 void
159  BOOL enable);
160 
161 uint32_t
163 
164 void
166  uint32_t swizzle);
167 
168 void
170  uint32_t srcLevel,
171  uint32_t srcDepth,
172  GX2Surface *dst,
173  uint32_t dstLevel,
174  uint32_t dstDepth);
175 
176 void
178  uint32_t srcLevel,
179  uint32_t srcDepth,
180  GX2Surface *dst,
181  uint32_t dstLevel,
182  uint32_t dstDepth,
183  uint32_t numRects,
184  GX2Rect *srcRects,
185  GX2Point *dstPoints);
186 
187 void
189  GX2Surface * dstSurface,
190  uint32_t dstMip,
191  uint32_t dstSlice);
192 
193 #ifdef __cplusplus
194 }
195 #endif
196 
GX2AAMode
Definition: enum.h:30
GX2RenderTarget
Definition: enum.h:314
GX2SurfaceFormat
Definition: enum.h:427
GX2SurfaceDim
Definition: enum.h:415
GX2TileMode
Definition: enum.h:582
GX2SurfaceUse
Definition: enum.h:502
uint32_t pitch
Definition: surface.h:42
GX2TileMode tileMode
Definition: surface.h:39
uint32_t viewFirstSlice
Definition: surface.h:70
void * mipmaps
Definition: surface.h:38
uint32_t width
Definition: surface.h:25
void * hiZPtr
Definition: surface.h:72
float depthClear
Definition: surface.h:74
uint32_t viewNumSlices
Definition: surface.h:71
int32_t right
Definition: surface.h:113
void * image
Definition: surface.h:36
int32_t bottom
Definition: surface.h:114
uint32_t swizzle
Definition: surface.h:40
uint32_t mipLevels
Definition: surface.h:28
GX2Surface surface
Definition: surface.h:67
uint32_t mipmapSize
Definition: surface.h:37
uint32_t height
Definition: surface.h:26
uint32_t hiZSize
Definition: surface.h:73
GX2AAMode aa
Definition: surface.h:30
GX2SurfaceFormat format
Definition: surface.h:29
uint32_t mipLevelOffset[13]
Definition: surface.h:43
int32_t left
Definition: surface.h:111
GX2SurfaceDim dim
Definition: surface.h:24
uint32_t imageSize
Definition: surface.h:35
uint32_t stencilClear
Definition: surface.h:75
uint32_t regs[5]
Definition: surface.h:99
int32_t top
Definition: surface.h:112
uint32_t viewMip
Definition: surface.h:69
uint32_t regs[7]
Definition: surface.h:77
uint32_t alignment
Definition: surface.h:41
void * aaBuffer
Definition: surface.h:96
uint32_t depth
Definition: surface.h:27
int32_t y
Definition: surface.h:125
int32_t x
Definition: surface.h:124
uint32_t aaSize
Definition: surface.h:97
void GX2InitColorBufferRegs(GX2ColorBuffer *colorBuffer)
void GX2CalcColorBufferAuxInfo(GX2ColorBuffer *surface, uint32_t *outSize, uint32_t *outAlignment)
void GX2ResolveAAColorBuffer(const GX2ColorBuffer *srcColorBuffer, GX2Surface *dstSurface, uint32_t dstMip, uint32_t dstSlice)
void GX2SetColorBuffer(const GX2ColorBuffer *colorBuffer, GX2RenderTarget target)
void GX2InitDepthBufferRegs(GX2DepthBuffer *depthBuffer)
void GX2CopySurfaceEx(const GX2Surface *src, uint32_t srcLevel, uint32_t srcDepth, GX2Surface *dst, uint32_t dstLevel, uint32_t dstDepth, uint32_t numRects, GX2Rect *srcRects, GX2Point *dstPoints)
uint32_t GX2GetSurfaceSwizzle(const GX2Surface *surface)
void GX2CalcDepthBufferHiZInfo(GX2DepthBuffer *depthBuffer, uint32_t *outSize, uint32_t *outAlignment)
void GX2SetDepthBuffer(const GX2DepthBuffer *depthBuffer)
void GX2SetSurfaceSwizzle(GX2Surface *surface, uint32_t swizzle)
void GX2InitDepthBufferHiZEnable(GX2DepthBuffer *depthBuffer, BOOL enable)
void GX2CalcSurfaceSizeAndAlignment(GX2Surface *surface)
void GX2CopySurface(const GX2Surface *src, uint32_t srcLevel, uint32_t srcDepth, GX2Surface *dst, uint32_t dstLevel, uint32_t dstDepth)
GX2RResourceFlags
Definition: resource.h:15
int32_t BOOL
Definition: wut_types.h:7