Polyphase Game Engine
Loading...
Searching...
No Matches
GraphicsTypes.h
Go to the documentation of this file.
1#pragma once
2
3#include <stdint.h>
4#include <limits.h>
6#include "Vertex.h"
7
8#if API_VULKAN
13#elif API_GX
14#include <gccore.h>
15#elif API_C3D
16#include <3ds.h>
17#include <citro3d.h>
19#endif
20
21#if API_VULKAN
22extern class VulkanContext* gVulkanContext;
23class Pipeline;
24class Shader;
25#elif API_GX
26extern struct GxContext gGxContext;
27#elif API_C3D
28extern struct C3dContext gC3dContext;
29#endif
30
32{
33#if API_VULKAN
34 class VulkanContext* mVulkanContext = gVulkanContext;
35#elif API_GX
36 struct GxContext* mGxContext = &gGxContext;
37#elif API_C3D
38 struct C3dContext* mC3dContext = &gC3dContext;
39#endif
40
41 float mResolutionScale = 1.0f;
42};
43
44enum class PixelFormat
45{
46 LA4,
47 RGB565,
48 RGBA8,
49 CMPR,
51
52 R8,
53 R32U,
54 R32F,
55 RGBA16F,
56
59 Depth16,
61
62 Count
63};
64
66{
67 Shadow,
68 Forward,
69 Opaque,
76 Quad,
77 Text,
78 Poly,
83 Line,
84
85 Count
86};
87
88enum class RenderPassId
89{
90 Shadows,
91 Forward,
93 Ui,
94 Clear,
95
97
98 Count
99};
100
101enum class FilterType
102{
103 Nearest,
104 Linear,
105
106 Count
107};
108
109enum class WrapMode
110{
111 Clamp,
112 Repeat,
113 Mirror,
114
115 Count
116};
117
118#if API_VULKAN
119typedef uint32_t IndexType;
120#else
121typedef uint16_t IndexType;
122#endif
123
125{
126#if API_VULKAN
127 Image* mImage = nullptr;
128#elif API_GX
129 GXTexObj mGxTexObj = {};
130 TPLFile mTplFile = {};
131 void* mTplData = nullptr;
132 // Streaming RGBA8 path (video player). The GX hardware reads textures in
133 // 4x4-tile GX_TF_RGBA8 layout with separate AR/GB planes; CPU swizzles
134 // here every UpdatePixels. Padded to multiple of 4 in each dimension.
135 void* mTiledBuf = nullptr;
136 uint32_t mTiledBufSize = 0;
137 uint32_t mTexWidth = 0;
138 uint32_t mTexHeight = 0;
139#elif API_C3D
140 C3D_Tex mTex = {};
141 void* mT3dsData = nullptr;
142 // Streaming-texture path (raw RGBA8 input, e.g. video player). Allocated in
143 // linear memory so GX_DisplayTransfer can DMA it through the GPU's tiler
144 // into mTex on each UpdatePixels call. nullptr for normal cooked .t3x
145 // textures (which are pre-tiled at cook time).
146 void* mLinearBuf = nullptr;
147 uint32_t mLinearBufSize = 0;
148 uint32_t mTexWidth = 0; // physical (padded to 8-multiple) tex dims
149 uint32_t mTexHeight = 0;
150#endif
151};
152
154{
155#if API_VULKAN
156 Shader* mVertexShaders[(uint32_t)VertexType::Max] = {};
157 Shader* mFragmentShader = nullptr;
158#endif
159};
160
162{
163#if API_VULKAN
164 Buffer* mVertexBuffer = nullptr;
165 Buffer* mIndexBuffer = nullptr;
166#elif API_GX
167 void* mDisplayList = nullptr;
168 uint32_t mDisplayListSize = 0;
169 void* mColorDisplayList = nullptr;
170 uint32_t mColorDisplayListSize = 0;
171#elif API_C3D
172 void* mVertexData = nullptr;
173 void* mIndexData = nullptr;
174#endif
175};
176
178{
179#if API_VULKAN
180 Buffer* mVertexBuffer = nullptr;
181 Buffer* mIndexBuffer = nullptr;
182#elif API_C3D
183 void* mVertexData = nullptr;
184 void* mIndexData = nullptr;
185#endif
186};
187
189{
190#if API_VULKAN
191 Buffer* mColorVertexBuffer = nullptr;
192#elif API_C3D
193 void* mColorVertexData = nullptr;
194#endif
195};
196
198{
199#if API_VULKAN
200 Buffer* mInstanceDataBuffer = nullptr;
201 Buffer* mVertexColorBuffer = nullptr;
202#endif
203
204 bool mDirty = true;
205};
206
208{
209#if API_VULKAN
210 MultiBuffer* mVertexBuffer = nullptr;
211#elif API_C3D
212 DoubleBuffer mVertexData;
213#endif
214};
215
217{
218#if API_VULKAN
219 Buffer* mVertexBuffer = nullptr;
220#elif API_C3D
221 DoubleBuffer mVertexData;
222#endif
223};
224
226{
227#if API_VULKAN
228 Buffer* mVertexBuffer = nullptr;
229 Buffer* mIndexBuffer = nullptr;
230#elif API_GX
231 void* mVertexData = nullptr;
232 uint32_t mVertexDataSize = 0;
233 void* mDisplayList = nullptr;
234 uint32_t mDisplayListSize = 0;
235#elif API_C3D
236 DoubleBuffer mVertexData;
237 DoubleBuffer mIndexData;
238#endif
239};
240
242{
243#if API_VULKAN
244 Buffer* mVertexBuffer = nullptr;
245 Buffer* mIndexBuffer = nullptr;
246#elif API_GX
247 void* mVertexData = nullptr;
248 uint32_t mVertexDataSize = 0;
249 void* mDisplayList = nullptr;
250 uint32_t mDisplayListSize = 0;
251#elif API_C3D
252 DoubleBuffer mVertexData;
253 DoubleBuffer mIndexData;
254#endif
255};
256
258{
259#if API_VULKAN
260 Buffer* mVertexBuffer = nullptr;
261 Buffer* mIndexBuffer = nullptr;
262#elif API_GX
263 void* mVertexData = nullptr;
264 uint32_t mVertexDataSize = 0;
265 void* mDisplayList = nullptr;
266 uint32_t mDisplayListSize = 0;
267#elif API_C3D
268 DoubleBuffer mVertexData;
269 DoubleBuffer mIndexData;
270#endif
271};
272
274{
275#if API_VULKAN
276 MultiBuffer* mVertexBuffer = nullptr;
277#elif API_C3D
278 DoubleBuffer mVertexData;
279#endif
280};
281
283{
284#if API_VULKAN
285 MultiBuffer* mVertexBuffer = nullptr;
286 uint32_t mNumVerts = 0;
287#elif API_C3D
288 DoubleBuffer mVertexData;
289#endif
290};
291
293{
294#if API_VULKAN
295 MultiBuffer* mVertexBuffer = nullptr;
296 uint32_t mNumBufferCharsAllocated = 0;
297#elif API_C3D
298 DoubleBuffer mVertexData;
299 uint32_t mNumBufferCharsAllocated = 0;
300#endif
301};
302
304{
305#if API_VULKAN
306 MultiBuffer* mVertexBuffer = nullptr;
307 MultiBuffer* mIndexBuffer = nullptr;
308 uint32_t mNumVerticesAllocated = 0;
309#elif API_C3D
310 DoubleBuffer mVertexData;
311 DoubleBuffer mIndexData;
312 uint32_t mNumVerticesAllocated = 0;
313#endif
314};
uint16_t IndexType
Definition GraphicsTypes.h:121
PixelFormat
Definition GraphicsTypes.h:45
RenderPassId
Definition GraphicsTypes.h:89
PipelineConfig
Definition GraphicsTypes.h:66
FilterType
Definition GraphicsTypes.h:102
WrapMode
Definition GraphicsTypes.h:110
Definition Shader.h:18
Definition GraphicsTypes.h:32
float mResolutionScale
Definition GraphicsTypes.h:41
Definition GraphicsTypes.h:198
bool mDirty
Definition GraphicsTypes.h:204
Definition GraphicsTypes.h:154
Definition GraphicsTypes.h:304
Definition GraphicsTypes.h:283
Definition GraphicsTypes.h:274
Definition GraphicsTypes.h:208
Definition GraphicsTypes.h:178
Definition GraphicsTypes.h:189
Definition GraphicsTypes.h:162
Definition GraphicsTypes.h:242
Definition GraphicsTypes.h:217
Definition GraphicsTypes.h:293
Definition GraphicsTypes.h:125
Definition GraphicsTypes.h:258
Definition GraphicsTypes.h:226