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;
28  union
29  {
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 CHECK_OFFSET(GX2Surface, 0x0, dim);
44 CHECK_OFFSET(GX2Surface, 0x4, width);
45 CHECK_OFFSET(GX2Surface, 0x8, height);
46 CHECK_OFFSET(GX2Surface, 0xc, depth);
47 CHECK_OFFSET(GX2Surface, 0x10, mipLevels);
48 CHECK_OFFSET(GX2Surface, 0x14, format);
49 CHECK_OFFSET(GX2Surface, 0x18, aa);
50 CHECK_OFFSET(GX2Surface, 0x1c, use);
51 CHECK_OFFSET(GX2Surface, 0x1c, resourceFlags);
52 CHECK_OFFSET(GX2Surface, 0x20, imageSize);
53 CHECK_OFFSET(GX2Surface, 0x24, image);
54 CHECK_OFFSET(GX2Surface, 0x28, mipmapSize);
55 CHECK_OFFSET(GX2Surface, 0x2c, mipmaps);
56 CHECK_OFFSET(GX2Surface, 0x30, tileMode);
57 CHECK_OFFSET(GX2Surface, 0x34, swizzle);
58 CHECK_OFFSET(GX2Surface, 0x38, alignment);
59 CHECK_OFFSET(GX2Surface, 0x3C, pitch);
60 CHECK_OFFSET(GX2Surface, 0x40, mipLevelOffset);
61 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 CHECK_OFFSET(GX2DepthBuffer, 0x74, viewMip);
78 CHECK_OFFSET(GX2DepthBuffer, 0x78, viewFirstSlice);
79 CHECK_OFFSET(GX2DepthBuffer, 0x7C, viewNumSlices);
80 CHECK_OFFSET(GX2DepthBuffer, 0x80, hiZPtr);
81 CHECK_OFFSET(GX2DepthBuffer, 0x84, hiZSize);
82 CHECK_OFFSET(GX2DepthBuffer, 0x88, depthClear);
83 CHECK_OFFSET(GX2DepthBuffer, 0x8C, stencilClear);
84 CHECK_OFFSET(GX2DepthBuffer, 0x90, regs);
85 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 CHECK_OFFSET(GX2ColorBuffer, 0x74, viewMip);
100 CHECK_OFFSET(GX2ColorBuffer, 0x78, viewFirstSlice);
101 CHECK_OFFSET(GX2ColorBuffer, 0x7C, viewNumSlices);
102 CHECK_OFFSET(GX2ColorBuffer, 0x80, aaBuffer);
103 CHECK_OFFSET(GX2ColorBuffer, 0x84, aaSize);
104 CHECK_OFFSET(GX2ColorBuffer, 0x88, regs);
105 CHECK_SIZE(GX2ColorBuffer, 0x9C);
106 
107 void
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:91
uint32_t pitch
Definition: surface.h:40
GX2TileMode tileMode
Definition: surface.h:37
GX2Surface surface
Definition: surface.h:89
uint32_t stencilClear
Definition: surface.h:73
void GX2SetDepthBuffer(GX2DepthBuffer *depthBuffer)
GX2Surface surface
Definition: surface.h:65
uint32_t aaSize
Definition: surface.h:95
uint32_t viewFirstSlice
Definition: surface.h:92
void GX2SetColorBuffer(GX2ColorBuffer *colorBuffer, GX2RenderTarget target)
uint32_t viewMip
Definition: surface.h:67
uint32_t viewNumSlices
Definition: surface.h:93
uint32_t alignment
Definition: surface.h:39
GX2SurfaceFormat format
Definition: surface.h:26
void GX2SetSurfaceSwizzle(GX2Surface *surface, uint32_t swizzle)
GX2RResourceFlags
Definition: enum.h:238
GX2TileMode
Definition: enum.h:464
void * mipmaps
Definition: surface.h:36
void GX2InitDepthBufferRegs(GX2DepthBuffer *depthBuffer)
void * aaBuffer
Definition: surface.h:94
uint32_t height
Definition: surface.h:23
GX2RenderTarget
Definition: enum.h:221
GX2SurfaceUse
Definition: enum.h:397
uint32_t GX2GetSurfaceSwizzle(GX2Surface *surface)
uint32_t hiZSize
Definition: surface.h:71
void GX2InitColorBufferRegs(GX2ColorBuffer *colorBuffer)
void * image
Definition: surface.h:34
uint32_t viewFirstSlice
Definition: surface.h:68
GX2SurfaceDim
Definition: enum.h:310
uint32_t mipmapSize
Definition: surface.h:35
uint32_t regs[5]
Definition: surface.h:97
uint32_t viewNumSlices
Definition: surface.h:69
uint32_t imageSize
Definition: surface.h:33
GX2RResourceFlags resourceFlags
Definition: surface.h:31
float depthClear
Definition: surface.h:72
int BOOL
Definition: wut_types.h:4
uint32_t swizzle
Definition: surface.h:38
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:70
GX2AAMode aa
Definition: surface.h:27
uint32_t depth
Definition: surface.h:24
GX2SurfaceUse use
Definition: surface.h:30
uint32_t width
Definition: surface.h:22
uint32_t mipLevelOffset[13]
Definition: surface.h:41
uint32_t regs[7]
Definition: surface.h:75
GX2SurfaceFormat
Definition: enum.h:322