wut  1.0.0-beta9
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 
GX2ColorBuffer::aaBuffer
void * aaBuffer
Definition: surface.h:94
GX2Surface::dim
GX2SurfaceDim dim
Definition: surface.h:22
GX2RResourceFlags
GX2RResourceFlags
Definition: resource.h:14
GX2DepthBuffer::regs
uint32_t regs[7]
Definition: surface.h:75
GX2InitDepthBufferRegs
void GX2InitDepthBufferRegs(GX2DepthBuffer *depthBuffer)
GX2ColorBuffer::aaSize
uint32_t aaSize
Definition: surface.h:95
GX2InitDepthBufferHiZEnable
void GX2InitDepthBufferHiZEnable(GX2DepthBuffer *depthBuffer, BOOL enable)
GX2Surface::depth
uint32_t depth
Definition: surface.h:25
GX2Surface::mipLevels
uint32_t mipLevels
Definition: surface.h:26
GX2DepthBuffer::viewNumSlices
uint32_t viewNumSlices
Definition: surface.h:69
GX2Surface::alignment
uint32_t alignment
Definition: surface.h:39
GX2Surface::mipmaps
void * mipmaps
Definition: surface.h:36
GX2CopySurface
void GX2CopySurface(GX2Surface *src, uint32_t srcLevel, uint32_t srcDepth, GX2Surface *dst, uint32_t dstLevel, uint32_t dstDepth)
GX2Surface::mipmapSize
uint32_t mipmapSize
Definition: surface.h:35
GX2DepthBuffer::surface
GX2Surface surface
Definition: surface.h:65
GX2Surface::swizzle
uint32_t swizzle
Definition: surface.h:38
wut.h
GX2TileMode
GX2TileMode
Definition: enum.h:478
GX2InitColorBufferRegs
void GX2InitColorBufferRegs(GX2ColorBuffer *colorBuffer)
GX2DepthBuffer::hiZPtr
void * hiZPtr
Definition: surface.h:70
GX2Surface::mipLevelOffset
uint32_t mipLevelOffset[13]
Definition: surface.h:41
GX2ColorBuffer
Definition: surface.h:87
GX2Surface::format
GX2SurfaceFormat format
Definition: surface.h:27
resource.h
GX2Surface
Definition: surface.h:20
GX2SetSurfaceSwizzle
void GX2SetSurfaceSwizzle(GX2Surface *surface, uint32_t swizzle)
GX2Surface::pitch
uint32_t pitch
Definition: surface.h:40
GX2GetSurfaceSwizzle
uint32_t GX2GetSurfaceSwizzle(GX2Surface *surface)
GX2DepthBuffer::depthClear
float depthClear
Definition: surface.h:72
GX2ResolveAAColorBuffer
void GX2ResolveAAColorBuffer(const GX2ColorBuffer *srcColorBuffer, GX2Surface *dstSurface, uint32_t dstMip, uint32_t dstSlice)
GX2CalcDepthBufferHiZInfo
void GX2CalcDepthBufferHiZInfo(GX2DepthBuffer *depthBuffer, uint32_t *outSize, uint32_t *outAlignment)
GX2RenderTarget
GX2RenderTarget
Definition: enum.h:258
GX2SetColorBuffer
void GX2SetColorBuffer(GX2ColorBuffer *colorBuffer, GX2RenderTarget target)
GX2SurfaceUse
GX2SurfaceUse
Definition: enum.h:409
GX2SurfaceDim
GX2SurfaceDim
Definition: enum.h:322
GX2DepthBuffer::viewMip
uint32_t viewMip
Definition: surface.h:67
GX2Surface::image
void * image
Definition: surface.h:34
GX2AAMode
GX2AAMode
Definition: enum.h:28
GX2DepthBuffer
Definition: surface.h:63
GX2DepthBuffer::stencilClear
uint32_t stencilClear
Definition: surface.h:73
GX2DepthBuffer::viewFirstSlice
uint32_t viewFirstSlice
Definition: surface.h:68
GX2CalcColorBufferAuxInfo
void GX2CalcColorBufferAuxInfo(GX2ColorBuffer *surface, uint32_t *outSize, uint32_t *outAlignment)
GX2Surface::imageSize
uint32_t imageSize
Definition: surface.h:33
GX2ColorBuffer::regs
uint32_t regs[5]
Definition: surface.h:97
BOOL
int32_t BOOL
Definition: wut_types.h:4
GX2SetDepthBuffer
void GX2SetDepthBuffer(GX2DepthBuffer *depthBuffer)
GX2Surface::width
uint32_t width
Definition: surface.h:23
GX2Surface::height
uint32_t height
Definition: surface.h:24
GX2Surface::tileMode
GX2TileMode tileMode
Definition: surface.h:37
GX2CalcSurfaceSizeAndAlignment
void GX2CalcSurfaceSizeAndAlignment(GX2Surface *surface)
GX2Surface::aa
GX2AAMode aa
Definition: surface.h:28
GX2SurfaceFormat
GX2SurfaceFormat
Definition: enum.h:334
enum.h
GX2DepthBuffer::hiZSize
uint32_t hiZSize
Definition: surface.h:71