Cogs.Core
FormatsWebGPU.cpp
1#include "FormatsWebGPU.h"
2
3#include "../TextureData.h"
4
5const WGPUTextureFormat Cogs::TextureFormatsWebGPU[] = {
6 WGPUTextureFormat_Undefined,
7
8 // Unsigned normalized byte formats
9
10 WGPUTextureFormat_R8Unorm,
11 WGPUTextureFormat_RG8Unorm,
12 WGPUTextureFormat_Undefined, // Undefined
13 WGPUTextureFormat_RGBA8Unorm,
14
15 // Unsigned 16 bit normalized integer formats
16
17 WGPUTextureFormat_Undefined, // Undefined
18 WGPUTextureFormat_Undefined, // Undefined
19 WGPUTextureFormat_Undefined, // Undefined
20 WGPUTextureFormat_Undefined, // Undefined
21
22 // Signed normalized byte formats
23
24 WGPUTextureFormat_R8Snorm,
25 WGPUTextureFormat_RG8Snorm,
26 WGPUTextureFormat_Undefined, // Undefined
27 WGPUTextureFormat_RGBA8Snorm,
28
29 // Signed 16 bit normalized integer formats
30
31 WGPUTextureFormat_Undefined, // Undefined
32 WGPUTextureFormat_Undefined, // Undefined
33 WGPUTextureFormat_Undefined, // Undefined
34 WGPUTextureFormat_Undefined, // Undefined
35
36 // Unsigned byte formats
37
38 WGPUTextureFormat_R8Uint,
39 WGPUTextureFormat_RG8Uint,
40 WGPUTextureFormat_Undefined, // Undefined
41 WGPUTextureFormat_RGBA8Uint,
42
43 // Unsigned 16 bit integer formats
44
45 WGPUTextureFormat_R16Uint,
46 WGPUTextureFormat_RG16Uint,
47 WGPUTextureFormat_Undefined, // Undefined
48 WGPUTextureFormat_RGBA16Uint,
49
50 // Unsigned 32 bit integer formats
51
52 WGPUTextureFormat_R32Uint,
53 WGPUTextureFormat_RG32Uint,
54 WGPUTextureFormat_Undefined, // Undefined
55 WGPUTextureFormat_RGBA32Uint,
56
57 // Signed byte formats
58
59 WGPUTextureFormat_R8Sint,
60 WGPUTextureFormat_RG8Sint,
61 WGPUTextureFormat_Undefined, // Undefined
62 WGPUTextureFormat_RGBA8Sint,
63
64 // Signed 16 bit integer formats
65
66 WGPUTextureFormat_R16Sint,
67 WGPUTextureFormat_RG16Sint,
68 WGPUTextureFormat_Undefined, // Undefined
69 WGPUTextureFormat_RGBA16Sint,
70
71 // Signed 32 bit integer formats
72
73 WGPUTextureFormat_R32Sint,
74 WGPUTextureFormat_RG32Sint,
75 WGPUTextureFormat_Undefined, // Undefined
76 WGPUTextureFormat_RGBA32Sint,
77
78 // 16 bit floating point formats
79
80 WGPUTextureFormat_R16Float,
81 WGPUTextureFormat_RG16Float,
82 WGPUTextureFormat_Undefined, // Undefined
83 WGPUTextureFormat_RGBA16Float,
84
85 // 32 bit floating point formats
86
87 WGPUTextureFormat_R32Float,
88 WGPUTextureFormat_RG32Float,
89 WGPUTextureFormat_Undefined, // Undefined
90 WGPUTextureFormat_RGBA32Float,
91
92 // Depth buffer formats
93
94 WGPUTextureFormat_Depth16Unorm,
95 WGPUTextureFormat_Depth24Plus,
96 WGPUTextureFormat_Depth24PlusStencil8,
97 WGPUTextureFormat_Depth32Float,
98 WGPUTextureFormat_Depth32Float, // R32_TYPELESS = WGPUTextureFormat_Depth32Float
99 WGPUTextureFormat_Depth16Unorm, // R16_TYPELESS WGPUTextureFormat_Depth16Unorm
100
101 // 8 bit typeless formats
102
103 WGPUTextureFormat_Undefined, // Undefined
104 WGPUTextureFormat_Undefined, // Undefined
105 WGPUTextureFormat_Undefined, // Undefined
106 WGPUTextureFormat_Undefined, // Undefined
107
108 // Reverse component order formats.
109
110 WGPUTextureFormat_Undefined, // Undefined
111 WGPUTextureFormat_BGRA8Unorm,
112
113 // Alpha formats
114
115 WGPUTextureFormat_Undefined, // Undefined
116
117 // Compressed formats
118
119 WGPUTextureFormat_Undefined, // Undefined
120 WGPUTextureFormat_BC1RGBAUnorm,
121 WGPUTextureFormat_BC1RGBAUnormSrgb,
122 WGPUTextureFormat_Undefined, // Undefined
123 WGPUTextureFormat_BC2RGBAUnorm,
124 WGPUTextureFormat_BC2RGBAUnormSrgb,
125 WGPUTextureFormat_Undefined, // Undefined
126 WGPUTextureFormat_BC3RGBAUnorm,
127 WGPUTextureFormat_BC3RGBAUnormSrgb,
128 WGPUTextureFormat_Undefined, // Undefined
129 WGPUTextureFormat_BC4RUnorm,
130 WGPUTextureFormat_BC4RSnorm,
131 WGPUTextureFormat_Undefined, // Undefined
132 WGPUTextureFormat_BC5RGUnorm,
133 WGPUTextureFormat_BC5RGSnorm,
134
135 // BPTC TODO
136 WGPUTextureFormat_Undefined,
137 WGPUTextureFormat_Undefined,
138 WGPUTextureFormat_Undefined,
139 WGPUTextureFormat_Undefined,
140
141 // PVRTC TODO
142 WGPUTextureFormat_Undefined,
143 WGPUTextureFormat_Undefined,
144 WGPUTextureFormat_Undefined,
145 WGPUTextureFormat_Undefined,
146
147 //ETC TODO
148 WGPUTextureFormat_Undefined,
149 WGPUTextureFormat_Undefined,
150 WGPUTextureFormat_Undefined,
151 WGPUTextureFormat_Undefined,
152
153 WGPUTextureFormat_Undefined,
154 WGPUTextureFormat_Undefined,
155 WGPUTextureFormat_Undefined,
156 WGPUTextureFormat_Undefined,
157
158 // ASTC TODO
159 WGPUTextureFormat_Undefined,
160 WGPUTextureFormat_Undefined,
161 WGPUTextureFormat_Undefined,
162 WGPUTextureFormat_Undefined,
163 WGPUTextureFormat_Undefined,
164 WGPUTextureFormat_Undefined,
165 WGPUTextureFormat_Undefined,
166 WGPUTextureFormat_Undefined,
167 WGPUTextureFormat_Undefined,
168 WGPUTextureFormat_Undefined,
169 WGPUTextureFormat_Undefined,
170 WGPUTextureFormat_Undefined,
171 WGPUTextureFormat_Undefined,
172 WGPUTextureFormat_Undefined,
173 // ASTC SRGBA TODO
174 WGPUTextureFormat_Undefined,
175 WGPUTextureFormat_Undefined,
176 WGPUTextureFormat_Undefined,
177 WGPUTextureFormat_Undefined,
178 WGPUTextureFormat_Undefined,
179 WGPUTextureFormat_Undefined,
180 WGPUTextureFormat_Undefined,
181 WGPUTextureFormat_Undefined,
182 WGPUTextureFormat_Undefined,
183 WGPUTextureFormat_Undefined,
184 WGPUTextureFormat_Undefined,
185 WGPUTextureFormat_Undefined,
186 WGPUTextureFormat_Undefined,
187 WGPUTextureFormat_Undefined,
188
189 // SRGB formats
190
191 WGPUTextureFormat_Undefined, // Undefined
192 WGPUTextureFormat_RGBA8UnormSrgb,
193
194 // Packed formats
195
196 WGPUTextureFormat_Undefined, // Undefined
197 WGPUTextureFormat_RGB10A2Unorm,
198 WGPUTextureFormat_RGB10A2Uint,
199 WGPUTextureFormat_RG11B10Ufloat,
200 WGPUTextureFormat_Undefined, // Undefined
201 WGPUTextureFormat_Undefined, // Undefined
202 WGPUTextureFormat_Undefined, // Undefined
203 WGPUTextureFormat_RGB9E5Ufloat,
204
205 // Matrix format for instancing
206
207 WGPUTextureFormat_Undefined, // Undefined
208};
209 STATIC_ASSERT_MAPPING(Cogs::TextureFormatsWebGPU, (int)Cogs::TextureFormat::TextureFormat_Size);
210
211const WGPUVertexFormat Cogs::VertexFormatsWebGPU[] = {
212 WGPUVertexFormat_Undefined,
213
214 // Unsigned normalized byte formats
215
216 WGPUVertexFormat_Undefined,
217 WGPUVertexFormat_Unorm8x2,
218 WGPUVertexFormat_Undefined,
219 WGPUVertexFormat_Unorm8x4,
220
221 // Unsigned 16 bit normalized integer formats
222
223 WGPUVertexFormat_Undefined,
224 WGPUVertexFormat_Unorm16x2,
225 WGPUVertexFormat_Undefined,
226 WGPUVertexFormat_Unorm16x4,
227
228 // Signed normalized byte formats
229
230 WGPUVertexFormat_Undefined,
231 WGPUVertexFormat_Snorm8x2,
232 WGPUVertexFormat_Undefined,
233 WGPUVertexFormat_Snorm8x4,
234
235 // Signed 16 bit normalized integer formats
236
237 WGPUVertexFormat_Undefined,
238 WGPUVertexFormat_Snorm16x2,
239 WGPUVertexFormat_Undefined,
240 WGPUVertexFormat_Snorm16x4,
241
242 // Unsigned byte formats
243
244 WGPUVertexFormat_Undefined,
245 WGPUVertexFormat_Uint8x2,
246 WGPUVertexFormat_Undefined,
247 WGPUVertexFormat_Uint8x4,
248
249
250 // Unsigned 16 bit integer formats
251
252 WGPUVertexFormat_Undefined,
253 WGPUVertexFormat_Uint16x2,
254 WGPUVertexFormat_Undefined,
255 WGPUVertexFormat_Uint16x4,
256
257 // Unsigned 32 bit integer formats
258
259 WGPUVertexFormat_Uint32,
260 WGPUVertexFormat_Uint32x2,
261 WGPUVertexFormat_Uint32x3,
262 WGPUVertexFormat_Uint32x4,
263
264 // Signed byte formats
265
266 WGPUVertexFormat_Undefined,
267 WGPUVertexFormat_Sint8x2,
268 WGPUVertexFormat_Undefined,
269 WGPUVertexFormat_Sint8x4,
270
271 // Signed 16 bit integer formats
272
273 WGPUVertexFormat_Undefined,
274 WGPUVertexFormat_Sint16x2,
275 WGPUVertexFormat_Undefined,
276 WGPUVertexFormat_Sint16x4,
277
278 // Signed 32 bit integer formats
279
280 WGPUVertexFormat_Sint32,
281 WGPUVertexFormat_Sint32x2,
282 WGPUVertexFormat_Sint32x3,
283 WGPUVertexFormat_Sint32x4,
284
285 // 16 bit floating point formats
286
287 WGPUVertexFormat_Undefined,
288 WGPUVertexFormat_Float16x2,
289 WGPUVertexFormat_Undefined,
290 WGPUVertexFormat_Float16x4,
291
292 // 32 bit floating point formats
293
294 WGPUVertexFormat_Float32,
295 WGPUVertexFormat_Float32x2,
296 WGPUVertexFormat_Float32x3,
297 WGPUVertexFormat_Float32x4,
298
299 // Depth buffer formats
300
301 WGPUVertexFormat_Undefined,
302 WGPUVertexFormat_Undefined,
303 WGPUVertexFormat_Undefined,
304 WGPUVertexFormat_Undefined,
305 WGPUVertexFormat_Undefined,
306 WGPUVertexFormat_Undefined,
307
308 // 8 bit typeless formats
309
310 WGPUVertexFormat_Undefined,
311 WGPUVertexFormat_Undefined,
312 WGPUVertexFormat_Undefined,
313 WGPUVertexFormat_Undefined,
314
315 // Reverse component order formats.
316
317 WGPUVertexFormat_Undefined,
318 WGPUVertexFormat_Undefined,
319
320 // Alpha formats
321
322 WGPUVertexFormat_Undefined,
323
324 // Compressed formats
325
326 WGPUVertexFormat_Undefined,
327 WGPUVertexFormat_Undefined,
328 WGPUVertexFormat_Undefined,
329 WGPUVertexFormat_Undefined,
330 WGPUVertexFormat_Undefined,
331 WGPUVertexFormat_Undefined,
332 WGPUVertexFormat_Undefined,
333 WGPUVertexFormat_Undefined,
334 WGPUVertexFormat_Undefined,
335 WGPUVertexFormat_Undefined,
336 WGPUVertexFormat_Undefined,
337 WGPUVertexFormat_Undefined,
338 WGPUVertexFormat_Undefined,
339 WGPUVertexFormat_Undefined,
340 WGPUVertexFormat_Undefined,
341
342 // BPTC
343 WGPUVertexFormat_Undefined,
344 WGPUVertexFormat_Undefined,
345 WGPUVertexFormat_Undefined,
346 WGPUVertexFormat_Undefined,
347
348 // PVRTC
349 WGPUVertexFormat_Undefined,
350 WGPUVertexFormat_Undefined,
351 WGPUVertexFormat_Undefined,
352 WGPUVertexFormat_Undefined,
353
354 //ETC
355 WGPUVertexFormat_Undefined,
356 WGPUVertexFormat_Undefined,
357 WGPUVertexFormat_Undefined,
358 WGPUVertexFormat_Undefined,
359
360 WGPUVertexFormat_Undefined,
361 WGPUVertexFormat_Undefined,
362 WGPUVertexFormat_Undefined,
363 WGPUVertexFormat_Undefined,
364
365 // ASTC
366 WGPUVertexFormat_Undefined,
367 WGPUVertexFormat_Undefined,
368 WGPUVertexFormat_Undefined,
369 WGPUVertexFormat_Undefined,
370 WGPUVertexFormat_Undefined,
371 WGPUVertexFormat_Undefined,
372 WGPUVertexFormat_Undefined,
373 WGPUVertexFormat_Undefined,
374 WGPUVertexFormat_Undefined,
375 WGPUVertexFormat_Undefined,
376 WGPUVertexFormat_Undefined,
377 WGPUVertexFormat_Undefined,
378 WGPUVertexFormat_Undefined,
379 WGPUVertexFormat_Undefined,
380 // ASTC SRGBA
381 WGPUVertexFormat_Undefined,
382 WGPUVertexFormat_Undefined,
383 WGPUVertexFormat_Undefined,
384 WGPUVertexFormat_Undefined,
385 WGPUVertexFormat_Undefined,
386 WGPUVertexFormat_Undefined,
387 WGPUVertexFormat_Undefined,
388 WGPUVertexFormat_Undefined,
389 WGPUVertexFormat_Undefined,
390 WGPUVertexFormat_Undefined,
391 WGPUVertexFormat_Undefined,
392 WGPUVertexFormat_Undefined,
393 WGPUVertexFormat_Undefined,
394 WGPUVertexFormat_Undefined,
395
396 // SRGB formats
397
398 WGPUVertexFormat_Undefined,
399 WGPUVertexFormat_Undefined,
400
401 // Packed formats
402
403 WGPUVertexFormat_Undefined,
404 WGPUVertexFormat_Undefined,
405 WGPUVertexFormat_Undefined,
406 WGPUVertexFormat_Undefined,
407 WGPUVertexFormat_Undefined,
408 WGPUVertexFormat_Undefined,
409 WGPUVertexFormat_Undefined,
410 WGPUVertexFormat_Undefined,
411
412 // Matrix format for instancing
413
414 WGPUVertexFormat_Undefined,
415};
416 STATIC_ASSERT_MAPPING(Cogs::VertexFormatsWebGPU, (int)Cogs::TextureFormat::Format_Size);