wut  1.0.0-alpha
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;
19 
20 struct GX2Surface
21 {
23  uint32_t width;
24  uint32_t height;
25  uint32_t depth;
26  uint32_t mipLevels;
29  union {
30  GX2SurfaceUse use;
31  GX2RResourceFlags resourceFlags;
32  };
33  uint32_t imageSize;
34  void *image;
35  uint32_t mipmapSize;
36  void *mipmaps;
38  uint32_t swizzle;
39  uint32_t alignment;
40  uint32_t pitch;
41  uint32_t mipLevelOffset[13];
42 };
43 WUT_CHECK_OFFSET(GX2Surface, 0x0, dim);
44 WUT_CHECK_OFFSET(GX2Surface, 0x4, width);
45 WUT_CHECK_OFFSET(GX2Surface, 0x8, height);
46 WUT_CHECK_OFFSET(GX2Surface, 0xc, depth);
47 WUT_CHECK_OFFSET(GX2Surface, 0x10, mipLevels);
48 WUT_CHECK_OFFSET(GX2Surface, 0x14, format);
49 WUT_CHECK_OFFSET(GX2Surface, 0x18, aa);
50 WUT_CHECK_OFFSET(GX2Surface, 0x1c, use);
51 WUT_CHECK_OFFSET(GX2Surface, 0x1c, resourceFlags);
52 WUT_CHECK_OFFSET(GX2Surface, 0x20, imageSize);
53 WUT_CHECK_OFFSET(GX2Surface, 0x24, image);
54 WUT_CHECK_OFFSET(GX2Surface, 0x28, mipmapSize);
55 WUT_CHECK_OFFSET(GX2Surface, 0x2c, mipmaps);
56 WUT_CHECK_OFFSET(GX2Surface, 0x30, tileMode);
57 WUT_CHECK_OFFSET(GX2Surface, 0x34, swizzle);
58 WUT_CHECK_OFFSET(GX2Surface, 0x38, alignment);
59 WUT_CHECK_OFFSET(GX2Surface, 0x3C, pitch);
60 WUT_CHECK_OFFSET(GX2Surface, 0x40, mipLevelOffset);
61 WUT_CHECK_SIZE(GX2Surface, 0x74);
62 
64 {
66 
67  uint32_t viewMip;
68  uint32_t viewFirstSlice;
69  uint32_t viewNumSlices;
70  void *hiZPtr;
71  uint32_t hiZSize;
72  float depthClear;
73  uint32_t stencilClear;
74 
75  uint32_t regs[7];
76 };
77 WUT_CHECK_OFFSET(GX2DepthBuffer, 0x74, viewMip);
78 WUT_CHECK_OFFSET(GX2DepthBuffer, 0x78, viewFirstSlice);
79 WUT_CHECK_OFFSET(GX2DepthBuffer, 0x7C, viewNumSlices);
80 WUT_CHECK_OFFSET(GX2DepthBuffer, 0x80, hiZPtr);
81 WUT_CHECK_OFFSET(GX2DepthBuffer, 0x84, hiZSize);
82 WUT_CHECK_OFFSET(GX2DepthBuffer, 0x88, depthClear);
83 WUT_CHECK_OFFSET(GX2DepthBuffer, 0x8C, stencilClear);
84 WUT_CHECK_OFFSET(GX2DepthBuffer, 0x90, regs);
85 WUT_CHECK_SIZE(GX2DepthBuffer, 0xAC);
86 
88 {
90 
91  uint32_t viewMip;
92  uint32_t viewFirstSlice;
93  uint32_t viewNumSlices;
94  void *aaBuffer;
95  uint32_t aaSize;
96 
97  uint32_t regs[5];
98 };
99 WUT_CHECK_OFFSET(GX2ColorBuffer, 0x74, viewMip);
100 WUT_CHECK_OFFSET(GX2ColorBuffer, 0x78, viewFirstSlice);
101 WUT_CHECK_OFFSET(GX2ColorBuffer, 0x7C, viewNumSlices);
102 WUT_CHECK_OFFSET(GX2ColorBuffer, 0x80, aaBuffer);
103 WUT_CHECK_OFFSET(GX2ColorBuffer, 0x84, aaSize);
104 WUT_CHECK_OFFSET(GX2ColorBuffer, 0x88, regs);
105 WUT_CHECK_SIZE(GX2ColorBuffer, 0x9C);
106 
107 void
109 
110 void
112  uint32_t *outSize,
113  uint32_t *outAlignment);
114 
115 void
117  uint32_t *outSize,
118  uint32_t *outAlignment);
119 
120 void
121 GX2SetColorBuffer(GX2ColorBuffer *colorBuffer,
122  GX2RenderTarget target);
123 
124 void
125 GX2SetDepthBuffer(GX2DepthBuffer *depthBuffer);
126 
127 void
129 
130 void
132 
133 void
135  BOOL enable);
136 
137 uint32_t
139 
140 void
142  uint32_t swizzle);
143 
144 void
146  uint32_t srcLevel,
147  uint32_t srcDepth,
148  GX2Surface *dst,
149  uint32_t dstLevel,
150  uint32_t dstDepth);
151 
152 void
153 GX2ResolveAAColorBuffer(const GX2ColorBuffer * srcColorBuffer,
154  GX2Surface * dstSurface,
155  uint32_t dstMip,
156  uint32_t dstSlice);
157 
158 #ifdef __cplusplus
159 }
160 #endif
161 
GX2AAMode aa
Definition: surface.h:28
uint32_t mipmapSize
Definition: surface.h:35
void * mipmaps
Definition: surface.h:36
uint32_t hiZSize
Definition: surface.h:71
uint32_t alignment
Definition: surface.h:39
uint32_t regs[7]
Definition: surface.h:75
GX2TileMode tileMode
Definition: surface.h:37
uint32_t swizzle
Definition: surface.h:38
void GX2SetDepthBuffer(GX2DepthBuffer *depthBuffer)
uint32_t height
Definition: surface.h:24
void GX2SetColorBuffer(GX2ColorBuffer *colorBuffer, GX2RenderTarget target)
void GX2SetSurfaceSwizzle(GX2Surface *surface, uint32_t swizzle)
void GX2ResolveAAColorBuffer(const GX2ColorBuffer *srcColorBuffer, GX2Surface *dstSurface, uint32_t dstMip, uint32_t dstSlice)
uint32_t stencilClear
Definition: surface.h:73
void * aaBuffer
Definition: surface.h:94
GX2TileMode
Definition: enum.h:477
uint32_t viewFirstSlice
Definition: surface.h:68
uint32_t imageSize
Definition: surface.h:33
void GX2InitDepthBufferRegs(GX2DepthBuffer *depthBuffer)
uint32_t pitch
Definition: surface.h:40
GX2RenderTarget
Definition: enum.h:257
uint32_t width
Definition: surface.h:23
uint32_t regs[5]
Definition: surface.h:97
GX2SurfaceUse
Definition: enum.h:408
uint32_t GX2GetSurfaceSwizzle(GX2Surface *surface)
void GX2InitColorBufferRegs(GX2ColorBuffer *colorBuffer)
GX2Surface surface
Definition: surface.h:65
uint32_t viewMip
Definition: surface.h:67
GX2SurfaceDim
Definition: enum.h:321
uint32_t viewNumSlices
Definition: surface.h:69
uint32_t mipLevelOffset[13]
Definition: surface.h:41
void GX2InitDepthBufferHiZEnable(GX2DepthBuffer *depthBuffer, BOOL enable)
void GX2CalcSurfaceSizeAndAlignment(GX2Surface *surface)
uint32_t depth
Definition: surface.h:25
void GX2CalcDepthBufferHiZInfo(GX2DepthBuffer *depthBuffer, uint32_t *outSize, uint32_t *outAlignment)
int32_t BOOL
Definition: wut_types.h:4
void GX2CopySurface(GX2Surface *src, uint32_t srcLevel, uint32_t srcDepth, GX2Surface *dst, uint32_t dstLevel, uint32_t dstDepth)
GX2AAMode
Definition: enum.h:28
GX2SurfaceFormat format
Definition: surface.h:27
uint32_t mipLevels
Definition: surface.h:26
void GX2CalcColorBufferAuxInfo(GX2ColorBuffer *surface, uint32_t *outSize, uint32_t *outAlignment)
GX2SurfaceDim dim
Definition: surface.h:22
void * image
Definition: surface.h:34
void * hiZPtr
Definition: surface.h:70
float depthClear
Definition: surface.h:72
uint32_t aaSize
Definition: surface.h:95
GX2SurfaceFormat
Definition: enum.h:333
GX2RResourceFlags
Definition: resource.h:14