1 // GENERATED FILE - DO NOT EDIT.
2 // Generated by gen_vk_format_table.py using data from vk_format_map.json
3 //
4 // Copyright 2020 The ANGLE Project Authors. All rights reserved.
5 // Use of this source code is governed by a BSD-style license that can be
6 // found in the LICENSE file.
7 //
8 // vk_format_table_autogen.cpp:
9 // Queries for full Vulkan format information based on GL format.
10
11 #include "libANGLE/renderer/vulkan/vk_format_utils.h"
12
13 #include "image_util/loadimage.h"
14
15 using namespace angle;
16
17 namespace rx
18 {
19 namespace vk
20 {
21
initialize(RendererVk * renderer,const angle::Format & angleFormat)22 void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat)
23 {
24 switch (angleFormat.id)
25 {
26 case angle::FormatID::A16_FLOAT:
27 mIntendedGLFormat = GL_ALPHA16F_EXT;
28 mActualSampleOnlyImageFormatID = angle::FormatID::R16_FLOAT;
29 mImageInitializerFunction = nullptr;
30
31 break;
32
33 case angle::FormatID::A1R5G5B5_UNORM:
34 mIntendedGLFormat = GL_A1RGB5_ANGLEX;
35 mActualSampleOnlyImageFormatID = angle::FormatID::A1R5G5B5_UNORM;
36 mImageInitializerFunction = nullptr;
37 mActualBufferFormatID = angle::FormatID::A1R5G5B5_UNORM;
38 mVkBufferFormatIsPacked = true;
39 mVertexLoadFunction = CopyNativeVertexData<GLushort, 1, 1, 0>;
40 mVertexLoadRequiresConversion = false;
41 break;
42
43 case angle::FormatID::A2R10G10B10_SINT_VERTEX:
44 mIntendedGLFormat = GL_INT_10_10_10_2_OES;
45 mActualSampleOnlyImageFormatID = angle::FormatID::NONE;
46 mImageInitializerFunction = nullptr;
47 mActualBufferFormatID = angle::FormatID::R16G16B16A16_FLOAT;
48 mVkBufferFormatIsPacked = false;
49 mVertexLoadFunction = CopyW2XYZ10ToXYZWFloatVertexData<true, false, true>;
50 mVertexLoadRequiresConversion = true;
51 break;
52
53 case angle::FormatID::A2R10G10B10_SNORM_VERTEX:
54 mIntendedGLFormat = GL_A2_RGB10_SNORM_ANGLEX;
55 mActualSampleOnlyImageFormatID = angle::FormatID::NONE;
56 mImageInitializerFunction = nullptr;
57 mActualBufferFormatID = angle::FormatID::R16G16B16A16_FLOAT;
58 mVkBufferFormatIsPacked = false;
59 mVertexLoadFunction = CopyW2XYZ10ToXYZWFloatVertexData<true, true, true>;
60 mVertexLoadRequiresConversion = true;
61 break;
62
63 case angle::FormatID::A2R10G10B10_SSCALED_VERTEX:
64 mIntendedGLFormat = GL_A2_RGB10_SSCALED_ANGLEX;
65 mActualSampleOnlyImageFormatID = angle::FormatID::NONE;
66 mImageInitializerFunction = nullptr;
67 mActualBufferFormatID = angle::FormatID::R16G16B16A16_FLOAT;
68 mVkBufferFormatIsPacked = false;
69 mVertexLoadFunction = CopyW2XYZ10ToXYZWFloatVertexData<true, false, true>;
70 mVertexLoadRequiresConversion = true;
71 break;
72
73 case angle::FormatID::A2R10G10B10_UINT_VERTEX:
74 mIntendedGLFormat = GL_UNSIGNED_INT_10_10_10_2_OES;
75 mActualSampleOnlyImageFormatID = angle::FormatID::NONE;
76 mImageInitializerFunction = nullptr;
77 mActualBufferFormatID = angle::FormatID::R16G16B16A16_FLOAT;
78 mVkBufferFormatIsPacked = false;
79 mVertexLoadFunction = CopyW2XYZ10ToXYZWFloatVertexData<false, false, true>;
80 mVertexLoadRequiresConversion = true;
81 break;
82
83 case angle::FormatID::A2R10G10B10_UNORM_VERTEX:
84 mIntendedGLFormat = GL_A2_RGB10_UNORM_ANGLEX;
85 mActualSampleOnlyImageFormatID = angle::FormatID::NONE;
86 mImageInitializerFunction = nullptr;
87 mActualBufferFormatID = angle::FormatID::R16G16B16A16_FLOAT;
88 mVkBufferFormatIsPacked = false;
89 mVertexLoadFunction = CopyW2XYZ10ToXYZWFloatVertexData<false, true, true>;
90 mVertexLoadRequiresConversion = true;
91 break;
92
93 case angle::FormatID::A2R10G10B10_USCALED_VERTEX:
94 mIntendedGLFormat = GL_A2_RGB10_USCALED_ANGLEX;
95 mActualSampleOnlyImageFormatID = angle::FormatID::NONE;
96 mImageInitializerFunction = nullptr;
97 mActualBufferFormatID = angle::FormatID::R16G16B16A16_FLOAT;
98 mVkBufferFormatIsPacked = false;
99 mVertexLoadFunction = CopyW2XYZ10ToXYZWFloatVertexData<false, false, true>;
100 mVertexLoadRequiresConversion = true;
101 break;
102
103 case angle::FormatID::A32_FLOAT:
104 mIntendedGLFormat = GL_ALPHA32F_EXT;
105 mActualSampleOnlyImageFormatID = angle::FormatID::R32_FLOAT;
106 mImageInitializerFunction = nullptr;
107
108 break;
109
110 case angle::FormatID::A8_UNORM:
111 mIntendedGLFormat = GL_ALPHA8_EXT;
112 mActualSampleOnlyImageFormatID = angle::FormatID::R8_UNORM;
113 mImageInitializerFunction = nullptr;
114
115 break;
116
117 case angle::FormatID::ASTC_10x10_SRGB_BLOCK:
118 mIntendedGLFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR;
119 mActualSampleOnlyImageFormatID = angle::FormatID::ASTC_10x10_SRGB_BLOCK;
120 mImageInitializerFunction = nullptr;
121 mActualBufferFormatID = angle::FormatID::ASTC_10x10_SRGB_BLOCK;
122 mVkBufferFormatIsPacked = false;
123 mVertexLoadFunction = nullptr;
124 mVertexLoadRequiresConversion = false;
125 break;
126
127 case angle::FormatID::ASTC_10x10_UNORM_BLOCK:
128 mIntendedGLFormat = GL_COMPRESSED_RGBA_ASTC_10x10_KHR;
129 mActualSampleOnlyImageFormatID = angle::FormatID::ASTC_10x10_UNORM_BLOCK;
130 mImageInitializerFunction = nullptr;
131 mActualBufferFormatID = angle::FormatID::ASTC_10x10_UNORM_BLOCK;
132 mVkBufferFormatIsPacked = false;
133 mVertexLoadFunction = nullptr;
134 mVertexLoadRequiresConversion = false;
135 break;
136
137 case angle::FormatID::ASTC_10x5_SRGB_BLOCK:
138 mIntendedGLFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR;
139 mActualSampleOnlyImageFormatID = angle::FormatID::ASTC_10x5_SRGB_BLOCK;
140 mImageInitializerFunction = nullptr;
141 mActualBufferFormatID = angle::FormatID::ASTC_10x5_SRGB_BLOCK;
142 mVkBufferFormatIsPacked = false;
143 mVertexLoadFunction = nullptr;
144 mVertexLoadRequiresConversion = false;
145 break;
146
147 case angle::FormatID::ASTC_10x5_UNORM_BLOCK:
148 mIntendedGLFormat = GL_COMPRESSED_RGBA_ASTC_10x5_KHR;
149 mActualSampleOnlyImageFormatID = angle::FormatID::ASTC_10x5_UNORM_BLOCK;
150 mImageInitializerFunction = nullptr;
151 mActualBufferFormatID = angle::FormatID::ASTC_10x5_UNORM_BLOCK;
152 mVkBufferFormatIsPacked = false;
153 mVertexLoadFunction = nullptr;
154 mVertexLoadRequiresConversion = false;
155 break;
156
157 case angle::FormatID::ASTC_10x6_SRGB_BLOCK:
158 mIntendedGLFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR;
159 mActualSampleOnlyImageFormatID = angle::FormatID::ASTC_10x6_SRGB_BLOCK;
160 mImageInitializerFunction = nullptr;
161 mActualBufferFormatID = angle::FormatID::ASTC_10x6_SRGB_BLOCK;
162 mVkBufferFormatIsPacked = false;
163 mVertexLoadFunction = nullptr;
164 mVertexLoadRequiresConversion = false;
165 break;
166
167 case angle::FormatID::ASTC_10x6_UNORM_BLOCK:
168 mIntendedGLFormat = GL_COMPRESSED_RGBA_ASTC_10x6_KHR;
169 mActualSampleOnlyImageFormatID = angle::FormatID::ASTC_10x6_UNORM_BLOCK;
170 mImageInitializerFunction = nullptr;
171 mActualBufferFormatID = angle::FormatID::ASTC_10x6_UNORM_BLOCK;
172 mVkBufferFormatIsPacked = false;
173 mVertexLoadFunction = nullptr;
174 mVertexLoadRequiresConversion = false;
175 break;
176
177 case angle::FormatID::ASTC_10x8_SRGB_BLOCK:
178 mIntendedGLFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR;
179 mActualSampleOnlyImageFormatID = angle::FormatID::ASTC_10x8_SRGB_BLOCK;
180 mImageInitializerFunction = nullptr;
181 mActualBufferFormatID = angle::FormatID::ASTC_10x8_SRGB_BLOCK;
182 mVkBufferFormatIsPacked = false;
183 mVertexLoadFunction = nullptr;
184 mVertexLoadRequiresConversion = false;
185 break;
186
187 case angle::FormatID::ASTC_10x8_UNORM_BLOCK:
188 mIntendedGLFormat = GL_COMPRESSED_RGBA_ASTC_10x8_KHR;
189 mActualSampleOnlyImageFormatID = angle::FormatID::ASTC_10x8_UNORM_BLOCK;
190 mImageInitializerFunction = nullptr;
191 mActualBufferFormatID = angle::FormatID::ASTC_10x8_UNORM_BLOCK;
192 mVkBufferFormatIsPacked = false;
193 mVertexLoadFunction = nullptr;
194 mVertexLoadRequiresConversion = false;
195 break;
196
197 case angle::FormatID::ASTC_12x10_SRGB_BLOCK:
198 mIntendedGLFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR;
199 mActualSampleOnlyImageFormatID = angle::FormatID::ASTC_12x10_SRGB_BLOCK;
200 mImageInitializerFunction = nullptr;
201 mActualBufferFormatID = angle::FormatID::ASTC_12x10_SRGB_BLOCK;
202 mVkBufferFormatIsPacked = false;
203 mVertexLoadFunction = nullptr;
204 mVertexLoadRequiresConversion = false;
205 break;
206
207 case angle::FormatID::ASTC_12x10_UNORM_BLOCK:
208 mIntendedGLFormat = GL_COMPRESSED_RGBA_ASTC_12x10_KHR;
209 mActualSampleOnlyImageFormatID = angle::FormatID::ASTC_12x10_UNORM_BLOCK;
210 mImageInitializerFunction = nullptr;
211 mActualBufferFormatID = angle::FormatID::ASTC_12x10_UNORM_BLOCK;
212 mVkBufferFormatIsPacked = false;
213 mVertexLoadFunction = nullptr;
214 mVertexLoadRequiresConversion = false;
215 break;
216
217 case angle::FormatID::ASTC_12x12_SRGB_BLOCK:
218 mIntendedGLFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR;
219 mActualSampleOnlyImageFormatID = angle::FormatID::ASTC_12x12_SRGB_BLOCK;
220 mImageInitializerFunction = nullptr;
221 mActualBufferFormatID = angle::FormatID::ASTC_12x12_SRGB_BLOCK;
222 mVkBufferFormatIsPacked = false;
223 mVertexLoadFunction = nullptr;
224 mVertexLoadRequiresConversion = false;
225 break;
226
227 case angle::FormatID::ASTC_12x12_UNORM_BLOCK:
228 mIntendedGLFormat = GL_COMPRESSED_RGBA_ASTC_12x12_KHR;
229 mActualSampleOnlyImageFormatID = angle::FormatID::ASTC_12x12_UNORM_BLOCK;
230 mImageInitializerFunction = nullptr;
231 mActualBufferFormatID = angle::FormatID::ASTC_12x12_UNORM_BLOCK;
232 mVkBufferFormatIsPacked = false;
233 mVertexLoadFunction = nullptr;
234 mVertexLoadRequiresConversion = false;
235 break;
236
237 case angle::FormatID::ASTC_3x3x3_UNORM_BLOCK:
238 // This format is not implemented in Vulkan.
239 break;
240
241 case angle::FormatID::ASTC_3x3x3_UNORM_SRGB_BLOCK:
242 // This format is not implemented in Vulkan.
243 break;
244
245 case angle::FormatID::ASTC_4x3x3_UNORM_BLOCK:
246 // This format is not implemented in Vulkan.
247 break;
248
249 case angle::FormatID::ASTC_4x3x3_UNORM_SRGB_BLOCK:
250 // This format is not implemented in Vulkan.
251 break;
252
253 case angle::FormatID::ASTC_4x4_SRGB_BLOCK:
254 mIntendedGLFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR;
255 mActualSampleOnlyImageFormatID = angle::FormatID::ASTC_4x4_SRGB_BLOCK;
256 mImageInitializerFunction = nullptr;
257 mActualBufferFormatID = angle::FormatID::ASTC_4x4_SRGB_BLOCK;
258 mVkBufferFormatIsPacked = false;
259 mVertexLoadFunction = nullptr;
260 mVertexLoadRequiresConversion = false;
261 break;
262
263 case angle::FormatID::ASTC_4x4_UNORM_BLOCK:
264 mIntendedGLFormat = GL_COMPRESSED_RGBA_ASTC_4x4_KHR;
265 mActualSampleOnlyImageFormatID = angle::FormatID::ASTC_4x4_UNORM_BLOCK;
266 mImageInitializerFunction = nullptr;
267 mActualBufferFormatID = angle::FormatID::ASTC_4x4_UNORM_BLOCK;
268 mVkBufferFormatIsPacked = false;
269 mVertexLoadFunction = nullptr;
270 mVertexLoadRequiresConversion = false;
271 break;
272
273 case angle::FormatID::ASTC_4x4x3_UNORM_BLOCK:
274 // This format is not implemented in Vulkan.
275 break;
276
277 case angle::FormatID::ASTC_4x4x3_UNORM_SRGB_BLOCK:
278 // This format is not implemented in Vulkan.
279 break;
280
281 case angle::FormatID::ASTC_4x4x4_UNORM_BLOCK:
282 // This format is not implemented in Vulkan.
283 break;
284
285 case angle::FormatID::ASTC_4x4x4_UNORM_SRGB_BLOCK:
286 // This format is not implemented in Vulkan.
287 break;
288
289 case angle::FormatID::ASTC_5x4_SRGB_BLOCK:
290 mIntendedGLFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR;
291 mActualSampleOnlyImageFormatID = angle::FormatID::ASTC_5x4_SRGB_BLOCK;
292 mImageInitializerFunction = nullptr;
293 mActualBufferFormatID = angle::FormatID::ASTC_5x4_SRGB_BLOCK;
294 mVkBufferFormatIsPacked = false;
295 mVertexLoadFunction = nullptr;
296 mVertexLoadRequiresConversion = false;
297 break;
298
299 case angle::FormatID::ASTC_5x4_UNORM_BLOCK:
300 mIntendedGLFormat = GL_COMPRESSED_RGBA_ASTC_5x4_KHR;
301 mActualSampleOnlyImageFormatID = angle::FormatID::ASTC_5x4_UNORM_BLOCK;
302 mImageInitializerFunction = nullptr;
303 mActualBufferFormatID = angle::FormatID::ASTC_5x4_UNORM_BLOCK;
304 mVkBufferFormatIsPacked = false;
305 mVertexLoadFunction = nullptr;
306 mVertexLoadRequiresConversion = false;
307 break;
308
309 case angle::FormatID::ASTC_5x4x4_UNORM_BLOCK:
310 // This format is not implemented in Vulkan.
311 break;
312
313 case angle::FormatID::ASTC_5x4x4_UNORM_SRGB_BLOCK:
314 // This format is not implemented in Vulkan.
315 break;
316
317 case angle::FormatID::ASTC_5x5_SRGB_BLOCK:
318 mIntendedGLFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR;
319 mActualSampleOnlyImageFormatID = angle::FormatID::ASTC_5x5_SRGB_BLOCK;
320 mImageInitializerFunction = nullptr;
321 mActualBufferFormatID = angle::FormatID::ASTC_5x5_SRGB_BLOCK;
322 mVkBufferFormatIsPacked = false;
323 mVertexLoadFunction = nullptr;
324 mVertexLoadRequiresConversion = false;
325 break;
326
327 case angle::FormatID::ASTC_5x5_UNORM_BLOCK:
328 mIntendedGLFormat = GL_COMPRESSED_RGBA_ASTC_5x5_KHR;
329 mActualSampleOnlyImageFormatID = angle::FormatID::ASTC_5x5_UNORM_BLOCK;
330 mImageInitializerFunction = nullptr;
331 mActualBufferFormatID = angle::FormatID::ASTC_5x5_UNORM_BLOCK;
332 mVkBufferFormatIsPacked = false;
333 mVertexLoadFunction = nullptr;
334 mVertexLoadRequiresConversion = false;
335 break;
336
337 case angle::FormatID::ASTC_5x5x4_UNORM_BLOCK:
338 // This format is not implemented in Vulkan.
339 break;
340
341 case angle::FormatID::ASTC_5x5x4_UNORM_SRGB_BLOCK:
342 // This format is not implemented in Vulkan.
343 break;
344
345 case angle::FormatID::ASTC_5x5x5_UNORM_BLOCK:
346 // This format is not implemented in Vulkan.
347 break;
348
349 case angle::FormatID::ASTC_5x5x5_UNORM_SRGB_BLOCK:
350 // This format is not implemented in Vulkan.
351 break;
352
353 case angle::FormatID::ASTC_6x5_SRGB_BLOCK:
354 mIntendedGLFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR;
355 mActualSampleOnlyImageFormatID = angle::FormatID::ASTC_6x5_SRGB_BLOCK;
356 mImageInitializerFunction = nullptr;
357 mActualBufferFormatID = angle::FormatID::ASTC_6x5_SRGB_BLOCK;
358 mVkBufferFormatIsPacked = false;
359 mVertexLoadFunction = nullptr;
360 mVertexLoadRequiresConversion = false;
361 break;
362
363 case angle::FormatID::ASTC_6x5_UNORM_BLOCK:
364 mIntendedGLFormat = GL_COMPRESSED_RGBA_ASTC_6x5_KHR;
365 mActualSampleOnlyImageFormatID = angle::FormatID::ASTC_6x5_UNORM_BLOCK;
366 mImageInitializerFunction = nullptr;
367 mActualBufferFormatID = angle::FormatID::ASTC_6x5_UNORM_BLOCK;
368 mVkBufferFormatIsPacked = false;
369 mVertexLoadFunction = nullptr;
370 mVertexLoadRequiresConversion = false;
371 break;
372
373 case angle::FormatID::ASTC_6x5x5_UNORM_BLOCK:
374 // This format is not implemented in Vulkan.
375 break;
376
377 case angle::FormatID::ASTC_6x5x5_UNORM_SRGB_BLOCK:
378 // This format is not implemented in Vulkan.
379 break;
380
381 case angle::FormatID::ASTC_6x6_SRGB_BLOCK:
382 mIntendedGLFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR;
383 mActualSampleOnlyImageFormatID = angle::FormatID::ASTC_6x6_SRGB_BLOCK;
384 mImageInitializerFunction = nullptr;
385 mActualBufferFormatID = angle::FormatID::ASTC_6x6_SRGB_BLOCK;
386 mVkBufferFormatIsPacked = false;
387 mVertexLoadFunction = nullptr;
388 mVertexLoadRequiresConversion = false;
389 break;
390
391 case angle::FormatID::ASTC_6x6_UNORM_BLOCK:
392 mIntendedGLFormat = GL_COMPRESSED_RGBA_ASTC_6x6_KHR;
393 mActualSampleOnlyImageFormatID = angle::FormatID::ASTC_6x6_UNORM_BLOCK;
394 mImageInitializerFunction = nullptr;
395 mActualBufferFormatID = angle::FormatID::ASTC_6x6_UNORM_BLOCK;
396 mVkBufferFormatIsPacked = false;
397 mVertexLoadFunction = nullptr;
398 mVertexLoadRequiresConversion = false;
399 break;
400
401 case angle::FormatID::ASTC_6x6x5_UNORM_BLOCK:
402 // This format is not implemented in Vulkan.
403 break;
404
405 case angle::FormatID::ASTC_6x6x5_UNORM_SRGB_BLOCK:
406 // This format is not implemented in Vulkan.
407 break;
408
409 case angle::FormatID::ASTC_6x6x6_UNORM_BLOCK:
410 // This format is not implemented in Vulkan.
411 break;
412
413 case angle::FormatID::ASTC_6x6x6_UNORM_SRGB_BLOCK:
414 // This format is not implemented in Vulkan.
415 break;
416
417 case angle::FormatID::ASTC_8x5_SRGB_BLOCK:
418 mIntendedGLFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR;
419 mActualSampleOnlyImageFormatID = angle::FormatID::ASTC_8x5_SRGB_BLOCK;
420 mImageInitializerFunction = nullptr;
421 mActualBufferFormatID = angle::FormatID::ASTC_8x5_SRGB_BLOCK;
422 mVkBufferFormatIsPacked = false;
423 mVertexLoadFunction = nullptr;
424 mVertexLoadRequiresConversion = false;
425 break;
426
427 case angle::FormatID::ASTC_8x5_UNORM_BLOCK:
428 mIntendedGLFormat = GL_COMPRESSED_RGBA_ASTC_8x5_KHR;
429 mActualSampleOnlyImageFormatID = angle::FormatID::ASTC_8x5_UNORM_BLOCK;
430 mImageInitializerFunction = nullptr;
431 mActualBufferFormatID = angle::FormatID::ASTC_8x5_UNORM_BLOCK;
432 mVkBufferFormatIsPacked = false;
433 mVertexLoadFunction = nullptr;
434 mVertexLoadRequiresConversion = false;
435 break;
436
437 case angle::FormatID::ASTC_8x6_SRGB_BLOCK:
438 mIntendedGLFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR;
439 mActualSampleOnlyImageFormatID = angle::FormatID::ASTC_8x6_SRGB_BLOCK;
440 mImageInitializerFunction = nullptr;
441 mActualBufferFormatID = angle::FormatID::ASTC_8x6_SRGB_BLOCK;
442 mVkBufferFormatIsPacked = false;
443 mVertexLoadFunction = nullptr;
444 mVertexLoadRequiresConversion = false;
445 break;
446
447 case angle::FormatID::ASTC_8x6_UNORM_BLOCK:
448 mIntendedGLFormat = GL_COMPRESSED_RGBA_ASTC_8x6_KHR;
449 mActualSampleOnlyImageFormatID = angle::FormatID::ASTC_8x6_UNORM_BLOCK;
450 mImageInitializerFunction = nullptr;
451 mActualBufferFormatID = angle::FormatID::ASTC_8x6_UNORM_BLOCK;
452 mVkBufferFormatIsPacked = false;
453 mVertexLoadFunction = nullptr;
454 mVertexLoadRequiresConversion = false;
455 break;
456
457 case angle::FormatID::ASTC_8x8_SRGB_BLOCK:
458 mIntendedGLFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR;
459 mActualSampleOnlyImageFormatID = angle::FormatID::ASTC_8x8_SRGB_BLOCK;
460 mImageInitializerFunction = nullptr;
461 mActualBufferFormatID = angle::FormatID::ASTC_8x8_SRGB_BLOCK;
462 mVkBufferFormatIsPacked = false;
463 mVertexLoadFunction = nullptr;
464 mVertexLoadRequiresConversion = false;
465 break;
466
467 case angle::FormatID::ASTC_8x8_UNORM_BLOCK:
468 mIntendedGLFormat = GL_COMPRESSED_RGBA_ASTC_8x8_KHR;
469 mActualSampleOnlyImageFormatID = angle::FormatID::ASTC_8x8_UNORM_BLOCK;
470 mImageInitializerFunction = nullptr;
471 mActualBufferFormatID = angle::FormatID::ASTC_8x8_UNORM_BLOCK;
472 mVkBufferFormatIsPacked = false;
473 mVertexLoadFunction = nullptr;
474 mVertexLoadRequiresConversion = false;
475 break;
476
477 case angle::FormatID::B10G10R10A2_UNORM:
478 mIntendedGLFormat = GL_BGR10_A2_ANGLEX;
479 mActualSampleOnlyImageFormatID = angle::FormatID::B10G10R10A2_UNORM;
480 mImageInitializerFunction = nullptr;
481 mActualBufferFormatID = angle::FormatID::B10G10R10A2_UNORM;
482 mVkBufferFormatIsPacked = true;
483 mVertexLoadFunction = CopyNativeVertexData<GLuint, 1, 1, 0>;
484 mVertexLoadRequiresConversion = false;
485 break;
486
487 case angle::FormatID::B4G4R4A4_UNORM:
488 mIntendedGLFormat = GL_BGRA4_ANGLEX;
489 mActualSampleOnlyImageFormatID = angle::FormatID::B4G4R4A4_UNORM;
490 mImageInitializerFunction = nullptr;
491 mActualBufferFormatID = angle::FormatID::B4G4R4A4_UNORM;
492 mVkBufferFormatIsPacked = true;
493 mVertexLoadFunction = CopyNativeVertexData<GLushort, 1, 1, 0>;
494 mVertexLoadRequiresConversion = false;
495 break;
496
497 case angle::FormatID::B5G5R5A1_UNORM:
498 mIntendedGLFormat = GL_BGR5_A1_ANGLEX;
499 mActualSampleOnlyImageFormatID = angle::FormatID::B5G5R5A1_UNORM;
500 mImageInitializerFunction = nullptr;
501 mActualBufferFormatID = angle::FormatID::B5G5R5A1_UNORM;
502 mVkBufferFormatIsPacked = true;
503 mVertexLoadFunction = CopyNativeVertexData<GLushort, 1, 1, 0>;
504 mVertexLoadRequiresConversion = false;
505 break;
506
507 case angle::FormatID::B5G6R5_UNORM:
508 mIntendedGLFormat = GL_BGR565_ANGLEX;
509 mActualSampleOnlyImageFormatID = angle::FormatID::B5G6R5_UNORM;
510 mImageInitializerFunction = nullptr;
511 mActualBufferFormatID = angle::FormatID::B5G6R5_UNORM;
512 mVkBufferFormatIsPacked = true;
513 mVertexLoadFunction = CopyNativeVertexData<GLushort, 1, 1, 0>;
514 mVertexLoadRequiresConversion = false;
515 break;
516
517 case angle::FormatID::B8G8R8A8_TYPELESS:
518 // This format is not implemented in Vulkan.
519 break;
520
521 case angle::FormatID::B8G8R8A8_TYPELESS_SRGB:
522 // This format is not implemented in Vulkan.
523 break;
524
525 case angle::FormatID::B8G8R8A8_UNORM:
526 mIntendedGLFormat = GL_BGRA8_EXT;
527 mActualSampleOnlyImageFormatID = angle::FormatID::B8G8R8A8_UNORM;
528 mImageInitializerFunction = nullptr;
529 mActualBufferFormatID = angle::FormatID::B8G8R8A8_UNORM;
530 mVkBufferFormatIsPacked = false;
531 mVertexLoadFunction = CopyNativeVertexData<GLubyte, 4, 4, 0>;
532 mVertexLoadRequiresConversion = false;
533 break;
534
535 case angle::FormatID::B8G8R8A8_UNORM_SRGB:
536 mIntendedGLFormat = GL_BGRA8_SRGB_ANGLEX;
537 mActualSampleOnlyImageFormatID = angle::FormatID::B8G8R8A8_UNORM_SRGB;
538 mImageInitializerFunction = nullptr;
539 mActualBufferFormatID = angle::FormatID::B8G8R8A8_UNORM_SRGB;
540 mVkBufferFormatIsPacked = false;
541 mVertexLoadFunction = CopyNativeVertexData<GLubyte, 4, 4, 0>;
542 mVertexLoadRequiresConversion = false;
543 break;
544
545 case angle::FormatID::B8G8R8X8_UNORM:
546 mIntendedGLFormat = GL_BGRX8_ANGLEX;
547 mActualSampleOnlyImageFormatID = angle::FormatID::B8G8R8A8_UNORM;
548 mImageInitializerFunction = nullptr;
549 mActualBufferFormatID = angle::FormatID::NONE;
550 mVkBufferFormatIsPacked = false;
551 mVertexLoadFunction = nullptr;
552 mVertexLoadRequiresConversion = true;
553 break;
554
555 case angle::FormatID::BC1_RGBA_UNORM_BLOCK:
556 mIntendedGLFormat = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
557 mActualSampleOnlyImageFormatID = angle::FormatID::BC1_RGBA_UNORM_BLOCK;
558 mImageInitializerFunction = nullptr;
559 mActualBufferFormatID = angle::FormatID::BC1_RGBA_UNORM_BLOCK;
560 mVkBufferFormatIsPacked = false;
561 mVertexLoadFunction = nullptr;
562 mVertexLoadRequiresConversion = false;
563 break;
564
565 case angle::FormatID::BC1_RGBA_UNORM_SRGB_BLOCK:
566 mIntendedGLFormat = GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;
567 mActualSampleOnlyImageFormatID = angle::FormatID::BC1_RGBA_UNORM_SRGB_BLOCK;
568 mImageInitializerFunction = nullptr;
569 mActualBufferFormatID = angle::FormatID::BC1_RGBA_UNORM_SRGB_BLOCK;
570 mVkBufferFormatIsPacked = false;
571 mVertexLoadFunction = nullptr;
572 mVertexLoadRequiresConversion = false;
573 break;
574
575 case angle::FormatID::BC1_RGB_UNORM_BLOCK:
576 mIntendedGLFormat = GL_COMPRESSED_RGB_S3TC_DXT1_EXT;
577 mActualSampleOnlyImageFormatID = angle::FormatID::BC1_RGB_UNORM_BLOCK;
578 mImageInitializerFunction = nullptr;
579 mActualBufferFormatID = angle::FormatID::BC1_RGB_UNORM_BLOCK;
580 mVkBufferFormatIsPacked = false;
581 mVertexLoadFunction = nullptr;
582 mVertexLoadRequiresConversion = false;
583 break;
584
585 case angle::FormatID::BC1_RGB_UNORM_SRGB_BLOCK:
586 mIntendedGLFormat = GL_COMPRESSED_SRGB_S3TC_DXT1_EXT;
587 mActualSampleOnlyImageFormatID = angle::FormatID::BC1_RGB_UNORM_SRGB_BLOCK;
588 mImageInitializerFunction = nullptr;
589 mActualBufferFormatID = angle::FormatID::BC1_RGB_UNORM_SRGB_BLOCK;
590 mVkBufferFormatIsPacked = false;
591 mVertexLoadFunction = nullptr;
592 mVertexLoadRequiresConversion = false;
593 break;
594
595 case angle::FormatID::BC2_RGBA_UNORM_BLOCK:
596 mIntendedGLFormat = GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE;
597 mActualSampleOnlyImageFormatID = angle::FormatID::BC2_RGBA_UNORM_BLOCK;
598 mImageInitializerFunction = nullptr;
599 mActualBufferFormatID = angle::FormatID::BC2_RGBA_UNORM_BLOCK;
600 mVkBufferFormatIsPacked = false;
601 mVertexLoadFunction = nullptr;
602 mVertexLoadRequiresConversion = false;
603 break;
604
605 case angle::FormatID::BC2_RGBA_UNORM_SRGB_BLOCK:
606 mIntendedGLFormat = GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;
607 mActualSampleOnlyImageFormatID = angle::FormatID::BC2_RGBA_UNORM_SRGB_BLOCK;
608 mImageInitializerFunction = nullptr;
609 mActualBufferFormatID = angle::FormatID::BC2_RGBA_UNORM_SRGB_BLOCK;
610 mVkBufferFormatIsPacked = false;
611 mVertexLoadFunction = nullptr;
612 mVertexLoadRequiresConversion = false;
613 break;
614
615 case angle::FormatID::BC3_RGBA_UNORM_BLOCK:
616 mIntendedGLFormat = GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE;
617 mActualSampleOnlyImageFormatID = angle::FormatID::BC3_RGBA_UNORM_BLOCK;
618 mImageInitializerFunction = nullptr;
619 mActualBufferFormatID = angle::FormatID::BC3_RGBA_UNORM_BLOCK;
620 mVkBufferFormatIsPacked = false;
621 mVertexLoadFunction = nullptr;
622 mVertexLoadRequiresConversion = false;
623 break;
624
625 case angle::FormatID::BC3_RGBA_UNORM_SRGB_BLOCK:
626 mIntendedGLFormat = GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT;
627 mActualSampleOnlyImageFormatID = angle::FormatID::BC3_RGBA_UNORM_SRGB_BLOCK;
628 mImageInitializerFunction = nullptr;
629 mActualBufferFormatID = angle::FormatID::BC3_RGBA_UNORM_SRGB_BLOCK;
630 mVkBufferFormatIsPacked = false;
631 mVertexLoadFunction = nullptr;
632 mVertexLoadRequiresConversion = false;
633 break;
634
635 case angle::FormatID::BC4_RED_SNORM_BLOCK:
636 mIntendedGLFormat = GL_COMPRESSED_SIGNED_RED_RGTC1_EXT;
637 mActualSampleOnlyImageFormatID = angle::FormatID::BC4_RED_SNORM_BLOCK;
638 mImageInitializerFunction = nullptr;
639 mActualBufferFormatID = angle::FormatID::BC4_RED_SNORM_BLOCK;
640 mVkBufferFormatIsPacked = false;
641 mVertexLoadFunction = nullptr;
642 mVertexLoadRequiresConversion = false;
643 break;
644
645 case angle::FormatID::BC4_RED_UNORM_BLOCK:
646 mIntendedGLFormat = GL_COMPRESSED_RED_RGTC1_EXT;
647 mActualSampleOnlyImageFormatID = angle::FormatID::BC4_RED_UNORM_BLOCK;
648 mImageInitializerFunction = nullptr;
649 mActualBufferFormatID = angle::FormatID::BC4_RED_UNORM_BLOCK;
650 mVkBufferFormatIsPacked = false;
651 mVertexLoadFunction = nullptr;
652 mVertexLoadRequiresConversion = false;
653 break;
654
655 case angle::FormatID::BC5_RG_SNORM_BLOCK:
656 mIntendedGLFormat = GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT;
657 mActualSampleOnlyImageFormatID = angle::FormatID::BC5_RG_SNORM_BLOCK;
658 mImageInitializerFunction = nullptr;
659 mActualBufferFormatID = angle::FormatID::BC5_RG_SNORM_BLOCK;
660 mVkBufferFormatIsPacked = false;
661 mVertexLoadFunction = nullptr;
662 mVertexLoadRequiresConversion = false;
663 break;
664
665 case angle::FormatID::BC5_RG_UNORM_BLOCK:
666 mIntendedGLFormat = GL_COMPRESSED_RED_GREEN_RGTC2_EXT;
667 mActualSampleOnlyImageFormatID = angle::FormatID::BC5_RG_UNORM_BLOCK;
668 mImageInitializerFunction = nullptr;
669 mActualBufferFormatID = angle::FormatID::BC5_RG_UNORM_BLOCK;
670 mVkBufferFormatIsPacked = false;
671 mVertexLoadFunction = nullptr;
672 mVertexLoadRequiresConversion = false;
673 break;
674
675 case angle::FormatID::BC6H_RGB_SFLOAT_BLOCK:
676 mIntendedGLFormat = GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;
677 mActualSampleOnlyImageFormatID = angle::FormatID::BC6H_RGB_SFLOAT_BLOCK;
678 mImageInitializerFunction = nullptr;
679 mActualBufferFormatID = angle::FormatID::BC6H_RGB_SFLOAT_BLOCK;
680 mVkBufferFormatIsPacked = false;
681 mVertexLoadFunction = nullptr;
682 mVertexLoadRequiresConversion = false;
683 break;
684
685 case angle::FormatID::BC6H_RGB_UFLOAT_BLOCK:
686 mIntendedGLFormat = GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT;
687 mActualSampleOnlyImageFormatID = angle::FormatID::BC6H_RGB_UFLOAT_BLOCK;
688 mImageInitializerFunction = nullptr;
689 mActualBufferFormatID = angle::FormatID::BC6H_RGB_UFLOAT_BLOCK;
690 mVkBufferFormatIsPacked = false;
691 mVertexLoadFunction = nullptr;
692 mVertexLoadRequiresConversion = false;
693 break;
694
695 case angle::FormatID::BC7_RGBA_UNORM_BLOCK:
696 mIntendedGLFormat = GL_COMPRESSED_RGBA_BPTC_UNORM_EXT;
697 mActualSampleOnlyImageFormatID = angle::FormatID::BC7_RGBA_UNORM_BLOCK;
698 mImageInitializerFunction = nullptr;
699 mActualBufferFormatID = angle::FormatID::BC7_RGBA_UNORM_BLOCK;
700 mVkBufferFormatIsPacked = false;
701 mVertexLoadFunction = nullptr;
702 mVertexLoadRequiresConversion = false;
703 break;
704
705 case angle::FormatID::BC7_RGBA_UNORM_SRGB_BLOCK:
706 mIntendedGLFormat = GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT;
707 mActualSampleOnlyImageFormatID = angle::FormatID::BC7_RGBA_UNORM_SRGB_BLOCK;
708 mImageInitializerFunction = nullptr;
709 mActualBufferFormatID = angle::FormatID::BC7_RGBA_UNORM_SRGB_BLOCK;
710 mVkBufferFormatIsPacked = false;
711 mVertexLoadFunction = nullptr;
712 mVertexLoadRequiresConversion = false;
713 break;
714
715 case angle::FormatID::D16_UNORM:
716 mIntendedGLFormat = GL_DEPTH_COMPONENT16;
717 mActualSampleOnlyImageFormatID = angle::FormatID::D16_UNORM;
718 mImageInitializerFunction = nullptr;
719 mActualBufferFormatID = angle::FormatID::D16_UNORM;
720 mVkBufferFormatIsPacked = false;
721 mVertexLoadFunction = nullptr;
722 mVertexLoadRequiresConversion = false;
723 break;
724
725 case angle::FormatID::D24_UNORM_S8_UINT:
726 mIntendedGLFormat = GL_DEPTH24_STENCIL8;
727 {
728 static constexpr ImageFormatInitInfo kInfo[] = {
729 {angle::FormatID::D24_UNORM_S8_UINT, nullptr},
730 {angle::FormatID::D32_FLOAT_S8X24_UINT, nullptr},
731 {angle::FormatID::D24_UNORM_S8_UINT, nullptr}};
732 initImageFallback(renderer, kInfo, ArraySize(kInfo));
733 }
734 mActualBufferFormatID = angle::FormatID::D24_UNORM_S8_UINT;
735 mVkBufferFormatIsPacked = false;
736 mVertexLoadFunction = nullptr;
737 mVertexLoadRequiresConversion = false;
738 break;
739
740 case angle::FormatID::D24_UNORM_X8_UINT:
741 mIntendedGLFormat = GL_DEPTH_COMPONENT24;
742 {
743 static constexpr ImageFormatInitInfo kInfo[] = {
744 {angle::FormatID::D24_UNORM_X8_UINT, nullptr},
745 {angle::FormatID::D24_UNORM_S8_UINT, nullptr},
746 {angle::FormatID::D32_FLOAT_S8X24_UINT, nullptr}};
747 initImageFallback(renderer, kInfo, ArraySize(kInfo));
748 }
749 mActualBufferFormatID = angle::FormatID::D24_UNORM_X8_UINT;
750 mVkBufferFormatIsPacked = true;
751 mVertexLoadFunction = CopyNativeVertexData<GLuint, 1, 1, 0>;
752 mVertexLoadRequiresConversion = false;
753 break;
754
755 case angle::FormatID::D32_FLOAT:
756 mIntendedGLFormat = GL_DEPTH_COMPONENT32F;
757 mActualSampleOnlyImageFormatID = angle::FormatID::D32_FLOAT;
758 mImageInitializerFunction = nullptr;
759 mActualBufferFormatID = angle::FormatID::D32_FLOAT;
760 mVkBufferFormatIsPacked = false;
761 mVertexLoadFunction = CopyNativeVertexData<GLfloat, 1, 1, 0>;
762 mVertexLoadRequiresConversion = false;
763 break;
764
765 case angle::FormatID::D32_FLOAT_S8X24_UINT:
766 mIntendedGLFormat = GL_DEPTH32F_STENCIL8;
767 {
768 static constexpr ImageFormatInitInfo kInfo[] = {
769 {angle::FormatID::D32_FLOAT_S8X24_UINT, nullptr},
770 {angle::FormatID::D24_UNORM_S8_UINT, nullptr},
771 {angle::FormatID::D32_FLOAT_S8X24_UINT, nullptr}};
772 initImageFallback(renderer, kInfo, ArraySize(kInfo));
773 }
774 mActualBufferFormatID = angle::FormatID::D32_FLOAT_S8X24_UINT;
775 mVkBufferFormatIsPacked = false;
776 mVertexLoadFunction = CopyNativeVertexData<GLfloat, 3, 3, 0>;
777 mVertexLoadRequiresConversion = false;
778 break;
779
780 case angle::FormatID::D32_UNORM:
781 mIntendedGLFormat = GL_DEPTH_COMPONENT32_OES;
782 {
783 static constexpr ImageFormatInitInfo kInfo[] = {
784 {angle::FormatID::D24_UNORM_S8_UINT, nullptr},
785 {angle::FormatID::D32_FLOAT, nullptr}};
786 initImageFallback(renderer, kInfo, ArraySize(kInfo));
787 }
788 mActualBufferFormatID = angle::FormatID::NONE;
789 mVkBufferFormatIsPacked = false;
790 mVertexLoadFunction = nullptr;
791 mVertexLoadRequiresConversion = true;
792 break;
793
794 case angle::FormatID::EAC_R11G11_SNORM_BLOCK:
795 mIntendedGLFormat = GL_COMPRESSED_SIGNED_RG11_EAC;
796 {
797 static constexpr ImageFormatInitInfo kInfo[] = {
798 {angle::FormatID::EAC_R11G11_SNORM_BLOCK, nullptr},
799 {angle::FormatID::R16G16_SNORM, nullptr},
800 {angle::FormatID::R16G16_FLOAT, nullptr}};
801 initImageFallback(renderer, kInfo, ArraySize(kInfo));
802 }
803 mActualBufferFormatID = angle::FormatID::EAC_R11G11_SNORM_BLOCK;
804 mVkBufferFormatIsPacked = false;
805 mVertexLoadFunction = nullptr;
806 mVertexLoadRequiresConversion = false;
807 break;
808
809 case angle::FormatID::EAC_R11G11_UNORM_BLOCK:
810 mIntendedGLFormat = GL_COMPRESSED_RG11_EAC;
811 {
812 static constexpr ImageFormatInitInfo kInfo[] = {
813 {angle::FormatID::EAC_R11G11_UNORM_BLOCK, nullptr},
814 {angle::FormatID::R16G16_UNORM, nullptr},
815 {angle::FormatID::R16G16_FLOAT, nullptr}};
816 initImageFallback(renderer, kInfo, ArraySize(kInfo));
817 }
818 mActualBufferFormatID = angle::FormatID::EAC_R11G11_UNORM_BLOCK;
819 mVkBufferFormatIsPacked = false;
820 mVertexLoadFunction = nullptr;
821 mVertexLoadRequiresConversion = false;
822 break;
823
824 case angle::FormatID::EAC_R11_SNORM_BLOCK:
825 mIntendedGLFormat = GL_COMPRESSED_SIGNED_R11_EAC;
826 {
827 static constexpr ImageFormatInitInfo kInfo[] = {
828 {angle::FormatID::EAC_R11_SNORM_BLOCK, nullptr},
829 {angle::FormatID::R16_SNORM, nullptr},
830 {angle::FormatID::R16_FLOAT, nullptr}};
831 initImageFallback(renderer, kInfo, ArraySize(kInfo));
832 }
833 mActualBufferFormatID = angle::FormatID::EAC_R11_SNORM_BLOCK;
834 mVkBufferFormatIsPacked = false;
835 mVertexLoadFunction = nullptr;
836 mVertexLoadRequiresConversion = false;
837 break;
838
839 case angle::FormatID::EAC_R11_UNORM_BLOCK:
840 mIntendedGLFormat = GL_COMPRESSED_R11_EAC;
841 {
842 static constexpr ImageFormatInitInfo kInfo[] = {
843 {angle::FormatID::EAC_R11_UNORM_BLOCK, nullptr},
844 {angle::FormatID::R16_UNORM, nullptr},
845 {angle::FormatID::R16_FLOAT, nullptr}};
846 initImageFallback(renderer, kInfo, ArraySize(kInfo));
847 }
848 mActualBufferFormatID = angle::FormatID::EAC_R11_UNORM_BLOCK;
849 mVkBufferFormatIsPacked = false;
850 mVertexLoadFunction = nullptr;
851 mVertexLoadRequiresConversion = false;
852 break;
853
854 case angle::FormatID::ETC1_LOSSY_DECODE_R8G8B8_UNORM_BLOCK:
855 // This format is not implemented in Vulkan.
856 break;
857
858 case angle::FormatID::ETC1_R8G8B8_UNORM_BLOCK:
859 mIntendedGLFormat = GL_ETC1_RGB8_OES;
860 {
861 static constexpr ImageFormatInitInfo kInfo[] = {
862 {angle::FormatID::ETC2_R8G8B8_UNORM_BLOCK, nullptr},
863 {angle::FormatID::R8G8B8A8_UNORM,
864 Initialize4ComponentData<GLubyte, 0x00, 0x00, 0x00, 0xFF>}};
865 initImageFallback(renderer, kInfo, ArraySize(kInfo));
866 }
867 mActualBufferFormatID = angle::FormatID::NONE;
868 mVkBufferFormatIsPacked = false;
869 mVertexLoadFunction = nullptr;
870 mVertexLoadRequiresConversion = true;
871 break;
872
873 case angle::FormatID::ETC2_R8G8B8A1_SRGB_BLOCK:
874 mIntendedGLFormat = GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2;
875 {
876 static constexpr ImageFormatInitInfo kInfo[] = {
877 {angle::FormatID::ETC2_R8G8B8A1_SRGB_BLOCK, nullptr},
878 {angle::FormatID::R8G8B8A8_UNORM_SRGB, nullptr}};
879 initImageFallback(renderer, kInfo, ArraySize(kInfo));
880 }
881 mActualBufferFormatID = angle::FormatID::ETC2_R8G8B8A1_SRGB_BLOCK;
882 mVkBufferFormatIsPacked = false;
883 mVertexLoadFunction = CopyNativeVertexData<GLbyte, 4, 4, 0>;
884 mVertexLoadRequiresConversion = false;
885 break;
886
887 case angle::FormatID::ETC2_R8G8B8A1_UNORM_BLOCK:
888 mIntendedGLFormat = GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2;
889 {
890 static constexpr ImageFormatInitInfo kInfo[] = {
891 {angle::FormatID::ETC2_R8G8B8A1_UNORM_BLOCK,
892 Initialize4ComponentData<GLubyte, 0x00, 0x00, 0x00, 0xFF>},
893 {angle::FormatID::R8G8B8A8_UNORM,
894 Initialize4ComponentData<GLubyte, 0x00, 0x00, 0x00, 0xFF>}};
895 initImageFallback(renderer, kInfo, ArraySize(kInfo));
896 }
897 mActualBufferFormatID = angle::FormatID::ETC2_R8G8B8A1_UNORM_BLOCK;
898 mVkBufferFormatIsPacked = false;
899 mVertexLoadFunction = CopyNativeVertexData<GLubyte, 4, 4, 0>;
900 mVertexLoadRequiresConversion = false;
901 break;
902
903 case angle::FormatID::ETC2_R8G8B8A8_SRGB_BLOCK:
904 mIntendedGLFormat = GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC;
905 {
906 static constexpr ImageFormatInitInfo kInfo[] = {
907 {angle::FormatID::ETC2_R8G8B8A8_SRGB_BLOCK, nullptr},
908 {angle::FormatID::R8G8B8A8_UNORM_SRGB, nullptr}};
909 initImageFallback(renderer, kInfo, ArraySize(kInfo));
910 }
911 mActualBufferFormatID = angle::FormatID::ETC2_R8G8B8A8_SRGB_BLOCK;
912 mVkBufferFormatIsPacked = false;
913 mVertexLoadFunction = CopyNativeVertexData<GLbyte, 4, 4, 0>;
914 mVertexLoadRequiresConversion = false;
915 break;
916
917 case angle::FormatID::ETC2_R8G8B8A8_UNORM_BLOCK:
918 mIntendedGLFormat = GL_COMPRESSED_RGBA8_ETC2_EAC;
919 {
920 static constexpr ImageFormatInitInfo kInfo[] = {
921 {angle::FormatID::ETC2_R8G8B8A8_UNORM_BLOCK, nullptr},
922 {angle::FormatID::R8G8B8A8_UNORM, nullptr}};
923 initImageFallback(renderer, kInfo, ArraySize(kInfo));
924 }
925 mActualBufferFormatID = angle::FormatID::ETC2_R8G8B8A8_UNORM_BLOCK;
926 mVkBufferFormatIsPacked = false;
927 mVertexLoadFunction = CopyNativeVertexData<GLubyte, 4, 4, 0>;
928 mVertexLoadRequiresConversion = false;
929 break;
930
931 case angle::FormatID::ETC2_R8G8B8_SRGB_BLOCK:
932 mIntendedGLFormat = GL_COMPRESSED_SRGB8_ETC2;
933 {
934 static constexpr ImageFormatInitInfo kInfo[] = {
935 {angle::FormatID::ETC2_R8G8B8_SRGB_BLOCK, nullptr},
936 {angle::FormatID::R8G8B8A8_UNORM_SRGB,
937 Initialize4ComponentData<GLubyte, 0x00, 0x00, 0x00, 0xFF>}};
938 initImageFallback(renderer, kInfo, ArraySize(kInfo));
939 }
940 mActualBufferFormatID = angle::FormatID::ETC2_R8G8B8_SRGB_BLOCK;
941 mVkBufferFormatIsPacked = false;
942 mVertexLoadFunction = CopyNativeVertexData<GLbyte, 3, 3, 0>;
943 mVertexLoadRequiresConversion = false;
944 break;
945
946 case angle::FormatID::ETC2_R8G8B8_UNORM_BLOCK:
947 mIntendedGLFormat = GL_COMPRESSED_RGB8_ETC2;
948 {
949 static constexpr ImageFormatInitInfo kInfo[] = {
950 {angle::FormatID::ETC2_R8G8B8_UNORM_BLOCK, nullptr},
951 {angle::FormatID::R8G8B8A8_UNORM,
952 Initialize4ComponentData<GLubyte, 0x00, 0x00, 0x00, 0xFF>}};
953 initImageFallback(renderer, kInfo, ArraySize(kInfo));
954 }
955 mActualBufferFormatID = angle::FormatID::ETC2_R8G8B8_UNORM_BLOCK;
956 mVkBufferFormatIsPacked = false;
957 mVertexLoadFunction = CopyNativeVertexData<GLubyte, 3, 3, 0>;
958 mVertexLoadRequiresConversion = false;
959 break;
960
961 case angle::FormatID::G8_B8R8_2PLANE_420_UNORM:
962 mIntendedGLFormat = GL_G8_B8R8_2PLANE_420_UNORM_ANGLE;
963 mActualSampleOnlyImageFormatID = angle::FormatID::G8_B8R8_2PLANE_420_UNORM;
964 mImageInitializerFunction = nullptr;
965 mActualBufferFormatID = angle::FormatID::G8_B8R8_2PLANE_420_UNORM;
966 mVkBufferFormatIsPacked = false;
967 mVertexLoadFunction = CopyNativeVertexData<GLubyte, 3, 3, 0>;
968 mVertexLoadRequiresConversion = false;
969 break;
970
971 case angle::FormatID::G8_B8_R8_3PLANE_420_UNORM:
972 mIntendedGLFormat = GL_G8_B8_R8_3PLANE_420_UNORM_ANGLE;
973 mActualSampleOnlyImageFormatID = angle::FormatID::G8_B8_R8_3PLANE_420_UNORM;
974 mImageInitializerFunction = nullptr;
975 mActualBufferFormatID = angle::FormatID::G8_B8_R8_3PLANE_420_UNORM;
976 mVkBufferFormatIsPacked = false;
977 mVertexLoadFunction = CopyNativeVertexData<GLubyte, 3, 3, 0>;
978 mVertexLoadRequiresConversion = false;
979 break;
980
981 case angle::FormatID::L16A16_FLOAT:
982 mIntendedGLFormat = GL_LUMINANCE_ALPHA16F_EXT;
983 mActualSampleOnlyImageFormatID = angle::FormatID::R16G16_FLOAT;
984 mImageInitializerFunction = nullptr;
985
986 break;
987
988 case angle::FormatID::L16_FLOAT:
989 mIntendedGLFormat = GL_LUMINANCE16F_EXT;
990 mActualSampleOnlyImageFormatID = angle::FormatID::R16_FLOAT;
991 mImageInitializerFunction = nullptr;
992
993 break;
994
995 case angle::FormatID::L32A32_FLOAT:
996 mIntendedGLFormat = GL_LUMINANCE_ALPHA32F_EXT;
997 mActualSampleOnlyImageFormatID = angle::FormatID::R32G32_FLOAT;
998 mImageInitializerFunction = nullptr;
999
1000 break;
1001
1002 case angle::FormatID::L32_FLOAT:
1003 mIntendedGLFormat = GL_LUMINANCE32F_EXT;
1004 mActualSampleOnlyImageFormatID = angle::FormatID::R32_FLOAT;
1005 mImageInitializerFunction = nullptr;
1006
1007 break;
1008
1009 case angle::FormatID::L8A8_UNORM:
1010 mIntendedGLFormat = GL_LUMINANCE8_ALPHA8_EXT;
1011 mActualSampleOnlyImageFormatID = angle::FormatID::R8G8_UNORM;
1012 mImageInitializerFunction = nullptr;
1013
1014 break;
1015
1016 case angle::FormatID::L8_UNORM:
1017 mIntendedGLFormat = GL_LUMINANCE8_EXT;
1018 mActualSampleOnlyImageFormatID = angle::FormatID::R8_UNORM;
1019 mImageInitializerFunction = nullptr;
1020
1021 break;
1022
1023 case angle::FormatID::NONE:
1024 mIntendedGLFormat = GL_NONE;
1025 mActualSampleOnlyImageFormatID = angle::FormatID::NONE;
1026 mImageInitializerFunction = nullptr;
1027 mActualBufferFormatID = angle::FormatID::NONE;
1028 mVkBufferFormatIsPacked = false;
1029 mVertexLoadFunction = nullptr;
1030 mVertexLoadRequiresConversion = false;
1031 break;
1032
1033 case angle::FormatID::PVRTC1_RGBA_2BPP_UNORM_BLOCK:
1034 // This format is not implemented in Vulkan.
1035 break;
1036
1037 case angle::FormatID::PVRTC1_RGBA_2BPP_UNORM_SRGB_BLOCK:
1038 // This format is not implemented in Vulkan.
1039 break;
1040
1041 case angle::FormatID::PVRTC1_RGBA_4BPP_UNORM_BLOCK:
1042 // This format is not implemented in Vulkan.
1043 break;
1044
1045 case angle::FormatID::PVRTC1_RGBA_4BPP_UNORM_SRGB_BLOCK:
1046 // This format is not implemented in Vulkan.
1047 break;
1048
1049 case angle::FormatID::PVRTC1_RGB_2BPP_UNORM_BLOCK:
1050 // This format is not implemented in Vulkan.
1051 break;
1052
1053 case angle::FormatID::PVRTC1_RGB_2BPP_UNORM_SRGB_BLOCK:
1054 // This format is not implemented in Vulkan.
1055 break;
1056
1057 case angle::FormatID::PVRTC1_RGB_4BPP_UNORM_BLOCK:
1058 // This format is not implemented in Vulkan.
1059 break;
1060
1061 case angle::FormatID::PVRTC1_RGB_4BPP_UNORM_SRGB_BLOCK:
1062 // This format is not implemented in Vulkan.
1063 break;
1064
1065 case angle::FormatID::R10G10B10A2_SINT:
1066 mIntendedGLFormat = GL_RGB10_A2_SINT_ANGLEX;
1067 mActualSampleOnlyImageFormatID = angle::FormatID::R10G10B10A2_SINT;
1068 mImageInitializerFunction = nullptr;
1069 {
1070 static constexpr BufferFormatInitInfo kInfo[] = {
1071 {angle::FormatID::R10G10B10A2_SINT, true, CopyNativeVertexData<GLuint, 1, 1, 0>,
1072 false},
1073 {angle::FormatID::R16G16B16A16_SINT, false,
1074 CopyXYZ10W2ToXYZWFloatVertexData<true, false, false, false>, true}};
1075 initBufferFallback(renderer, kInfo, ArraySize(kInfo), 2);
1076 }
1077 break;
1078
1079 case angle::FormatID::R10G10B10A2_SNORM:
1080 mIntendedGLFormat = GL_RGB10_A2_SNORM_ANGLEX;
1081 mActualSampleOnlyImageFormatID = angle::FormatID::R10G10B10A2_SNORM;
1082 mImageInitializerFunction = nullptr;
1083 {
1084 static constexpr BufferFormatInitInfo kInfo[] = {
1085 {angle::FormatID::R10G10B10A2_SNORM, true,
1086 CopyNativeVertexData<GLuint, 1, 1, 0>, false},
1087 {angle::FormatID::R16G16B16A16_FLOAT, false,
1088 CopyXYZ10W2ToXYZWFloatVertexData<true, true, true, true>, true}};
1089 initBufferFallback(renderer, kInfo, ArraySize(kInfo), 2);
1090 }
1091 break;
1092
1093 case angle::FormatID::R10G10B10A2_SSCALED:
1094 mIntendedGLFormat = GL_RGB10_A2_SSCALED_ANGLEX;
1095 mActualSampleOnlyImageFormatID = angle::FormatID::R10G10B10A2_SSCALED;
1096 mImageInitializerFunction = nullptr;
1097 {
1098 static constexpr BufferFormatInitInfo kInfo[] = {
1099 {angle::FormatID::R10G10B10A2_SSCALED, true,
1100 CopyNativeVertexData<GLuint, 1, 1, 0>, false},
1101 {angle::FormatID::R16G16B16A16_FLOAT, false,
1102 CopyXYZ10W2ToXYZWFloatVertexData<true, false, true, true>, true}};
1103 initBufferFallback(renderer, kInfo, ArraySize(kInfo), 2);
1104 }
1105 break;
1106
1107 case angle::FormatID::R10G10B10A2_UINT:
1108 mIntendedGLFormat = GL_RGB10_A2UI;
1109 mActualSampleOnlyImageFormatID = angle::FormatID::R10G10B10A2_UINT;
1110 mImageInitializerFunction = nullptr;
1111 {
1112 static constexpr BufferFormatInitInfo kInfo[] = {
1113 {angle::FormatID::R10G10B10A2_UINT, true, CopyNativeVertexData<GLuint, 1, 1, 0>,
1114 false},
1115 {angle::FormatID::R16G16B16A16_UINT, false,
1116 CopyXYZ10W2ToXYZWFloatVertexData<false, false, false, false>, true}};
1117 initBufferFallback(renderer, kInfo, ArraySize(kInfo), 2);
1118 }
1119 break;
1120
1121 case angle::FormatID::R10G10B10A2_UNORM:
1122 mIntendedGLFormat = GL_RGB10_A2;
1123 mActualSampleOnlyImageFormatID = angle::FormatID::R10G10B10A2_UNORM;
1124 mImageInitializerFunction = nullptr;
1125 mActualBufferFormatID = angle::FormatID::R10G10B10A2_UNORM;
1126 mVkBufferFormatIsPacked = true;
1127 mVertexLoadFunction = CopyNativeVertexData<GLuint, 1, 1, 0>;
1128 mVertexLoadRequiresConversion = false;
1129 break;
1130
1131 case angle::FormatID::R10G10B10A2_USCALED:
1132 mIntendedGLFormat = GL_RGB10_A2_USCALED_ANGLEX;
1133 mActualSampleOnlyImageFormatID = angle::FormatID::R10G10B10A2_USCALED;
1134 mImageInitializerFunction = nullptr;
1135 {
1136 static constexpr BufferFormatInitInfo kInfo[] = {
1137 {angle::FormatID::R10G10B10A2_USCALED, true,
1138 CopyNativeVertexData<GLuint, 1, 1, 0>, false},
1139 {angle::FormatID::R16G16B16A16_FLOAT, false,
1140 CopyXYZ10W2ToXYZWFloatVertexData<false, false, true, true>, true}};
1141 initBufferFallback(renderer, kInfo, ArraySize(kInfo), 2);
1142 }
1143 break;
1144
1145 case angle::FormatID::R10G10B10X2_UNORM:
1146 mIntendedGLFormat = GL_RGB10_UNORM_ANGLEX;
1147 mActualSampleOnlyImageFormatID = angle::FormatID::R10G10B10A2_UNORM;
1148 mImageInitializerFunction = nullptr;
1149 mActualBufferFormatID = angle::FormatID::NONE;
1150 mVkBufferFormatIsPacked = false;
1151 mVertexLoadFunction = nullptr;
1152 mVertexLoadRequiresConversion = true;
1153 break;
1154
1155 case angle::FormatID::R11G11B10_FLOAT:
1156 mIntendedGLFormat = GL_R11F_G11F_B10F;
1157 mActualSampleOnlyImageFormatID = angle::FormatID::R11G11B10_FLOAT;
1158 mImageInitializerFunction = nullptr;
1159 mActualBufferFormatID = angle::FormatID::R11G11B10_FLOAT;
1160 mVkBufferFormatIsPacked = true;
1161 mVertexLoadFunction = CopyNativeVertexData<GLuint, 1, 1, 0>;
1162 mVertexLoadRequiresConversion = false;
1163 break;
1164
1165 case angle::FormatID::R16G16B16A16_FLOAT:
1166 mIntendedGLFormat = GL_RGBA16F;
1167 mActualSampleOnlyImageFormatID = angle::FormatID::R16G16B16A16_FLOAT;
1168 mImageInitializerFunction = nullptr;
1169 mActualBufferFormatID = angle::FormatID::R16G16B16A16_FLOAT;
1170 mVkBufferFormatIsPacked = false;
1171 mVertexLoadFunction = CopyNativeVertexData<GLhalf, 4, 4, 0>;
1172 mVertexLoadRequiresConversion = false;
1173 break;
1174
1175 case angle::FormatID::R16G16B16A16_SINT:
1176 mIntendedGLFormat = GL_RGBA16I;
1177 mActualSampleOnlyImageFormatID = angle::FormatID::R16G16B16A16_SINT;
1178 mImageInitializerFunction = nullptr;
1179 mActualBufferFormatID = angle::FormatID::R16G16B16A16_SINT;
1180 mVkBufferFormatIsPacked = false;
1181 mVertexLoadFunction = CopyNativeVertexData<GLshort, 4, 4, 0>;
1182 mVertexLoadRequiresConversion = false;
1183 break;
1184
1185 case angle::FormatID::R16G16B16A16_SNORM:
1186 mIntendedGLFormat = GL_RGBA16_SNORM_EXT;
1187 mActualSampleOnlyImageFormatID = angle::FormatID::R16G16B16A16_SNORM;
1188 mImageInitializerFunction = nullptr;
1189 mActualBufferFormatID = angle::FormatID::R16G16B16A16_SNORM;
1190 mVkBufferFormatIsPacked = false;
1191 mVertexLoadFunction = CopyNativeVertexData<GLshort, 4, 4, 0>;
1192 mVertexLoadRequiresConversion = false;
1193 break;
1194
1195 case angle::FormatID::R16G16B16A16_SSCALED:
1196 mIntendedGLFormat = GL_RGBA16_SSCALED_ANGLEX;
1197 mActualSampleOnlyImageFormatID = angle::FormatID::R16G16B16A16_SSCALED;
1198 mImageInitializerFunction = nullptr;
1199 {
1200 static constexpr BufferFormatInitInfo kInfo[] = {
1201 {angle::FormatID::R16G16B16A16_SSCALED, false,
1202 CopyNativeVertexData<GLshort, 4, 4, 0>, false},
1203 {angle::FormatID::R32G32B32A32_FLOAT, false,
1204 CopyToFloatVertexData<GLshort, 4, 4, false, false>, true},
1205 {angle::FormatID::R16G16B16A16_FLOAT, false,
1206 CopyToFloatVertexData<GLshort, 4, 4, false, true>, true}};
1207 initBufferFallback(renderer, kInfo, ArraySize(kInfo), 2);
1208 }
1209 break;
1210
1211 case angle::FormatID::R16G16B16A16_UINT:
1212 mIntendedGLFormat = GL_RGBA16UI;
1213 mActualSampleOnlyImageFormatID = angle::FormatID::R16G16B16A16_UINT;
1214 mImageInitializerFunction = nullptr;
1215 mActualBufferFormatID = angle::FormatID::R16G16B16A16_UINT;
1216 mVkBufferFormatIsPacked = false;
1217 mVertexLoadFunction = CopyNativeVertexData<GLushort, 4, 4, 0>;
1218 mVertexLoadRequiresConversion = false;
1219 break;
1220
1221 case angle::FormatID::R16G16B16A16_UNORM:
1222 mIntendedGLFormat = GL_RGBA16_EXT;
1223 mActualSampleOnlyImageFormatID = angle::FormatID::R16G16B16A16_UNORM;
1224 mImageInitializerFunction = nullptr;
1225 mActualBufferFormatID = angle::FormatID::R16G16B16A16_UNORM;
1226 mVkBufferFormatIsPacked = false;
1227 mVertexLoadFunction = CopyNativeVertexData<GLushort, 4, 4, 0>;
1228 mVertexLoadRequiresConversion = false;
1229 break;
1230
1231 case angle::FormatID::R16G16B16A16_USCALED:
1232 mIntendedGLFormat = GL_RGBA16_USCALED_ANGLEX;
1233 mActualSampleOnlyImageFormatID = angle::FormatID::R16G16B16A16_USCALED;
1234 mImageInitializerFunction = nullptr;
1235 {
1236 static constexpr BufferFormatInitInfo kInfo[] = {
1237 {angle::FormatID::R16G16B16A16_USCALED, false,
1238 CopyNativeVertexData<GLushort, 4, 4, 0>, false},
1239 {angle::FormatID::R32G32B32A32_FLOAT, false,
1240 CopyToFloatVertexData<GLushort, 4, 4, false, false>, true},
1241 {angle::FormatID::R16G16B16A16_FLOAT, false,
1242 CopyToFloatVertexData<GLushort, 4, 4, false, true>, true}};
1243 initBufferFallback(renderer, kInfo, ArraySize(kInfo), 2);
1244 }
1245 break;
1246
1247 case angle::FormatID::R16G16B16_FLOAT:
1248 mIntendedGLFormat = GL_RGB16F;
1249 {
1250 static constexpr ImageFormatInitInfo kInfo[] = {
1251 {angle::FormatID::R16G16B16_FLOAT, nullptr},
1252 {angle::FormatID::R16G16B16A16_FLOAT,
1253 Initialize4ComponentData<GLhalf, 0x0000, 0x0000, 0x0000, gl::Float16One>}};
1254 initImageFallback(renderer, kInfo, ArraySize(kInfo));
1255 }
1256 {
1257 static constexpr BufferFormatInitInfo kInfo[] = {
1258 {angle::FormatID::R16G16B16_FLOAT, false, CopyNativeVertexData<GLhalf, 3, 3, 0>,
1259 false},
1260 {angle::FormatID::R16G16B16A16_FLOAT, false,
1261 CopyNativeVertexData<GLhalf, 3, 4, gl::Float16One>, true}};
1262 initBufferFallback(renderer, kInfo, ArraySize(kInfo), 2);
1263 }
1264 break;
1265
1266 case angle::FormatID::R16G16B16_SINT:
1267 mIntendedGLFormat = GL_RGB16I;
1268 {
1269 static constexpr ImageFormatInitInfo kInfo[] = {
1270 {angle::FormatID::R16G16B16_SINT, nullptr},
1271 {angle::FormatID::R16G16B16A16_SINT,
1272 Initialize4ComponentData<GLshort, 0x0000, 0x0000, 0x0000, 0x0001>}};
1273 initImageFallback(renderer, kInfo, ArraySize(kInfo));
1274 }
1275 {
1276 static constexpr BufferFormatInitInfo kInfo[] = {
1277 {angle::FormatID::R16G16B16_SINT, false, CopyNativeVertexData<GLshort, 3, 3, 0>,
1278 false},
1279 {angle::FormatID::R16G16B16A16_SINT, false,
1280 CopyNativeVertexData<GLshort, 3, 4, 1>, true}};
1281 initBufferFallback(renderer, kInfo, ArraySize(kInfo), 2);
1282 }
1283 break;
1284
1285 case angle::FormatID::R16G16B16_SNORM:
1286 mIntendedGLFormat = GL_RGB16_SNORM_EXT;
1287 mActualSampleOnlyImageFormatID = angle::FormatID::R16G16B16_SNORM;
1288 mImageInitializerFunction = nullptr;
1289 {
1290 static constexpr BufferFormatInitInfo kInfo[] = {
1291 {angle::FormatID::R16G16B16_SNORM, false,
1292 CopyNativeVertexData<GLshort, 3, 3, 0>, false},
1293 {angle::FormatID::R32G32B32_FLOAT, false,
1294 CopyToFloatVertexData<GLshort, 3, 3, true, false>, true},
1295 {angle::FormatID::R16G16B16_FLOAT, false,
1296 CopyToFloatVertexData<GLshort, 3, 3, true, true>, true},
1297 {angle::FormatID::R16G16B16A16_FLOAT, false,
1298 CopyToFloatVertexData<GLshort, 3, 4, true, true>, true}};
1299 initBufferFallback(renderer, kInfo, ArraySize(kInfo), 2);
1300 }
1301 break;
1302
1303 case angle::FormatID::R16G16B16_SSCALED:
1304 mIntendedGLFormat = GL_RGB16_SSCALED_ANGLEX;
1305 mActualSampleOnlyImageFormatID = angle::FormatID::R16G16B16_SSCALED;
1306 mImageInitializerFunction = nullptr;
1307 {
1308 static constexpr BufferFormatInitInfo kInfo[] = {
1309 {angle::FormatID::R16G16B16_SSCALED, false,
1310 CopyNativeVertexData<GLshort, 3, 3, 0>, false},
1311 {angle::FormatID::R32G32B32_FLOAT, false,
1312 CopyToFloatVertexData<GLshort, 3, 3, false, false>, true},
1313 {angle::FormatID::R16G16B16_FLOAT, false,
1314 CopyToFloatVertexData<GLshort, 3, 3, false, true>, true},
1315 {angle::FormatID::R16G16B16A16_FLOAT, false,
1316 CopyToFloatVertexData<GLshort, 3, 4, false, true>, true}};
1317 initBufferFallback(renderer, kInfo, ArraySize(kInfo), 2);
1318 }
1319 break;
1320
1321 case angle::FormatID::R16G16B16_UINT:
1322 mIntendedGLFormat = GL_RGB16UI;
1323 {
1324 static constexpr ImageFormatInitInfo kInfo[] = {
1325 {angle::FormatID::R16G16B16_UINT, nullptr},
1326 {angle::FormatID::R16G16B16A16_UINT,
1327 Initialize4ComponentData<GLushort, 0x0000, 0x0000, 0x0000, 0x0001>}};
1328 initImageFallback(renderer, kInfo, ArraySize(kInfo));
1329 }
1330 {
1331 static constexpr BufferFormatInitInfo kInfo[] = {
1332 {angle::FormatID::R16G16B16_UINT, false,
1333 CopyNativeVertexData<GLushort, 3, 3, 0>, false},
1334 {angle::FormatID::R16G16B16A16_UINT, false,
1335 CopyNativeVertexData<GLushort, 3, 4, 1>, true}};
1336 initBufferFallback(renderer, kInfo, ArraySize(kInfo), 2);
1337 }
1338 break;
1339
1340 case angle::FormatID::R16G16B16_UNORM:
1341 mIntendedGLFormat = GL_RGB16_EXT;
1342 mActualSampleOnlyImageFormatID = angle::FormatID::R16G16B16_UNORM;
1343 mImageInitializerFunction = nullptr;
1344 {
1345 static constexpr BufferFormatInitInfo kInfo[] = {
1346 {angle::FormatID::R16G16B16_UNORM, false,
1347 CopyNativeVertexData<GLushort, 3, 3, 0>, false},
1348 {angle::FormatID::R32G32B32_FLOAT, false,
1349 CopyToFloatVertexData<GLushort, 3, 3, true, false>, true},
1350 {angle::FormatID::R16G16B16_FLOAT, false,
1351 CopyToFloatVertexData<GLushort, 3, 3, true, true>, true},
1352 {angle::FormatID::R16G16B16A16_FLOAT, false,
1353 CopyToFloatVertexData<GLushort, 3, 4, true, true>, true}};
1354 initBufferFallback(renderer, kInfo, ArraySize(kInfo), 2);
1355 }
1356 break;
1357
1358 case angle::FormatID::R16G16B16_USCALED:
1359 mIntendedGLFormat = GL_RGB16_USCALED_ANGLEX;
1360 mActualSampleOnlyImageFormatID = angle::FormatID::R16G16B16_USCALED;
1361 mImageInitializerFunction = nullptr;
1362 {
1363 static constexpr BufferFormatInitInfo kInfo[] = {
1364 {angle::FormatID::R16G16B16_USCALED, false,
1365 CopyNativeVertexData<GLushort, 3, 3, 0>, false},
1366 {angle::FormatID::R32G32B32_FLOAT, false,
1367 CopyToFloatVertexData<GLushort, 3, 3, false, false>, true},
1368 {angle::FormatID::R16G16B16_FLOAT, false,
1369 CopyToFloatVertexData<GLushort, 3, 3, false, true>, true},
1370 {angle::FormatID::R16G16B16A16_FLOAT, false,
1371 CopyToFloatVertexData<GLushort, 3, 4, false, true>, true}};
1372 initBufferFallback(renderer, kInfo, ArraySize(kInfo), 2);
1373 }
1374 break;
1375
1376 case angle::FormatID::R16G16_FLOAT:
1377 mIntendedGLFormat = GL_RG16F;
1378 mActualSampleOnlyImageFormatID = angle::FormatID::R16G16_FLOAT;
1379 mImageInitializerFunction = nullptr;
1380 mActualBufferFormatID = angle::FormatID::R16G16_FLOAT;
1381 mVkBufferFormatIsPacked = false;
1382 mVertexLoadFunction = CopyNativeVertexData<GLhalf, 2, 2, 0>;
1383 mVertexLoadRequiresConversion = false;
1384 break;
1385
1386 case angle::FormatID::R16G16_SINT:
1387 mIntendedGLFormat = GL_RG16I;
1388 mActualSampleOnlyImageFormatID = angle::FormatID::R16G16_SINT;
1389 mImageInitializerFunction = nullptr;
1390 mActualBufferFormatID = angle::FormatID::R16G16_SINT;
1391 mVkBufferFormatIsPacked = false;
1392 mVertexLoadFunction = CopyNativeVertexData<GLshort, 2, 2, 0>;
1393 mVertexLoadRequiresConversion = false;
1394 break;
1395
1396 case angle::FormatID::R16G16_SNORM:
1397 mIntendedGLFormat = GL_RG16_SNORM_EXT;
1398 mActualSampleOnlyImageFormatID = angle::FormatID::R16G16_SNORM;
1399 mImageInitializerFunction = nullptr;
1400 mActualBufferFormatID = angle::FormatID::R16G16_SNORM;
1401 mVkBufferFormatIsPacked = false;
1402 mVertexLoadFunction = CopyNativeVertexData<GLshort, 2, 2, 0>;
1403 mVertexLoadRequiresConversion = false;
1404 break;
1405
1406 case angle::FormatID::R16G16_SSCALED:
1407 mIntendedGLFormat = GL_RG16_SSCALED_ANGLEX;
1408 mActualSampleOnlyImageFormatID = angle::FormatID::R16G16_SSCALED;
1409 mImageInitializerFunction = nullptr;
1410 {
1411 static constexpr BufferFormatInitInfo kInfo[] = {
1412 {angle::FormatID::R16G16_SSCALED, false, CopyNativeVertexData<GLshort, 2, 2, 0>,
1413 false},
1414 {angle::FormatID::R32G32_FLOAT, false,
1415 CopyToFloatVertexData<GLshort, 2, 2, false, false>, true},
1416 {angle::FormatID::R16G16_FLOAT, false,
1417 CopyToFloatVertexData<GLshort, 2, 2, false, true>, true}};
1418 initBufferFallback(renderer, kInfo, ArraySize(kInfo), 2);
1419 }
1420 break;
1421
1422 case angle::FormatID::R16G16_UINT:
1423 mIntendedGLFormat = GL_RG16UI;
1424 mActualSampleOnlyImageFormatID = angle::FormatID::R16G16_UINT;
1425 mImageInitializerFunction = nullptr;
1426 mActualBufferFormatID = angle::FormatID::R16G16_UINT;
1427 mVkBufferFormatIsPacked = false;
1428 mVertexLoadFunction = CopyNativeVertexData<GLushort, 2, 2, 0>;
1429 mVertexLoadRequiresConversion = false;
1430 break;
1431
1432 case angle::FormatID::R16G16_UNORM:
1433 mIntendedGLFormat = GL_RG16_EXT;
1434 mActualSampleOnlyImageFormatID = angle::FormatID::R16G16_UNORM;
1435 mImageInitializerFunction = nullptr;
1436 mActualBufferFormatID = angle::FormatID::R16G16_UNORM;
1437 mVkBufferFormatIsPacked = false;
1438 mVertexLoadFunction = CopyNativeVertexData<GLushort, 2, 2, 0>;
1439 mVertexLoadRequiresConversion = false;
1440 break;
1441
1442 case angle::FormatID::R16G16_USCALED:
1443 mIntendedGLFormat = GL_RG16_USCALED_ANGLEX;
1444 mActualSampleOnlyImageFormatID = angle::FormatID::R16G16_USCALED;
1445 mImageInitializerFunction = nullptr;
1446 {
1447 static constexpr BufferFormatInitInfo kInfo[] = {
1448 {angle::FormatID::R16G16_USCALED, false,
1449 CopyNativeVertexData<GLushort, 2, 2, 0>, false},
1450 {angle::FormatID::R32G32_FLOAT, false,
1451 CopyToFloatVertexData<GLushort, 2, 2, false, false>, true},
1452 {angle::FormatID::R16G16_FLOAT, false,
1453 CopyToFloatVertexData<GLushort, 2, 2, false, true>, true}};
1454 initBufferFallback(renderer, kInfo, ArraySize(kInfo), 2);
1455 }
1456 break;
1457
1458 case angle::FormatID::R16_FLOAT:
1459 mIntendedGLFormat = GL_R16F;
1460 mActualSampleOnlyImageFormatID = angle::FormatID::R16_FLOAT;
1461 mImageInitializerFunction = nullptr;
1462 mActualBufferFormatID = angle::FormatID::R16_FLOAT;
1463 mVkBufferFormatIsPacked = false;
1464 mVertexLoadFunction = CopyNativeVertexData<GLhalf, 1, 1, 0>;
1465 mVertexLoadRequiresConversion = false;
1466 break;
1467
1468 case angle::FormatID::R16_SINT:
1469 mIntendedGLFormat = GL_R16I;
1470 mActualSampleOnlyImageFormatID = angle::FormatID::R16_SINT;
1471 mImageInitializerFunction = nullptr;
1472 mActualBufferFormatID = angle::FormatID::R16_SINT;
1473 mVkBufferFormatIsPacked = false;
1474 mVertexLoadFunction = CopyNativeVertexData<GLshort, 1, 1, 0>;
1475 mVertexLoadRequiresConversion = false;
1476 break;
1477
1478 case angle::FormatID::R16_SNORM:
1479 mIntendedGLFormat = GL_R16_SNORM_EXT;
1480 mActualSampleOnlyImageFormatID = angle::FormatID::R16_SNORM;
1481 mImageInitializerFunction = nullptr;
1482 mActualBufferFormatID = angle::FormatID::R16_SNORM;
1483 mVkBufferFormatIsPacked = false;
1484 mVertexLoadFunction = CopyNativeVertexData<GLshort, 1, 1, 0>;
1485 mVertexLoadRequiresConversion = false;
1486 break;
1487
1488 case angle::FormatID::R16_SSCALED:
1489 mIntendedGLFormat = GL_R16_SSCALED_ANGLEX;
1490 mActualSampleOnlyImageFormatID = angle::FormatID::R16_SSCALED;
1491 mImageInitializerFunction = nullptr;
1492 {
1493 static constexpr BufferFormatInitInfo kInfo[] = {
1494 {angle::FormatID::R16_SSCALED, false, CopyNativeVertexData<GLshort, 1, 1, 0>,
1495 false},
1496 {angle::FormatID::R32_FLOAT, false,
1497 CopyToFloatVertexData<GLshort, 1, 1, false, false>, true},
1498 {angle::FormatID::R16_FLOAT, false,
1499 CopyToFloatVertexData<GLshort, 1, 1, false, true>, true}};
1500 initBufferFallback(renderer, kInfo, ArraySize(kInfo), 2);
1501 }
1502 break;
1503
1504 case angle::FormatID::R16_UINT:
1505 mIntendedGLFormat = GL_R16UI;
1506 mActualSampleOnlyImageFormatID = angle::FormatID::R16_UINT;
1507 mImageInitializerFunction = nullptr;
1508 mActualBufferFormatID = angle::FormatID::R16_UINT;
1509 mVkBufferFormatIsPacked = false;
1510 mVertexLoadFunction = CopyNativeVertexData<GLushort, 1, 1, 0>;
1511 mVertexLoadRequiresConversion = false;
1512 break;
1513
1514 case angle::FormatID::R16_UNORM:
1515 mIntendedGLFormat = GL_R16_EXT;
1516 mActualSampleOnlyImageFormatID = angle::FormatID::R16_UNORM;
1517 mImageInitializerFunction = nullptr;
1518 mActualBufferFormatID = angle::FormatID::R16_UNORM;
1519 mVkBufferFormatIsPacked = false;
1520 mVertexLoadFunction = CopyNativeVertexData<GLushort, 1, 1, 0>;
1521 mVertexLoadRequiresConversion = false;
1522 break;
1523
1524 case angle::FormatID::R16_USCALED:
1525 mIntendedGLFormat = GL_R16_USCALED_ANGLEX;
1526 mActualSampleOnlyImageFormatID = angle::FormatID::R16_USCALED;
1527 mImageInitializerFunction = nullptr;
1528 {
1529 static constexpr BufferFormatInitInfo kInfo[] = {
1530 {angle::FormatID::R16_USCALED, false, CopyNativeVertexData<GLushort, 1, 1, 0>,
1531 false},
1532 {angle::FormatID::R32_FLOAT, false,
1533 CopyToFloatVertexData<GLushort, 1, 1, false, false>, true},
1534 {angle::FormatID::R16_FLOAT, false,
1535 CopyToFloatVertexData<GLushort, 1, 1, false, true>, true}};
1536 initBufferFallback(renderer, kInfo, ArraySize(kInfo), 2);
1537 }
1538 break;
1539
1540 case angle::FormatID::R32G32B32A32_FIXED:
1541 mIntendedGLFormat = GL_RGBA32_FIXED_ANGLEX;
1542
1543 mActualBufferFormatID = angle::FormatID::R32G32B32A32_FLOAT;
1544 mVkBufferFormatIsPacked = false;
1545 mVertexLoadFunction = Copy32FixedTo32FVertexData<4, 4>;
1546 mVertexLoadRequiresConversion = true;
1547 break;
1548
1549 case angle::FormatID::R32G32B32A32_FLOAT:
1550 mIntendedGLFormat = GL_RGBA32F;
1551 mActualSampleOnlyImageFormatID = angle::FormatID::R32G32B32A32_FLOAT;
1552 mImageInitializerFunction = nullptr;
1553 {
1554 static constexpr BufferFormatInitInfo kInfo[] = {
1555 {angle::FormatID::R32G32B32A32_FLOAT, false,
1556 CopyNativeVertexData<GLfloat, 4, 4, 0>, false},
1557 {angle::FormatID::R16G16B16A16_FLOAT, false,
1558 CopyToFloatVertexData<GLfloat, 4, 4, false, true>, true}};
1559 initBufferFallback(renderer, kInfo, ArraySize(kInfo), 1);
1560 }
1561 break;
1562
1563 case angle::FormatID::R32G32B32A32_SINT:
1564 mIntendedGLFormat = GL_RGBA32I;
1565 mActualSampleOnlyImageFormatID = angle::FormatID::R32G32B32A32_SINT;
1566 mImageInitializerFunction = nullptr;
1567 mActualBufferFormatID = angle::FormatID::R32G32B32A32_SINT;
1568 mVkBufferFormatIsPacked = false;
1569 mVertexLoadFunction = CopyNativeVertexData<GLint, 4, 4, 0>;
1570 mVertexLoadRequiresConversion = false;
1571 break;
1572
1573 case angle::FormatID::R32G32B32A32_SNORM:
1574 mIntendedGLFormat = GL_RGBA32_SNORM_ANGLEX;
1575
1576 mActualBufferFormatID = angle::FormatID::R32G32B32A32_FLOAT;
1577 mVkBufferFormatIsPacked = false;
1578 mVertexLoadFunction = CopyToFloatVertexData<GLint, 4, 4, true, false>;
1579 mVertexLoadRequiresConversion = true;
1580 break;
1581
1582 case angle::FormatID::R32G32B32A32_SSCALED:
1583 mIntendedGLFormat = GL_RGBA32_SSCALED_ANGLEX;
1584
1585 mActualBufferFormatID = angle::FormatID::R32G32B32A32_FLOAT;
1586 mVkBufferFormatIsPacked = false;
1587 mVertexLoadFunction = CopyToFloatVertexData<GLint, 4, 4, false, false>;
1588 mVertexLoadRequiresConversion = true;
1589 break;
1590
1591 case angle::FormatID::R32G32B32A32_UINT:
1592 mIntendedGLFormat = GL_RGBA32UI;
1593 mActualSampleOnlyImageFormatID = angle::FormatID::R32G32B32A32_UINT;
1594 mImageInitializerFunction = nullptr;
1595 mActualBufferFormatID = angle::FormatID::R32G32B32A32_UINT;
1596 mVkBufferFormatIsPacked = false;
1597 mVertexLoadFunction = CopyNativeVertexData<GLuint, 4, 4, 0>;
1598 mVertexLoadRequiresConversion = false;
1599 break;
1600
1601 case angle::FormatID::R32G32B32A32_UNORM:
1602 mIntendedGLFormat = GL_RGBA32_UNORM_ANGLEX;
1603
1604 mActualBufferFormatID = angle::FormatID::R32G32B32A32_FLOAT;
1605 mVkBufferFormatIsPacked = false;
1606 mVertexLoadFunction = CopyToFloatVertexData<GLuint, 4, 4, true, false>;
1607 mVertexLoadRequiresConversion = true;
1608 break;
1609
1610 case angle::FormatID::R32G32B32A32_USCALED:
1611 mIntendedGLFormat = GL_RGBA32_USCALED_ANGLEX;
1612
1613 mActualBufferFormatID = angle::FormatID::R32G32B32A32_FLOAT;
1614 mVkBufferFormatIsPacked = false;
1615 mVertexLoadFunction = CopyToFloatVertexData<GLuint, 4, 4, false, false>;
1616 mVertexLoadRequiresConversion = true;
1617 break;
1618
1619 case angle::FormatID::R32G32B32_FIXED:
1620 mIntendedGLFormat = GL_RGB32_FIXED_ANGLEX;
1621
1622 mActualBufferFormatID = angle::FormatID::R32G32B32_FLOAT;
1623 mVkBufferFormatIsPacked = false;
1624 mVertexLoadFunction = Copy32FixedTo32FVertexData<3, 3>;
1625 mVertexLoadRequiresConversion = true;
1626 break;
1627
1628 case angle::FormatID::R32G32B32_FLOAT:
1629 mIntendedGLFormat = GL_RGB32F;
1630 {
1631 static constexpr ImageFormatInitInfo kInfo[] = {
1632 {angle::FormatID::R32G32B32_FLOAT, nullptr},
1633 {angle::FormatID::R32G32B32A32_FLOAT,
1634 Initialize4ComponentData<GLfloat, 0x00000000, 0x00000000, 0x00000000,
1635 gl::Float32One>}};
1636 initImageFallback(renderer, kInfo, ArraySize(kInfo));
1637 }
1638 {
1639 static constexpr BufferFormatInitInfo kInfo[] = {
1640 {angle::FormatID::R32G32B32_FLOAT, false,
1641 CopyNativeVertexData<GLfloat, 3, 3, 0>, false},
1642 {angle::FormatID::R16G16B16_FLOAT, false,
1643 CopyToFloatVertexData<GLfloat, 3, 3, false, true>, true},
1644 {angle::FormatID::R16G16B16A16_FLOAT, false,
1645 CopyToFloatVertexData<GLfloat, 3, 4, false, true>, true}};
1646 initBufferFallback(renderer, kInfo, ArraySize(kInfo), 1);
1647 }
1648 break;
1649
1650 case angle::FormatID::R32G32B32_SINT:
1651 mIntendedGLFormat = GL_RGB32I;
1652 {
1653 static constexpr ImageFormatInitInfo kInfo[] = {
1654 {angle::FormatID::R32G32B32_SINT, nullptr},
1655 {angle::FormatID::R32G32B32A32_SINT,
1656 Initialize4ComponentData<GLint, 0x00000000, 0x00000000, 0x00000000,
1657 0x00000001>}};
1658 initImageFallback(renderer, kInfo, ArraySize(kInfo));
1659 }
1660 mActualBufferFormatID = angle::FormatID::R32G32B32_SINT;
1661 mVkBufferFormatIsPacked = false;
1662 mVertexLoadFunction = CopyNativeVertexData<GLint, 3, 3, 0>;
1663 mVertexLoadRequiresConversion = false;
1664 break;
1665
1666 case angle::FormatID::R32G32B32_SNORM:
1667 mIntendedGLFormat = GL_RGB32_SNORM_ANGLEX;
1668
1669 mActualBufferFormatID = angle::FormatID::R32G32B32_FLOAT;
1670 mVkBufferFormatIsPacked = false;
1671 mVertexLoadFunction = CopyToFloatVertexData<GLint, 3, 3, true, false>;
1672 mVertexLoadRequiresConversion = true;
1673 break;
1674
1675 case angle::FormatID::R32G32B32_SSCALED:
1676 mIntendedGLFormat = GL_RGB32_SSCALED_ANGLEX;
1677
1678 mActualBufferFormatID = angle::FormatID::R32G32B32_FLOAT;
1679 mVkBufferFormatIsPacked = false;
1680 mVertexLoadFunction = CopyToFloatVertexData<GLint, 3, 3, false, false>;
1681 mVertexLoadRequiresConversion = true;
1682 break;
1683
1684 case angle::FormatID::R32G32B32_UINT:
1685 mIntendedGLFormat = GL_RGB32UI;
1686 {
1687 static constexpr ImageFormatInitInfo kInfo[] = {
1688 {angle::FormatID::R32G32B32_UINT, nullptr},
1689 {angle::FormatID::R32G32B32A32_UINT,
1690 Initialize4ComponentData<GLuint, 0x00000000, 0x00000000, 0x00000000,
1691 0x00000001>}};
1692 initImageFallback(renderer, kInfo, ArraySize(kInfo));
1693 }
1694 mActualBufferFormatID = angle::FormatID::R32G32B32_UINT;
1695 mVkBufferFormatIsPacked = false;
1696 mVertexLoadFunction = CopyNativeVertexData<GLuint, 3, 3, 0>;
1697 mVertexLoadRequiresConversion = false;
1698 break;
1699
1700 case angle::FormatID::R32G32B32_UNORM:
1701 mIntendedGLFormat = GL_RGB32_UNORM_ANGLEX;
1702
1703 mActualBufferFormatID = angle::FormatID::R32G32B32_FLOAT;
1704 mVkBufferFormatIsPacked = false;
1705 mVertexLoadFunction = CopyToFloatVertexData<GLuint, 3, 3, true, false>;
1706 mVertexLoadRequiresConversion = true;
1707 break;
1708
1709 case angle::FormatID::R32G32B32_USCALED:
1710 mIntendedGLFormat = GL_RGB32_USCALED_ANGLEX;
1711
1712 mActualBufferFormatID = angle::FormatID::R32G32B32_FLOAT;
1713 mVkBufferFormatIsPacked = false;
1714 mVertexLoadFunction = CopyToFloatVertexData<GLuint, 3, 3, false, false>;
1715 mVertexLoadRequiresConversion = true;
1716 break;
1717
1718 case angle::FormatID::R32G32_FIXED:
1719 mIntendedGLFormat = GL_RG32_FIXED_ANGLEX;
1720
1721 mActualBufferFormatID = angle::FormatID::R32G32_FLOAT;
1722 mVkBufferFormatIsPacked = false;
1723 mVertexLoadFunction = Copy32FixedTo32FVertexData<2, 2>;
1724 mVertexLoadRequiresConversion = true;
1725 break;
1726
1727 case angle::FormatID::R32G32_FLOAT:
1728 mIntendedGLFormat = GL_RG32F;
1729 mActualSampleOnlyImageFormatID = angle::FormatID::R32G32_FLOAT;
1730 mImageInitializerFunction = nullptr;
1731 {
1732 static constexpr BufferFormatInitInfo kInfo[] = {
1733 {angle::FormatID::R32G32_FLOAT, false, CopyNativeVertexData<GLfloat, 2, 2, 0>,
1734 false},
1735 {angle::FormatID::R16G16_FLOAT, false,
1736 CopyToFloatVertexData<GLfloat, 2, 2, false, true>, true}};
1737 initBufferFallback(renderer, kInfo, ArraySize(kInfo), 1);
1738 }
1739 break;
1740
1741 case angle::FormatID::R32G32_SINT:
1742 mIntendedGLFormat = GL_RG32I;
1743 mActualSampleOnlyImageFormatID = angle::FormatID::R32G32_SINT;
1744 mImageInitializerFunction = nullptr;
1745 mActualBufferFormatID = angle::FormatID::R32G32_SINT;
1746 mVkBufferFormatIsPacked = false;
1747 mVertexLoadFunction = CopyNativeVertexData<GLint, 2, 2, 0>;
1748 mVertexLoadRequiresConversion = false;
1749 break;
1750
1751 case angle::FormatID::R32G32_SNORM:
1752 mIntendedGLFormat = GL_RG32_SNORM_ANGLEX;
1753
1754 mActualBufferFormatID = angle::FormatID::R32G32_FLOAT;
1755 mVkBufferFormatIsPacked = false;
1756 mVertexLoadFunction = CopyToFloatVertexData<GLint, 2, 2, true, false>;
1757 mVertexLoadRequiresConversion = true;
1758 break;
1759
1760 case angle::FormatID::R32G32_SSCALED:
1761 mIntendedGLFormat = GL_RG32_SSCALED_ANGLEX;
1762
1763 mActualBufferFormatID = angle::FormatID::R32G32_FLOAT;
1764 mVkBufferFormatIsPacked = false;
1765 mVertexLoadFunction = CopyToFloatVertexData<GLint, 2, 2, false, false>;
1766 mVertexLoadRequiresConversion = true;
1767 break;
1768
1769 case angle::FormatID::R32G32_UINT:
1770 mIntendedGLFormat = GL_RG32UI;
1771 mActualSampleOnlyImageFormatID = angle::FormatID::R32G32_UINT;
1772 mImageInitializerFunction = nullptr;
1773 mActualBufferFormatID = angle::FormatID::R32G32_UINT;
1774 mVkBufferFormatIsPacked = false;
1775 mVertexLoadFunction = CopyNativeVertexData<GLuint, 2, 2, 0>;
1776 mVertexLoadRequiresConversion = false;
1777 break;
1778
1779 case angle::FormatID::R32G32_UNORM:
1780 mIntendedGLFormat = GL_RG32_UNORM_ANGLEX;
1781
1782 mActualBufferFormatID = angle::FormatID::R32G32_FLOAT;
1783 mVkBufferFormatIsPacked = false;
1784 mVertexLoadFunction = CopyToFloatVertexData<GLuint, 2, 2, true, false>;
1785 mVertexLoadRequiresConversion = true;
1786 break;
1787
1788 case angle::FormatID::R32G32_USCALED:
1789 mIntendedGLFormat = GL_RG32_USCALED_ANGLEX;
1790
1791 mActualBufferFormatID = angle::FormatID::R32G32_FLOAT;
1792 mVkBufferFormatIsPacked = false;
1793 mVertexLoadFunction = CopyToFloatVertexData<GLuint, 2, 2, false, false>;
1794 mVertexLoadRequiresConversion = true;
1795 break;
1796
1797 case angle::FormatID::R32_FIXED:
1798 mIntendedGLFormat = GL_R32_FIXED_ANGLEX;
1799
1800 mActualBufferFormatID = angle::FormatID::R32_FLOAT;
1801 mVkBufferFormatIsPacked = false;
1802 mVertexLoadFunction = Copy32FixedTo32FVertexData<1, 1>;
1803 mVertexLoadRequiresConversion = true;
1804 break;
1805
1806 case angle::FormatID::R32_FLOAT:
1807 mIntendedGLFormat = GL_R32F;
1808 mActualSampleOnlyImageFormatID = angle::FormatID::R32_FLOAT;
1809 mImageInitializerFunction = nullptr;
1810 {
1811 static constexpr BufferFormatInitInfo kInfo[] = {
1812 {angle::FormatID::R32_FLOAT, false, CopyNativeVertexData<GLfloat, 1, 1, 0>,
1813 false},
1814 {angle::FormatID::R16_FLOAT, false,
1815 CopyToFloatVertexData<GLfloat, 1, 1, false, true>, true}};
1816 initBufferFallback(renderer, kInfo, ArraySize(kInfo), 1);
1817 }
1818 break;
1819
1820 case angle::FormatID::R32_SINT:
1821 mIntendedGLFormat = GL_R32I;
1822 mActualSampleOnlyImageFormatID = angle::FormatID::R32_SINT;
1823 mImageInitializerFunction = nullptr;
1824 mActualBufferFormatID = angle::FormatID::R32_SINT;
1825 mVkBufferFormatIsPacked = false;
1826 mVertexLoadFunction = CopyNativeVertexData<GLint, 1, 1, 0>;
1827 mVertexLoadRequiresConversion = false;
1828 break;
1829
1830 case angle::FormatID::R32_SNORM:
1831 mIntendedGLFormat = GL_R32_SNORM_ANGLEX;
1832
1833 mActualBufferFormatID = angle::FormatID::R32_FLOAT;
1834 mVkBufferFormatIsPacked = false;
1835 mVertexLoadFunction = CopyToFloatVertexData<GLint, 1, 1, true, false>;
1836 mVertexLoadRequiresConversion = true;
1837 break;
1838
1839 case angle::FormatID::R32_SSCALED:
1840 mIntendedGLFormat = GL_R32_SSCALED_ANGLEX;
1841
1842 mActualBufferFormatID = angle::FormatID::R32_FLOAT;
1843 mVkBufferFormatIsPacked = false;
1844 mVertexLoadFunction = CopyToFloatVertexData<GLint, 1, 1, false, false>;
1845 mVertexLoadRequiresConversion = true;
1846 break;
1847
1848 case angle::FormatID::R32_UINT:
1849 mIntendedGLFormat = GL_R32UI;
1850 mActualSampleOnlyImageFormatID = angle::FormatID::R32_UINT;
1851 mImageInitializerFunction = nullptr;
1852 mActualBufferFormatID = angle::FormatID::R32_UINT;
1853 mVkBufferFormatIsPacked = false;
1854 mVertexLoadFunction = CopyNativeVertexData<GLuint, 1, 1, 0>;
1855 mVertexLoadRequiresConversion = false;
1856 break;
1857
1858 case angle::FormatID::R32_UNORM:
1859 mIntendedGLFormat = GL_R32_UNORM_ANGLEX;
1860
1861 mActualBufferFormatID = angle::FormatID::R32_FLOAT;
1862 mVkBufferFormatIsPacked = false;
1863 mVertexLoadFunction = CopyToFloatVertexData<GLuint, 1, 1, true, false>;
1864 mVertexLoadRequiresConversion = true;
1865 break;
1866
1867 case angle::FormatID::R32_USCALED:
1868 mIntendedGLFormat = GL_R32_USCALED_ANGLEX;
1869
1870 mActualBufferFormatID = angle::FormatID::R32_FLOAT;
1871 mVkBufferFormatIsPacked = false;
1872 mVertexLoadFunction = CopyToFloatVertexData<GLuint, 1, 1, false, false>;
1873 mVertexLoadRequiresConversion = true;
1874 break;
1875
1876 case angle::FormatID::R4G4B4A4_UNORM:
1877 mIntendedGLFormat = GL_RGBA4;
1878 {
1879 static constexpr ImageFormatInitInfo kInfo[] = {
1880 {angle::FormatID::R4G4B4A4_UNORM, nullptr},
1881 {angle::FormatID::R8G8B8A8_UNORM, nullptr}};
1882 initImageFallback(renderer, kInfo, ArraySize(kInfo));
1883 }
1884 mActualBufferFormatID = angle::FormatID::R4G4B4A4_UNORM;
1885 mVkBufferFormatIsPacked = true;
1886 mVertexLoadFunction = CopyNativeVertexData<GLushort, 1, 1, 0>;
1887 mVertexLoadRequiresConversion = false;
1888 break;
1889
1890 case angle::FormatID::R5G5B5A1_UNORM:
1891 mIntendedGLFormat = GL_RGB5_A1;
1892 {
1893 static constexpr ImageFormatInitInfo kInfo[] = {
1894 {angle::FormatID::R5G5B5A1_UNORM, nullptr},
1895 {angle::FormatID::A1R5G5B5_UNORM, nullptr}};
1896 initImageFallback(renderer, kInfo, ArraySize(kInfo));
1897 }
1898 mActualBufferFormatID = angle::FormatID::R5G5B5A1_UNORM;
1899 mVkBufferFormatIsPacked = true;
1900 mVertexLoadFunction = CopyNativeVertexData<GLushort, 1, 1, 0>;
1901 mVertexLoadRequiresConversion = false;
1902 break;
1903
1904 case angle::FormatID::R5G6B5_UNORM:
1905 mIntendedGLFormat = GL_RGB565;
1906 mActualSampleOnlyImageFormatID = angle::FormatID::R5G6B5_UNORM;
1907 mImageInitializerFunction = nullptr;
1908 mActualBufferFormatID = angle::FormatID::R5G6B5_UNORM;
1909 mVkBufferFormatIsPacked = true;
1910 mVertexLoadFunction = CopyNativeVertexData<GLushort, 1, 1, 0>;
1911 mVertexLoadRequiresConversion = false;
1912 break;
1913
1914 case angle::FormatID::R8G8B8A8_SINT:
1915 mIntendedGLFormat = GL_RGBA8I;
1916 mActualSampleOnlyImageFormatID = angle::FormatID::R8G8B8A8_SINT;
1917 mImageInitializerFunction = nullptr;
1918 mActualBufferFormatID = angle::FormatID::R8G8B8A8_SINT;
1919 mVkBufferFormatIsPacked = false;
1920 mVertexLoadFunction = CopyNativeVertexData<GLbyte, 4, 4, 0>;
1921 mVertexLoadRequiresConversion = false;
1922 break;
1923
1924 case angle::FormatID::R8G8B8A8_SNORM:
1925 mIntendedGLFormat = GL_RGBA8_SNORM;
1926 mActualSampleOnlyImageFormatID = angle::FormatID::R8G8B8A8_SNORM;
1927 mImageInitializerFunction = nullptr;
1928 mActualBufferFormatID = angle::FormatID::R8G8B8A8_SNORM;
1929 mVkBufferFormatIsPacked = false;
1930 mVertexLoadFunction = CopyNativeVertexData<GLbyte, 4, 4, 0>;
1931 mVertexLoadRequiresConversion = false;
1932 break;
1933
1934 case angle::FormatID::R8G8B8A8_SSCALED:
1935 mIntendedGLFormat = GL_RGBA8_SSCALED_ANGLEX;
1936 mActualSampleOnlyImageFormatID = angle::FormatID::R8G8B8A8_SSCALED;
1937 mImageInitializerFunction = nullptr;
1938 {
1939 static constexpr BufferFormatInitInfo kInfo[] = {
1940 {angle::FormatID::R8G8B8A8_SSCALED, false,
1941 CopyNativeVertexData<GLbyte, 4, 4, 0>, false},
1942 {angle::FormatID::R16G16B16A16_FLOAT, false,
1943 CopyToFloatVertexData<GLbyte, 4, 4, false, true>, true}};
1944 initBufferFallback(renderer, kInfo, ArraySize(kInfo), 2);
1945 }
1946 break;
1947
1948 case angle::FormatID::R8G8B8A8_TYPELESS:
1949 // This format is not implemented in Vulkan.
1950 break;
1951
1952 case angle::FormatID::R8G8B8A8_TYPELESS_SRGB:
1953 // This format is not implemented in Vulkan.
1954 break;
1955
1956 case angle::FormatID::R8G8B8A8_UINT:
1957 mIntendedGLFormat = GL_RGBA8UI;
1958 mActualSampleOnlyImageFormatID = angle::FormatID::R8G8B8A8_UINT;
1959 mImageInitializerFunction = nullptr;
1960 mActualBufferFormatID = angle::FormatID::R8G8B8A8_UINT;
1961 mVkBufferFormatIsPacked = false;
1962 mVertexLoadFunction = CopyNativeVertexData<GLubyte, 4, 4, 0>;
1963 mVertexLoadRequiresConversion = false;
1964 break;
1965
1966 case angle::FormatID::R8G8B8A8_UNORM:
1967 mIntendedGLFormat = GL_RGBA8;
1968 mActualSampleOnlyImageFormatID = angle::FormatID::R8G8B8A8_UNORM;
1969 mImageInitializerFunction = nullptr;
1970 mActualBufferFormatID = angle::FormatID::R8G8B8A8_UNORM;
1971 mVkBufferFormatIsPacked = false;
1972 mVertexLoadFunction = CopyNativeVertexData<GLubyte, 4, 4, 0>;
1973 mVertexLoadRequiresConversion = false;
1974 break;
1975
1976 case angle::FormatID::R8G8B8A8_UNORM_SRGB:
1977 mIntendedGLFormat = GL_SRGB8_ALPHA8;
1978 mActualSampleOnlyImageFormatID = angle::FormatID::R8G8B8A8_UNORM_SRGB;
1979 mImageInitializerFunction = nullptr;
1980 mActualBufferFormatID = angle::FormatID::R8G8B8A8_UNORM_SRGB;
1981 mVkBufferFormatIsPacked = false;
1982 mVertexLoadFunction = CopyNativeVertexData<GLubyte, 4, 4, 0>;
1983 mVertexLoadRequiresConversion = false;
1984 break;
1985
1986 case angle::FormatID::R8G8B8A8_USCALED:
1987 mIntendedGLFormat = GL_RGBA8_USCALED_ANGLEX;
1988 mActualSampleOnlyImageFormatID = angle::FormatID::R8G8B8A8_USCALED;
1989 mImageInitializerFunction = nullptr;
1990 {
1991 static constexpr BufferFormatInitInfo kInfo[] = {
1992 {angle::FormatID::R8G8B8A8_USCALED, false,
1993 CopyNativeVertexData<GLubyte, 4, 4, 0>, false},
1994 {angle::FormatID::R16G16B16A16_FLOAT, false,
1995 CopyToFloatVertexData<GLubyte, 4, 4, false, true>, true}};
1996 initBufferFallback(renderer, kInfo, ArraySize(kInfo), 2);
1997 }
1998 break;
1999
2000 case angle::FormatID::R8G8B8X8_UNORM:
2001 mIntendedGLFormat = GL_RGBX8_ANGLE;
2002 mActualSampleOnlyImageFormatID = angle::FormatID::R8G8B8A8_UNORM;
2003 mImageInitializerFunction = nullptr;
2004 mActualBufferFormatID = angle::FormatID::NONE;
2005 mVkBufferFormatIsPacked = false;
2006 mVertexLoadFunction = nullptr;
2007 mVertexLoadRequiresConversion = true;
2008 break;
2009
2010 case angle::FormatID::R8G8B8_SINT:
2011 mIntendedGLFormat = GL_RGB8I;
2012 {
2013 static constexpr ImageFormatInitInfo kInfo[] = {
2014 {angle::FormatID::R8G8B8_SINT, nullptr},
2015 {angle::FormatID::R8G8B8A8_SINT,
2016 Initialize4ComponentData<GLbyte, 0x00, 0x00, 0x00, 0x01>}};
2017 initImageFallback(renderer, kInfo, ArraySize(kInfo));
2018 }
2019 {
2020 static constexpr BufferFormatInitInfo kInfo[] = {
2021 {angle::FormatID::R8G8B8_SINT, false, CopyNativeVertexData<GLbyte, 3, 3, 0>,
2022 false},
2023 {angle::FormatID::R8G8B8A8_SINT, false, CopyNativeVertexData<GLbyte, 3, 4, 1>,
2024 true}};
2025 initBufferFallback(renderer, kInfo, ArraySize(kInfo), 2);
2026 }
2027 break;
2028
2029 case angle::FormatID::R8G8B8_SNORM:
2030 mIntendedGLFormat = GL_RGB8_SNORM;
2031 {
2032 static constexpr ImageFormatInitInfo kInfo[] = {
2033 {angle::FormatID::R8G8B8_SNORM, nullptr},
2034 {angle::FormatID::R8G8B8A8_SNORM,
2035 Initialize4ComponentData<GLbyte, 0x00, 0x00, 0x00, 0x7F>}};
2036 initImageFallback(renderer, kInfo, ArraySize(kInfo));
2037 }
2038 {
2039 static constexpr BufferFormatInitInfo kInfo[] = {
2040 {angle::FormatID::R8G8B8_SNORM, false, CopyNativeVertexData<GLbyte, 3, 3, 0>,
2041 false},
2042 {angle::FormatID::R8G8B8A8_SNORM, false,
2043 CopyNativeVertexData<GLbyte, 3, 4, std::numeric_limits<GLbyte>::max()>, true}};
2044 initBufferFallback(renderer, kInfo, ArraySize(kInfo), 2);
2045 }
2046 break;
2047
2048 case angle::FormatID::R8G8B8_SSCALED:
2049 mIntendedGLFormat = GL_RGB8_SSCALED_ANGLEX;
2050 mActualSampleOnlyImageFormatID = angle::FormatID::R8G8B8_SSCALED;
2051 mImageInitializerFunction = nullptr;
2052 {
2053 static constexpr BufferFormatInitInfo kInfo[] = {
2054 {angle::FormatID::R8G8B8_SSCALED, false, CopyNativeVertexData<GLbyte, 3, 3, 0>,
2055 false},
2056 {angle::FormatID::R16G16B16_FLOAT, false,
2057 CopyToFloatVertexData<GLbyte, 3, 3, false, true>, true},
2058 {angle::FormatID::R16G16B16A16_FLOAT, false,
2059 CopyToFloatVertexData<GLbyte, 3, 4, false, true>, true}};
2060 initBufferFallback(renderer, kInfo, ArraySize(kInfo), 3);
2061 }
2062 break;
2063
2064 case angle::FormatID::R8G8B8_UINT:
2065 mIntendedGLFormat = GL_RGB8UI;
2066 {
2067 static constexpr ImageFormatInitInfo kInfo[] = {
2068 {angle::FormatID::R8G8B8_UINT, nullptr},
2069 {angle::FormatID::R8G8B8A8_UINT,
2070 Initialize4ComponentData<GLubyte, 0x00, 0x00, 0x00, 0x01>}};
2071 initImageFallback(renderer, kInfo, ArraySize(kInfo));
2072 }
2073 {
2074 static constexpr BufferFormatInitInfo kInfo[] = {
2075 {angle::FormatID::R8G8B8_UINT, false, CopyNativeVertexData<GLubyte, 3, 3, 0>,
2076 false},
2077 {angle::FormatID::R8G8B8A8_UINT, false, CopyNativeVertexData<GLubyte, 3, 4, 1>,
2078 true}};
2079 initBufferFallback(renderer, kInfo, ArraySize(kInfo), 2);
2080 }
2081 break;
2082
2083 case angle::FormatID::R8G8B8_UNORM:
2084 mIntendedGLFormat = GL_RGB8;
2085 {
2086 static constexpr ImageFormatInitInfo kInfo[] = {
2087 {angle::FormatID::R8G8B8_UNORM, nullptr},
2088 {angle::FormatID::R8G8B8A8_UNORM,
2089 Initialize4ComponentData<GLubyte, 0x00, 0x00, 0x00, 0xFF>}};
2090 initImageFallback(renderer, kInfo, ArraySize(kInfo));
2091 }
2092 {
2093 static constexpr BufferFormatInitInfo kInfo[] = {
2094 {angle::FormatID::R8G8B8_UNORM, false, CopyNativeVertexData<GLubyte, 3, 3, 0>,
2095 false},
2096 {angle::FormatID::R8G8B8A8_UNORM, false,
2097 CopyNativeVertexData<GLubyte, 3, 4, std::numeric_limits<GLubyte>::max()>,
2098 true}};
2099 initBufferFallback(renderer, kInfo, ArraySize(kInfo), 2);
2100 }
2101 break;
2102
2103 case angle::FormatID::R8G8B8_UNORM_SRGB:
2104 mIntendedGLFormat = GL_SRGB8;
2105 {
2106 static constexpr ImageFormatInitInfo kInfo[] = {
2107 {angle::FormatID::R8G8B8_UNORM_SRGB, nullptr},
2108 {angle::FormatID::R8G8B8A8_UNORM_SRGB,
2109 Initialize4ComponentData<GLubyte, 0x00, 0x00, 0x00, 0xFF>}};
2110 initImageFallback(renderer, kInfo, ArraySize(kInfo));
2111 }
2112 mActualBufferFormatID = angle::FormatID::R8G8B8_UNORM_SRGB;
2113 mVkBufferFormatIsPacked = false;
2114 mVertexLoadFunction = CopyNativeVertexData<GLubyte, 3, 3, 0>;
2115 mVertexLoadRequiresConversion = false;
2116 break;
2117
2118 case angle::FormatID::R8G8B8_USCALED:
2119 mIntendedGLFormat = GL_RGB8_USCALED_ANGLEX;
2120 mActualSampleOnlyImageFormatID = angle::FormatID::R8G8B8_USCALED;
2121 mImageInitializerFunction = nullptr;
2122 {
2123 static constexpr BufferFormatInitInfo kInfo[] = {
2124 {angle::FormatID::R8G8B8_USCALED, false, CopyNativeVertexData<GLubyte, 3, 3, 0>,
2125 false},
2126 {angle::FormatID::R16G16B16_FLOAT, false,
2127 CopyToFloatVertexData<GLubyte, 3, 3, false, true>, true},
2128 {angle::FormatID::R16G16B16A16_FLOAT, false,
2129 CopyToFloatVertexData<GLubyte, 3, 4, false, true>, true}};
2130 initBufferFallback(renderer, kInfo, ArraySize(kInfo), 3);
2131 }
2132 break;
2133
2134 case angle::FormatID::R8G8_SINT:
2135 mIntendedGLFormat = GL_RG8I;
2136 mActualSampleOnlyImageFormatID = angle::FormatID::R8G8_SINT;
2137 mImageInitializerFunction = nullptr;
2138 mActualBufferFormatID = angle::FormatID::R8G8_SINT;
2139 mVkBufferFormatIsPacked = false;
2140 mVertexLoadFunction = CopyNativeVertexData<GLbyte, 2, 2, 0>;
2141 mVertexLoadRequiresConversion = false;
2142 break;
2143
2144 case angle::FormatID::R8G8_SNORM:
2145 mIntendedGLFormat = GL_RG8_SNORM;
2146 mActualSampleOnlyImageFormatID = angle::FormatID::R8G8_SNORM;
2147 mImageInitializerFunction = nullptr;
2148 mActualBufferFormatID = angle::FormatID::R8G8_SNORM;
2149 mVkBufferFormatIsPacked = false;
2150 mVertexLoadFunction = CopyNativeVertexData<GLbyte, 2, 2, 0>;
2151 mVertexLoadRequiresConversion = false;
2152 break;
2153
2154 case angle::FormatID::R8G8_SSCALED:
2155 mIntendedGLFormat = GL_RG8_SSCALED_ANGLEX;
2156 mActualSampleOnlyImageFormatID = angle::FormatID::R8G8_SSCALED;
2157 mImageInitializerFunction = nullptr;
2158 {
2159 static constexpr BufferFormatInitInfo kInfo[] = {
2160 {angle::FormatID::R8G8_SSCALED, false, CopyNativeVertexData<GLbyte, 2, 2, 0>,
2161 false},
2162 {angle::FormatID::R16G16_FLOAT, false,
2163 CopyToFloatVertexData<GLbyte, 2, 2, false, true>, true}};
2164 initBufferFallback(renderer, kInfo, ArraySize(kInfo), 2);
2165 }
2166 break;
2167
2168 case angle::FormatID::R8G8_UINT:
2169 mIntendedGLFormat = GL_RG8UI;
2170 mActualSampleOnlyImageFormatID = angle::FormatID::R8G8_UINT;
2171 mImageInitializerFunction = nullptr;
2172 mActualBufferFormatID = angle::FormatID::R8G8_UINT;
2173 mVkBufferFormatIsPacked = false;
2174 mVertexLoadFunction = CopyNativeVertexData<GLubyte, 2, 2, 0>;
2175 mVertexLoadRequiresConversion = false;
2176 break;
2177
2178 case angle::FormatID::R8G8_UNORM:
2179 mIntendedGLFormat = GL_RG8;
2180 mActualSampleOnlyImageFormatID = angle::FormatID::R8G8_UNORM;
2181 mImageInitializerFunction = nullptr;
2182 mActualBufferFormatID = angle::FormatID::R8G8_UNORM;
2183 mVkBufferFormatIsPacked = false;
2184 mVertexLoadFunction = CopyNativeVertexData<GLubyte, 2, 2, 0>;
2185 mVertexLoadRequiresConversion = false;
2186 break;
2187
2188 case angle::FormatID::R8G8_UNORM_SRGB:
2189 mIntendedGLFormat = GL_SRG8_EXT;
2190 mActualSampleOnlyImageFormatID = angle::FormatID::R8G8_UNORM_SRGB;
2191 mImageInitializerFunction = nullptr;
2192 mActualBufferFormatID = angle::FormatID::R8G8_UNORM_SRGB;
2193 mVkBufferFormatIsPacked = false;
2194 mVertexLoadFunction = CopyNativeVertexData<GLubyte, 2, 2, 0>;
2195 mVertexLoadRequiresConversion = false;
2196 break;
2197
2198 case angle::FormatID::R8G8_USCALED:
2199 mIntendedGLFormat = GL_RG8_USCALED_ANGLEX;
2200 mActualSampleOnlyImageFormatID = angle::FormatID::R8G8_USCALED;
2201 mImageInitializerFunction = nullptr;
2202 {
2203 static constexpr BufferFormatInitInfo kInfo[] = {
2204 {angle::FormatID::R8G8_USCALED, false, CopyNativeVertexData<GLubyte, 2, 2, 0>,
2205 false},
2206 {angle::FormatID::R16G16_FLOAT, false,
2207 CopyToFloatVertexData<GLubyte, 2, 2, false, true>, true}};
2208 initBufferFallback(renderer, kInfo, ArraySize(kInfo), 2);
2209 }
2210 break;
2211
2212 case angle::FormatID::R8_SINT:
2213 mIntendedGLFormat = GL_R8I;
2214 mActualSampleOnlyImageFormatID = angle::FormatID::R8_SINT;
2215 mImageInitializerFunction = nullptr;
2216 mActualBufferFormatID = angle::FormatID::R8_SINT;
2217 mVkBufferFormatIsPacked = false;
2218 mVertexLoadFunction = CopyNativeVertexData<GLbyte, 1, 1, 0>;
2219 mVertexLoadRequiresConversion = false;
2220 break;
2221
2222 case angle::FormatID::R8_SNORM:
2223 mIntendedGLFormat = GL_R8_SNORM;
2224 mActualSampleOnlyImageFormatID = angle::FormatID::R8_SNORM;
2225 mImageInitializerFunction = nullptr;
2226 mActualBufferFormatID = angle::FormatID::R8_SNORM;
2227 mVkBufferFormatIsPacked = false;
2228 mVertexLoadFunction = CopyNativeVertexData<GLbyte, 1, 1, 0>;
2229 mVertexLoadRequiresConversion = false;
2230 break;
2231
2232 case angle::FormatID::R8_SSCALED:
2233 mIntendedGLFormat = GL_R8_SSCALED_ANGLEX;
2234 mActualSampleOnlyImageFormatID = angle::FormatID::R8_SSCALED;
2235 mImageInitializerFunction = nullptr;
2236 {
2237 static constexpr BufferFormatInitInfo kInfo[] = {
2238 {angle::FormatID::R8_SSCALED, false, CopyNativeVertexData<GLbyte, 1, 1, 0>,
2239 false},
2240 {angle::FormatID::R16_FLOAT, false,
2241 CopyToFloatVertexData<GLbyte, 1, 1, false, true>, true}};
2242 initBufferFallback(renderer, kInfo, ArraySize(kInfo), 2);
2243 }
2244 break;
2245
2246 case angle::FormatID::R8_UINT:
2247 mIntendedGLFormat = GL_R8UI;
2248 mActualSampleOnlyImageFormatID = angle::FormatID::R8_UINT;
2249 mImageInitializerFunction = nullptr;
2250 mActualBufferFormatID = angle::FormatID::R8_UINT;
2251 mVkBufferFormatIsPacked = false;
2252 mVertexLoadFunction = CopyNativeVertexData<GLubyte, 1, 1, 0>;
2253 mVertexLoadRequiresConversion = false;
2254 break;
2255
2256 case angle::FormatID::R8_UNORM:
2257 mIntendedGLFormat = GL_R8;
2258 mActualSampleOnlyImageFormatID = angle::FormatID::R8_UNORM;
2259 mImageInitializerFunction = nullptr;
2260 mActualBufferFormatID = angle::FormatID::R8_UNORM;
2261 mVkBufferFormatIsPacked = false;
2262 mVertexLoadFunction = CopyNativeVertexData<GLubyte, 1, 1, 0>;
2263 mVertexLoadRequiresConversion = false;
2264 break;
2265
2266 case angle::FormatID::R8_UNORM_SRGB:
2267 mIntendedGLFormat = GL_SR8_EXT;
2268 mActualSampleOnlyImageFormatID = angle::FormatID::R8_UNORM_SRGB;
2269 mImageInitializerFunction = nullptr;
2270 mActualBufferFormatID = angle::FormatID::R8_UNORM_SRGB;
2271 mVkBufferFormatIsPacked = false;
2272 mVertexLoadFunction = CopyNativeVertexData<GLubyte, 1, 1, 0>;
2273 mVertexLoadRequiresConversion = false;
2274 break;
2275
2276 case angle::FormatID::R8_USCALED:
2277 mIntendedGLFormat = GL_R8_USCALED_ANGLEX;
2278 mActualSampleOnlyImageFormatID = angle::FormatID::R8_USCALED;
2279 mImageInitializerFunction = nullptr;
2280 {
2281 static constexpr BufferFormatInitInfo kInfo[] = {
2282 {angle::FormatID::R8_USCALED, false, CopyNativeVertexData<GLubyte, 1, 1, 0>,
2283 false},
2284 {angle::FormatID::R16_FLOAT, false,
2285 CopyToFloatVertexData<GLubyte, 1, 1, false, true>, true}};
2286 initBufferFallback(renderer, kInfo, ArraySize(kInfo), 2);
2287 }
2288 break;
2289
2290 case angle::FormatID::R9G9B9E5_SHAREDEXP:
2291 mIntendedGLFormat = GL_RGB9_E5;
2292 mActualSampleOnlyImageFormatID = angle::FormatID::R9G9B9E5_SHAREDEXP;
2293 mImageInitializerFunction = nullptr;
2294 mActualBufferFormatID = angle::FormatID::R9G9B9E5_SHAREDEXP;
2295 mVkBufferFormatIsPacked = true;
2296 mVertexLoadFunction = CopyNativeVertexData<GLuint, 1, 1, 0>;
2297 mVertexLoadRequiresConversion = false;
2298 break;
2299
2300 case angle::FormatID::S8_UINT:
2301 mIntendedGLFormat = GL_STENCIL_INDEX8;
2302 {
2303 static constexpr ImageFormatInitInfo kInfo[] = {
2304 {angle::FormatID::S8_UINT, nullptr},
2305 {angle::FormatID::D24_UNORM_S8_UINT, nullptr},
2306 {angle::FormatID::D32_FLOAT_S8X24_UINT, nullptr},
2307 {angle::FormatID::S8_UINT, nullptr}};
2308 initImageFallback(renderer, kInfo, ArraySize(kInfo));
2309 }
2310 mActualBufferFormatID = angle::FormatID::S8_UINT;
2311 mVkBufferFormatIsPacked = false;
2312 mVertexLoadFunction = nullptr;
2313 mVertexLoadRequiresConversion = false;
2314 break;
2315
2316 case angle::FormatID::X2R10G10B10_SINT_VERTEX:
2317 mIntendedGLFormat = GL_X2_RGB10_SINT_ANGLEX;
2318 mActualSampleOnlyImageFormatID = angle::FormatID::NONE;
2319 mImageInitializerFunction = nullptr;
2320 mActualBufferFormatID = angle::FormatID::R16G16B16A16_FLOAT;
2321 mVkBufferFormatIsPacked = false;
2322 mVertexLoadFunction = CopyXYZ10ToXYZWFloatVertexData<true, false, true>;
2323 mVertexLoadRequiresConversion = true;
2324 break;
2325
2326 case angle::FormatID::X2R10G10B10_SNORM_VERTEX:
2327 mIntendedGLFormat = GL_X2_RGB10_SNORM_ANGLEX;
2328 mActualSampleOnlyImageFormatID = angle::FormatID::NONE;
2329 mImageInitializerFunction = nullptr;
2330 mActualBufferFormatID = angle::FormatID::R16G16B16A16_FLOAT;
2331 mVkBufferFormatIsPacked = false;
2332 mVertexLoadFunction = CopyXYZ10ToXYZWFloatVertexData<true, true, true>;
2333 mVertexLoadRequiresConversion = true;
2334 break;
2335
2336 case angle::FormatID::X2R10G10B10_SSCALED_VERTEX:
2337 mIntendedGLFormat = GL_X2_RGB10_SSCALED_ANGLEX;
2338 mActualSampleOnlyImageFormatID = angle::FormatID::NONE;
2339 mImageInitializerFunction = nullptr;
2340 mActualBufferFormatID = angle::FormatID::R16G16B16A16_FLOAT;
2341 mVkBufferFormatIsPacked = false;
2342 mVertexLoadFunction = CopyXYZ10ToXYZWFloatVertexData<true, false, true>;
2343 mVertexLoadRequiresConversion = true;
2344 break;
2345
2346 case angle::FormatID::X2R10G10B10_UINT_VERTEX:
2347 mIntendedGLFormat = GL_X2_RGB10_UINT_ANGLEX;
2348 mActualSampleOnlyImageFormatID = angle::FormatID::NONE;
2349 mImageInitializerFunction = nullptr;
2350 mActualBufferFormatID = angle::FormatID::R16G16B16A16_FLOAT;
2351 mVkBufferFormatIsPacked = false;
2352 mVertexLoadFunction = CopyXYZ10ToXYZWFloatVertexData<false, false, true>;
2353 mVertexLoadRequiresConversion = true;
2354 break;
2355
2356 case angle::FormatID::X2R10G10B10_UNORM_VERTEX:
2357 mIntendedGLFormat = GL_X2_RGB10_UNORM_ANGLEX;
2358 mActualSampleOnlyImageFormatID = angle::FormatID::NONE;
2359 mImageInitializerFunction = nullptr;
2360 mActualBufferFormatID = angle::FormatID::R16G16B16A16_FLOAT;
2361 mVkBufferFormatIsPacked = false;
2362 mVertexLoadFunction = CopyXYZ10ToXYZWFloatVertexData<false, true, true>;
2363 mVertexLoadRequiresConversion = true;
2364 break;
2365
2366 case angle::FormatID::X2R10G10B10_USCALED_VERTEX:
2367 mIntendedGLFormat = GL_X2_RGB10_USCALED_ANGLEX;
2368 mActualSampleOnlyImageFormatID = angle::FormatID::NONE;
2369 mImageInitializerFunction = nullptr;
2370 mActualBufferFormatID = angle::FormatID::R16G16B16A16_FLOAT;
2371 mVkBufferFormatIsPacked = false;
2372 mVertexLoadFunction = CopyXYZ10ToXYZWFloatVertexData<false, false, true>;
2373 mVertexLoadRequiresConversion = true;
2374 break;
2375
2376 default:
2377 UNREACHABLE();
2378 break;
2379 }
2380 }
2381
GetVkFormatFromFormatID(angle::FormatID formatID)2382 VkFormat GetVkFormatFromFormatID(angle::FormatID formatID)
2383 {
2384 static constexpr angle::FormatMap<VkFormat> kMap = {
2385 {angle::FormatID::A1R5G5B5_UNORM, VK_FORMAT_A1R5G5B5_UNORM_PACK16},
2386 {angle::FormatID::ASTC_10x10_SRGB_BLOCK, VK_FORMAT_ASTC_10x10_SRGB_BLOCK},
2387 {angle::FormatID::ASTC_10x10_UNORM_BLOCK, VK_FORMAT_ASTC_10x10_UNORM_BLOCK},
2388 {angle::FormatID::ASTC_10x5_SRGB_BLOCK, VK_FORMAT_ASTC_10x5_SRGB_BLOCK},
2389 {angle::FormatID::ASTC_10x5_UNORM_BLOCK, VK_FORMAT_ASTC_10x5_UNORM_BLOCK},
2390 {angle::FormatID::ASTC_10x6_SRGB_BLOCK, VK_FORMAT_ASTC_10x6_SRGB_BLOCK},
2391 {angle::FormatID::ASTC_10x6_UNORM_BLOCK, VK_FORMAT_ASTC_10x6_UNORM_BLOCK},
2392 {angle::FormatID::ASTC_10x8_SRGB_BLOCK, VK_FORMAT_ASTC_10x8_SRGB_BLOCK},
2393 {angle::FormatID::ASTC_10x8_UNORM_BLOCK, VK_FORMAT_ASTC_10x8_UNORM_BLOCK},
2394 {angle::FormatID::ASTC_12x10_SRGB_BLOCK, VK_FORMAT_ASTC_12x10_SRGB_BLOCK},
2395 {angle::FormatID::ASTC_12x10_UNORM_BLOCK, VK_FORMAT_ASTC_12x10_UNORM_BLOCK},
2396 {angle::FormatID::ASTC_12x12_SRGB_BLOCK, VK_FORMAT_ASTC_12x12_SRGB_BLOCK},
2397 {angle::FormatID::ASTC_12x12_UNORM_BLOCK, VK_FORMAT_ASTC_12x12_UNORM_BLOCK},
2398 {angle::FormatID::ASTC_4x4_SRGB_BLOCK, VK_FORMAT_ASTC_4x4_SRGB_BLOCK},
2399 {angle::FormatID::ASTC_4x4_UNORM_BLOCK, VK_FORMAT_ASTC_4x4_UNORM_BLOCK},
2400 {angle::FormatID::ASTC_5x4_SRGB_BLOCK, VK_FORMAT_ASTC_5x4_SRGB_BLOCK},
2401 {angle::FormatID::ASTC_5x4_UNORM_BLOCK, VK_FORMAT_ASTC_5x4_UNORM_BLOCK},
2402 {angle::FormatID::ASTC_5x5_SRGB_BLOCK, VK_FORMAT_ASTC_5x5_SRGB_BLOCK},
2403 {angle::FormatID::ASTC_5x5_UNORM_BLOCK, VK_FORMAT_ASTC_5x5_UNORM_BLOCK},
2404 {angle::FormatID::ASTC_6x5_SRGB_BLOCK, VK_FORMAT_ASTC_6x5_SRGB_BLOCK},
2405 {angle::FormatID::ASTC_6x5_UNORM_BLOCK, VK_FORMAT_ASTC_6x5_UNORM_BLOCK},
2406 {angle::FormatID::ASTC_6x6_SRGB_BLOCK, VK_FORMAT_ASTC_6x6_SRGB_BLOCK},
2407 {angle::FormatID::ASTC_6x6_UNORM_BLOCK, VK_FORMAT_ASTC_6x6_UNORM_BLOCK},
2408 {angle::FormatID::ASTC_8x5_SRGB_BLOCK, VK_FORMAT_ASTC_8x5_SRGB_BLOCK},
2409 {angle::FormatID::ASTC_8x5_UNORM_BLOCK, VK_FORMAT_ASTC_8x5_UNORM_BLOCK},
2410 {angle::FormatID::ASTC_8x6_SRGB_BLOCK, VK_FORMAT_ASTC_8x6_SRGB_BLOCK},
2411 {angle::FormatID::ASTC_8x6_UNORM_BLOCK, VK_FORMAT_ASTC_8x6_UNORM_BLOCK},
2412 {angle::FormatID::ASTC_8x8_SRGB_BLOCK, VK_FORMAT_ASTC_8x8_SRGB_BLOCK},
2413 {angle::FormatID::ASTC_8x8_UNORM_BLOCK, VK_FORMAT_ASTC_8x8_UNORM_BLOCK},
2414 {angle::FormatID::B10G10R10A2_UNORM, VK_FORMAT_A2R10G10B10_UNORM_PACK32},
2415 {angle::FormatID::B4G4R4A4_UNORM, VK_FORMAT_B4G4R4A4_UNORM_PACK16},
2416 {angle::FormatID::B5G5R5A1_UNORM, VK_FORMAT_B5G5R5A1_UNORM_PACK16},
2417 {angle::FormatID::B5G6R5_UNORM, VK_FORMAT_B5G6R5_UNORM_PACK16},
2418 {angle::FormatID::B8G8R8A8_UNORM, VK_FORMAT_B8G8R8A8_UNORM},
2419 {angle::FormatID::B8G8R8A8_UNORM_SRGB, VK_FORMAT_B8G8R8A8_SRGB},
2420 {angle::FormatID::BC1_RGBA_UNORM_BLOCK, VK_FORMAT_BC1_RGBA_UNORM_BLOCK},
2421 {angle::FormatID::BC1_RGBA_UNORM_SRGB_BLOCK, VK_FORMAT_BC1_RGBA_SRGB_BLOCK},
2422 {angle::FormatID::BC1_RGB_UNORM_BLOCK, VK_FORMAT_BC1_RGB_UNORM_BLOCK},
2423 {angle::FormatID::BC1_RGB_UNORM_SRGB_BLOCK, VK_FORMAT_BC1_RGB_SRGB_BLOCK},
2424 {angle::FormatID::BC2_RGBA_UNORM_BLOCK, VK_FORMAT_BC2_UNORM_BLOCK},
2425 {angle::FormatID::BC2_RGBA_UNORM_SRGB_BLOCK, VK_FORMAT_BC2_SRGB_BLOCK},
2426 {angle::FormatID::BC3_RGBA_UNORM_BLOCK, VK_FORMAT_BC3_UNORM_BLOCK},
2427 {angle::FormatID::BC3_RGBA_UNORM_SRGB_BLOCK, VK_FORMAT_BC3_SRGB_BLOCK},
2428 {angle::FormatID::BC4_RED_SNORM_BLOCK, VK_FORMAT_BC4_SNORM_BLOCK},
2429 {angle::FormatID::BC4_RED_UNORM_BLOCK, VK_FORMAT_BC4_UNORM_BLOCK},
2430 {angle::FormatID::BC5_RG_SNORM_BLOCK, VK_FORMAT_BC5_SNORM_BLOCK},
2431 {angle::FormatID::BC5_RG_UNORM_BLOCK, VK_FORMAT_BC5_UNORM_BLOCK},
2432 {angle::FormatID::BC6H_RGB_SFLOAT_BLOCK, VK_FORMAT_BC6H_SFLOAT_BLOCK},
2433 {angle::FormatID::BC6H_RGB_UFLOAT_BLOCK, VK_FORMAT_BC6H_UFLOAT_BLOCK},
2434 {angle::FormatID::BC7_RGBA_UNORM_BLOCK, VK_FORMAT_BC7_UNORM_BLOCK},
2435 {angle::FormatID::BC7_RGBA_UNORM_SRGB_BLOCK, VK_FORMAT_BC7_SRGB_BLOCK},
2436 {angle::FormatID::D16_UNORM, VK_FORMAT_D16_UNORM},
2437 {angle::FormatID::D24_UNORM_S8_UINT, VK_FORMAT_D24_UNORM_S8_UINT},
2438 {angle::FormatID::D24_UNORM_X8_UINT, VK_FORMAT_X8_D24_UNORM_PACK32},
2439 {angle::FormatID::D32_FLOAT, VK_FORMAT_D32_SFLOAT},
2440 {angle::FormatID::D32_FLOAT_S8X24_UINT, VK_FORMAT_D32_SFLOAT_S8_UINT},
2441 {angle::FormatID::EAC_R11G11_SNORM_BLOCK, VK_FORMAT_EAC_R11G11_SNORM_BLOCK},
2442 {angle::FormatID::EAC_R11G11_UNORM_BLOCK, VK_FORMAT_EAC_R11G11_UNORM_BLOCK},
2443 {angle::FormatID::EAC_R11_SNORM_BLOCK, VK_FORMAT_EAC_R11_SNORM_BLOCK},
2444 {angle::FormatID::EAC_R11_UNORM_BLOCK, VK_FORMAT_EAC_R11_UNORM_BLOCK},
2445 {angle::FormatID::ETC2_R8G8B8A1_SRGB_BLOCK, VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK},
2446 {angle::FormatID::ETC2_R8G8B8A1_UNORM_BLOCK, VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK},
2447 {angle::FormatID::ETC2_R8G8B8A8_SRGB_BLOCK, VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK},
2448 {angle::FormatID::ETC2_R8G8B8A8_UNORM_BLOCK, VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK},
2449 {angle::FormatID::ETC2_R8G8B8_SRGB_BLOCK, VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK},
2450 {angle::FormatID::ETC2_R8G8B8_UNORM_BLOCK, VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK},
2451 {angle::FormatID::G8_B8R8_2PLANE_420_UNORM, VK_FORMAT_G8_B8R8_2PLANE_420_UNORM},
2452 {angle::FormatID::G8_B8_R8_3PLANE_420_UNORM, VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM},
2453 {angle::FormatID::NONE, VK_FORMAT_UNDEFINED},
2454 {angle::FormatID::R10G10B10A2_SINT, VK_FORMAT_A2B10G10R10_SINT_PACK32},
2455 {angle::FormatID::R10G10B10A2_SNORM, VK_FORMAT_A2B10G10R10_SNORM_PACK32},
2456 {angle::FormatID::R10G10B10A2_SSCALED, VK_FORMAT_A2B10G10R10_SSCALED_PACK32},
2457 {angle::FormatID::R10G10B10A2_UINT, VK_FORMAT_A2B10G10R10_UINT_PACK32},
2458 {angle::FormatID::R10G10B10A2_UNORM, VK_FORMAT_A2B10G10R10_UNORM_PACK32},
2459 {angle::FormatID::R10G10B10A2_USCALED, VK_FORMAT_A2B10G10R10_USCALED_PACK32},
2460 {angle::FormatID::R11G11B10_FLOAT, VK_FORMAT_B10G11R11_UFLOAT_PACK32},
2461 {angle::FormatID::R16G16B16A16_FLOAT, VK_FORMAT_R16G16B16A16_SFLOAT},
2462 {angle::FormatID::R16G16B16A16_SINT, VK_FORMAT_R16G16B16A16_SINT},
2463 {angle::FormatID::R16G16B16A16_SNORM, VK_FORMAT_R16G16B16A16_SNORM},
2464 {angle::FormatID::R16G16B16A16_SSCALED, VK_FORMAT_R16G16B16A16_SSCALED},
2465 {angle::FormatID::R16G16B16A16_UINT, VK_FORMAT_R16G16B16A16_UINT},
2466 {angle::FormatID::R16G16B16A16_UNORM, VK_FORMAT_R16G16B16A16_UNORM},
2467 {angle::FormatID::R16G16B16A16_USCALED, VK_FORMAT_R16G16B16A16_USCALED},
2468 {angle::FormatID::R16G16B16_FLOAT, VK_FORMAT_R16G16B16_SFLOAT},
2469 {angle::FormatID::R16G16B16_SINT, VK_FORMAT_R16G16B16_SINT},
2470 {angle::FormatID::R16G16B16_SNORM, VK_FORMAT_R16G16B16_SNORM},
2471 {angle::FormatID::R16G16B16_SSCALED, VK_FORMAT_R16G16B16_SSCALED},
2472 {angle::FormatID::R16G16B16_UINT, VK_FORMAT_R16G16B16_UINT},
2473 {angle::FormatID::R16G16B16_UNORM, VK_FORMAT_R16G16B16_UNORM},
2474 {angle::FormatID::R16G16B16_USCALED, VK_FORMAT_R16G16B16_USCALED},
2475 {angle::FormatID::R16G16_FLOAT, VK_FORMAT_R16G16_SFLOAT},
2476 {angle::FormatID::R16G16_SINT, VK_FORMAT_R16G16_SINT},
2477 {angle::FormatID::R16G16_SNORM, VK_FORMAT_R16G16_SNORM},
2478 {angle::FormatID::R16G16_SSCALED, VK_FORMAT_R16G16_SSCALED},
2479 {angle::FormatID::R16G16_UINT, VK_FORMAT_R16G16_UINT},
2480 {angle::FormatID::R16G16_UNORM, VK_FORMAT_R16G16_UNORM},
2481 {angle::FormatID::R16G16_USCALED, VK_FORMAT_R16G16_USCALED},
2482 {angle::FormatID::R16_FLOAT, VK_FORMAT_R16_SFLOAT},
2483 {angle::FormatID::R16_SINT, VK_FORMAT_R16_SINT},
2484 {angle::FormatID::R16_SNORM, VK_FORMAT_R16_SNORM},
2485 {angle::FormatID::R16_SSCALED, VK_FORMAT_R16_SSCALED},
2486 {angle::FormatID::R16_UINT, VK_FORMAT_R16_UINT},
2487 {angle::FormatID::R16_UNORM, VK_FORMAT_R16_UNORM},
2488 {angle::FormatID::R16_USCALED, VK_FORMAT_R16_USCALED},
2489 {angle::FormatID::R32G32B32A32_FLOAT, VK_FORMAT_R32G32B32A32_SFLOAT},
2490 {angle::FormatID::R32G32B32A32_SINT, VK_FORMAT_R32G32B32A32_SINT},
2491 {angle::FormatID::R32G32B32A32_UINT, VK_FORMAT_R32G32B32A32_UINT},
2492 {angle::FormatID::R32G32B32_FLOAT, VK_FORMAT_R32G32B32_SFLOAT},
2493 {angle::FormatID::R32G32B32_SINT, VK_FORMAT_R32G32B32_SINT},
2494 {angle::FormatID::R32G32B32_UINT, VK_FORMAT_R32G32B32_UINT},
2495 {angle::FormatID::R32G32_FLOAT, VK_FORMAT_R32G32_SFLOAT},
2496 {angle::FormatID::R32G32_SINT, VK_FORMAT_R32G32_SINT},
2497 {angle::FormatID::R32G32_UINT, VK_FORMAT_R32G32_UINT},
2498 {angle::FormatID::R32_FLOAT, VK_FORMAT_R32_SFLOAT},
2499 {angle::FormatID::R32_SINT, VK_FORMAT_R32_SINT},
2500 {angle::FormatID::R32_UINT, VK_FORMAT_R32_UINT},
2501 {angle::FormatID::R4G4B4A4_UNORM, VK_FORMAT_R4G4B4A4_UNORM_PACK16},
2502 {angle::FormatID::R5G5B5A1_UNORM, VK_FORMAT_R5G5B5A1_UNORM_PACK16},
2503 {angle::FormatID::R5G6B5_UNORM, VK_FORMAT_R5G6B5_UNORM_PACK16},
2504 {angle::FormatID::R8G8B8A8_SINT, VK_FORMAT_R8G8B8A8_SINT},
2505 {angle::FormatID::R8G8B8A8_SNORM, VK_FORMAT_R8G8B8A8_SNORM},
2506 {angle::FormatID::R8G8B8A8_SSCALED, VK_FORMAT_R8G8B8A8_SSCALED},
2507 {angle::FormatID::R8G8B8A8_UINT, VK_FORMAT_R8G8B8A8_UINT},
2508 {angle::FormatID::R8G8B8A8_UNORM, VK_FORMAT_R8G8B8A8_UNORM},
2509 {angle::FormatID::R8G8B8A8_UNORM_SRGB, VK_FORMAT_R8G8B8A8_SRGB},
2510 {angle::FormatID::R8G8B8A8_USCALED, VK_FORMAT_R8G8B8A8_USCALED},
2511 {angle::FormatID::R8G8B8_SINT, VK_FORMAT_R8G8B8_SINT},
2512 {angle::FormatID::R8G8B8_SNORM, VK_FORMAT_R8G8B8_SNORM},
2513 {angle::FormatID::R8G8B8_SSCALED, VK_FORMAT_R8G8B8_SSCALED},
2514 {angle::FormatID::R8G8B8_UINT, VK_FORMAT_R8G8B8_UINT},
2515 {angle::FormatID::R8G8B8_UNORM, VK_FORMAT_R8G8B8_UNORM},
2516 {angle::FormatID::R8G8B8_UNORM_SRGB, VK_FORMAT_R8G8B8_SRGB},
2517 {angle::FormatID::R8G8B8_USCALED, VK_FORMAT_R8G8B8_USCALED},
2518 {angle::FormatID::R8G8_SINT, VK_FORMAT_R8G8_SINT},
2519 {angle::FormatID::R8G8_SNORM, VK_FORMAT_R8G8_SNORM},
2520 {angle::FormatID::R8G8_SSCALED, VK_FORMAT_R8G8_SSCALED},
2521 {angle::FormatID::R8G8_UINT, VK_FORMAT_R8G8_UINT},
2522 {angle::FormatID::R8G8_UNORM, VK_FORMAT_R8G8_UNORM},
2523 {angle::FormatID::R8G8_UNORM_SRGB, VK_FORMAT_R8G8_SRGB},
2524 {angle::FormatID::R8G8_USCALED, VK_FORMAT_R8G8_USCALED},
2525 {angle::FormatID::R8_SINT, VK_FORMAT_R8_SINT},
2526 {angle::FormatID::R8_SNORM, VK_FORMAT_R8_SNORM},
2527 {angle::FormatID::R8_SSCALED, VK_FORMAT_R8_SSCALED},
2528 {angle::FormatID::R8_UINT, VK_FORMAT_R8_UINT},
2529 {angle::FormatID::R8_UNORM, VK_FORMAT_R8_UNORM},
2530 {angle::FormatID::R8_UNORM_SRGB, VK_FORMAT_R8_SRGB},
2531 {angle::FormatID::R8_USCALED, VK_FORMAT_R8_USCALED},
2532 {angle::FormatID::R9G9B9E5_SHAREDEXP, VK_FORMAT_E5B9G9R9_UFLOAT_PACK32},
2533 {angle::FormatID::S8_UINT, VK_FORMAT_S8_UINT}};
2534
2535 return kMap[formatID];
2536 }
2537
GetFormatIDFromVkFormat(VkFormat vkFormat)2538 angle::FormatID GetFormatIDFromVkFormat(VkFormat vkFormat)
2539 {
2540 switch (vkFormat)
2541 {
2542 case VK_FORMAT_A1R5G5B5_UNORM_PACK16:
2543 return angle::FormatID::A1R5G5B5_UNORM;
2544 case VK_FORMAT_ASTC_10x10_SRGB_BLOCK:
2545 return angle::FormatID::ASTC_10x10_SRGB_BLOCK;
2546 case VK_FORMAT_ASTC_10x10_UNORM_BLOCK:
2547 return angle::FormatID::ASTC_10x10_UNORM_BLOCK;
2548 case VK_FORMAT_ASTC_10x5_SRGB_BLOCK:
2549 return angle::FormatID::ASTC_10x5_SRGB_BLOCK;
2550 case VK_FORMAT_ASTC_10x5_UNORM_BLOCK:
2551 return angle::FormatID::ASTC_10x5_UNORM_BLOCK;
2552 case VK_FORMAT_ASTC_10x6_SRGB_BLOCK:
2553 return angle::FormatID::ASTC_10x6_SRGB_BLOCK;
2554 case VK_FORMAT_ASTC_10x6_UNORM_BLOCK:
2555 return angle::FormatID::ASTC_10x6_UNORM_BLOCK;
2556 case VK_FORMAT_ASTC_10x8_SRGB_BLOCK:
2557 return angle::FormatID::ASTC_10x8_SRGB_BLOCK;
2558 case VK_FORMAT_ASTC_10x8_UNORM_BLOCK:
2559 return angle::FormatID::ASTC_10x8_UNORM_BLOCK;
2560 case VK_FORMAT_ASTC_12x10_SRGB_BLOCK:
2561 return angle::FormatID::ASTC_12x10_SRGB_BLOCK;
2562 case VK_FORMAT_ASTC_12x10_UNORM_BLOCK:
2563 return angle::FormatID::ASTC_12x10_UNORM_BLOCK;
2564 case VK_FORMAT_ASTC_12x12_SRGB_BLOCK:
2565 return angle::FormatID::ASTC_12x12_SRGB_BLOCK;
2566 case VK_FORMAT_ASTC_12x12_UNORM_BLOCK:
2567 return angle::FormatID::ASTC_12x12_UNORM_BLOCK;
2568 case VK_FORMAT_ASTC_4x4_SRGB_BLOCK:
2569 return angle::FormatID::ASTC_4x4_SRGB_BLOCK;
2570 case VK_FORMAT_ASTC_4x4_UNORM_BLOCK:
2571 return angle::FormatID::ASTC_4x4_UNORM_BLOCK;
2572 case VK_FORMAT_ASTC_5x4_SRGB_BLOCK:
2573 return angle::FormatID::ASTC_5x4_SRGB_BLOCK;
2574 case VK_FORMAT_ASTC_5x4_UNORM_BLOCK:
2575 return angle::FormatID::ASTC_5x4_UNORM_BLOCK;
2576 case VK_FORMAT_ASTC_5x5_SRGB_BLOCK:
2577 return angle::FormatID::ASTC_5x5_SRGB_BLOCK;
2578 case VK_FORMAT_ASTC_5x5_UNORM_BLOCK:
2579 return angle::FormatID::ASTC_5x5_UNORM_BLOCK;
2580 case VK_FORMAT_ASTC_6x5_SRGB_BLOCK:
2581 return angle::FormatID::ASTC_6x5_SRGB_BLOCK;
2582 case VK_FORMAT_ASTC_6x5_UNORM_BLOCK:
2583 return angle::FormatID::ASTC_6x5_UNORM_BLOCK;
2584 case VK_FORMAT_ASTC_6x6_SRGB_BLOCK:
2585 return angle::FormatID::ASTC_6x6_SRGB_BLOCK;
2586 case VK_FORMAT_ASTC_6x6_UNORM_BLOCK:
2587 return angle::FormatID::ASTC_6x6_UNORM_BLOCK;
2588 case VK_FORMAT_ASTC_8x5_SRGB_BLOCK:
2589 return angle::FormatID::ASTC_8x5_SRGB_BLOCK;
2590 case VK_FORMAT_ASTC_8x5_UNORM_BLOCK:
2591 return angle::FormatID::ASTC_8x5_UNORM_BLOCK;
2592 case VK_FORMAT_ASTC_8x6_SRGB_BLOCK:
2593 return angle::FormatID::ASTC_8x6_SRGB_BLOCK;
2594 case VK_FORMAT_ASTC_8x6_UNORM_BLOCK:
2595 return angle::FormatID::ASTC_8x6_UNORM_BLOCK;
2596 case VK_FORMAT_ASTC_8x8_SRGB_BLOCK:
2597 return angle::FormatID::ASTC_8x8_SRGB_BLOCK;
2598 case VK_FORMAT_ASTC_8x8_UNORM_BLOCK:
2599 return angle::FormatID::ASTC_8x8_UNORM_BLOCK;
2600 case VK_FORMAT_A2R10G10B10_UNORM_PACK32:
2601 return angle::FormatID::B10G10R10A2_UNORM;
2602 case VK_FORMAT_B4G4R4A4_UNORM_PACK16:
2603 return angle::FormatID::B4G4R4A4_UNORM;
2604 case VK_FORMAT_B5G5R5A1_UNORM_PACK16:
2605 return angle::FormatID::B5G5R5A1_UNORM;
2606 case VK_FORMAT_B5G6R5_UNORM_PACK16:
2607 return angle::FormatID::B5G6R5_UNORM;
2608 case VK_FORMAT_B8G8R8A8_UNORM:
2609 return angle::FormatID::B8G8R8A8_UNORM;
2610 case VK_FORMAT_B8G8R8A8_SRGB:
2611 return angle::FormatID::B8G8R8A8_UNORM_SRGB;
2612 case VK_FORMAT_BC1_RGBA_UNORM_BLOCK:
2613 return angle::FormatID::BC1_RGBA_UNORM_BLOCK;
2614 case VK_FORMAT_BC1_RGBA_SRGB_BLOCK:
2615 return angle::FormatID::BC1_RGBA_UNORM_SRGB_BLOCK;
2616 case VK_FORMAT_BC1_RGB_UNORM_BLOCK:
2617 return angle::FormatID::BC1_RGB_UNORM_BLOCK;
2618 case VK_FORMAT_BC1_RGB_SRGB_BLOCK:
2619 return angle::FormatID::BC1_RGB_UNORM_SRGB_BLOCK;
2620 case VK_FORMAT_BC2_UNORM_BLOCK:
2621 return angle::FormatID::BC2_RGBA_UNORM_BLOCK;
2622 case VK_FORMAT_BC2_SRGB_BLOCK:
2623 return angle::FormatID::BC2_RGBA_UNORM_SRGB_BLOCK;
2624 case VK_FORMAT_BC3_UNORM_BLOCK:
2625 return angle::FormatID::BC3_RGBA_UNORM_BLOCK;
2626 case VK_FORMAT_BC3_SRGB_BLOCK:
2627 return angle::FormatID::BC3_RGBA_UNORM_SRGB_BLOCK;
2628 case VK_FORMAT_BC4_SNORM_BLOCK:
2629 return angle::FormatID::BC4_RED_SNORM_BLOCK;
2630 case VK_FORMAT_BC4_UNORM_BLOCK:
2631 return angle::FormatID::BC4_RED_UNORM_BLOCK;
2632 case VK_FORMAT_BC5_SNORM_BLOCK:
2633 return angle::FormatID::BC5_RG_SNORM_BLOCK;
2634 case VK_FORMAT_BC5_UNORM_BLOCK:
2635 return angle::FormatID::BC5_RG_UNORM_BLOCK;
2636 case VK_FORMAT_BC6H_SFLOAT_BLOCK:
2637 return angle::FormatID::BC6H_RGB_SFLOAT_BLOCK;
2638 case VK_FORMAT_BC6H_UFLOAT_BLOCK:
2639 return angle::FormatID::BC6H_RGB_UFLOAT_BLOCK;
2640 case VK_FORMAT_BC7_UNORM_BLOCK:
2641 return angle::FormatID::BC7_RGBA_UNORM_BLOCK;
2642 case VK_FORMAT_BC7_SRGB_BLOCK:
2643 return angle::FormatID::BC7_RGBA_UNORM_SRGB_BLOCK;
2644 case VK_FORMAT_D16_UNORM:
2645 return angle::FormatID::D16_UNORM;
2646 case VK_FORMAT_D24_UNORM_S8_UINT:
2647 return angle::FormatID::D24_UNORM_S8_UINT;
2648 case VK_FORMAT_X8_D24_UNORM_PACK32:
2649 return angle::FormatID::D24_UNORM_X8_UINT;
2650 case VK_FORMAT_D32_SFLOAT:
2651 return angle::FormatID::D32_FLOAT;
2652 case VK_FORMAT_D32_SFLOAT_S8_UINT:
2653 return angle::FormatID::D32_FLOAT_S8X24_UINT;
2654 case VK_FORMAT_EAC_R11G11_SNORM_BLOCK:
2655 return angle::FormatID::EAC_R11G11_SNORM_BLOCK;
2656 case VK_FORMAT_EAC_R11G11_UNORM_BLOCK:
2657 return angle::FormatID::EAC_R11G11_UNORM_BLOCK;
2658 case VK_FORMAT_EAC_R11_SNORM_BLOCK:
2659 return angle::FormatID::EAC_R11_SNORM_BLOCK;
2660 case VK_FORMAT_EAC_R11_UNORM_BLOCK:
2661 return angle::FormatID::EAC_R11_UNORM_BLOCK;
2662 case VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK:
2663 return angle::FormatID::ETC2_R8G8B8A1_SRGB_BLOCK;
2664 case VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK:
2665 return angle::FormatID::ETC2_R8G8B8A1_UNORM_BLOCK;
2666 case VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK:
2667 return angle::FormatID::ETC2_R8G8B8A8_SRGB_BLOCK;
2668 case VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK:
2669 return angle::FormatID::ETC2_R8G8B8A8_UNORM_BLOCK;
2670 case VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK:
2671 return angle::FormatID::ETC2_R8G8B8_SRGB_BLOCK;
2672 case VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK:
2673 return angle::FormatID::ETC2_R8G8B8_UNORM_BLOCK;
2674 case VK_FORMAT_G8_B8R8_2PLANE_420_UNORM:
2675 return angle::FormatID::G8_B8R8_2PLANE_420_UNORM;
2676 case VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM:
2677 return angle::FormatID::G8_B8_R8_3PLANE_420_UNORM;
2678 case VK_FORMAT_UNDEFINED:
2679 return angle::FormatID::NONE;
2680 case VK_FORMAT_A2B10G10R10_SINT_PACK32:
2681 return angle::FormatID::R10G10B10A2_SINT;
2682 case VK_FORMAT_A2B10G10R10_SNORM_PACK32:
2683 return angle::FormatID::R10G10B10A2_SNORM;
2684 case VK_FORMAT_A2B10G10R10_SSCALED_PACK32:
2685 return angle::FormatID::R10G10B10A2_SSCALED;
2686 case VK_FORMAT_A2B10G10R10_UINT_PACK32:
2687 return angle::FormatID::R10G10B10A2_UINT;
2688 case VK_FORMAT_A2B10G10R10_UNORM_PACK32:
2689 return angle::FormatID::R10G10B10A2_UNORM;
2690 case VK_FORMAT_A2B10G10R10_USCALED_PACK32:
2691 return angle::FormatID::R10G10B10A2_USCALED;
2692 case VK_FORMAT_B10G11R11_UFLOAT_PACK32:
2693 return angle::FormatID::R11G11B10_FLOAT;
2694 case VK_FORMAT_R16G16B16A16_SFLOAT:
2695 return angle::FormatID::R16G16B16A16_FLOAT;
2696 case VK_FORMAT_R16G16B16A16_SINT:
2697 return angle::FormatID::R16G16B16A16_SINT;
2698 case VK_FORMAT_R16G16B16A16_SNORM:
2699 return angle::FormatID::R16G16B16A16_SNORM;
2700 case VK_FORMAT_R16G16B16A16_SSCALED:
2701 return angle::FormatID::R16G16B16A16_SSCALED;
2702 case VK_FORMAT_R16G16B16A16_UINT:
2703 return angle::FormatID::R16G16B16A16_UINT;
2704 case VK_FORMAT_R16G16B16A16_UNORM:
2705 return angle::FormatID::R16G16B16A16_UNORM;
2706 case VK_FORMAT_R16G16B16A16_USCALED:
2707 return angle::FormatID::R16G16B16A16_USCALED;
2708 case VK_FORMAT_R16G16B16_SFLOAT:
2709 return angle::FormatID::R16G16B16_FLOAT;
2710 case VK_FORMAT_R16G16B16_SINT:
2711 return angle::FormatID::R16G16B16_SINT;
2712 case VK_FORMAT_R16G16B16_SNORM:
2713 return angle::FormatID::R16G16B16_SNORM;
2714 case VK_FORMAT_R16G16B16_SSCALED:
2715 return angle::FormatID::R16G16B16_SSCALED;
2716 case VK_FORMAT_R16G16B16_UINT:
2717 return angle::FormatID::R16G16B16_UINT;
2718 case VK_FORMAT_R16G16B16_UNORM:
2719 return angle::FormatID::R16G16B16_UNORM;
2720 case VK_FORMAT_R16G16B16_USCALED:
2721 return angle::FormatID::R16G16B16_USCALED;
2722 case VK_FORMAT_R16G16_SFLOAT:
2723 return angle::FormatID::R16G16_FLOAT;
2724 case VK_FORMAT_R16G16_SINT:
2725 return angle::FormatID::R16G16_SINT;
2726 case VK_FORMAT_R16G16_SNORM:
2727 return angle::FormatID::R16G16_SNORM;
2728 case VK_FORMAT_R16G16_SSCALED:
2729 return angle::FormatID::R16G16_SSCALED;
2730 case VK_FORMAT_R16G16_UINT:
2731 return angle::FormatID::R16G16_UINT;
2732 case VK_FORMAT_R16G16_UNORM:
2733 return angle::FormatID::R16G16_UNORM;
2734 case VK_FORMAT_R16G16_USCALED:
2735 return angle::FormatID::R16G16_USCALED;
2736 case VK_FORMAT_R16_SFLOAT:
2737 return angle::FormatID::R16_FLOAT;
2738 case VK_FORMAT_R16_SINT:
2739 return angle::FormatID::R16_SINT;
2740 case VK_FORMAT_R16_SNORM:
2741 return angle::FormatID::R16_SNORM;
2742 case VK_FORMAT_R16_SSCALED:
2743 return angle::FormatID::R16_SSCALED;
2744 case VK_FORMAT_R16_UINT:
2745 return angle::FormatID::R16_UINT;
2746 case VK_FORMAT_R16_UNORM:
2747 return angle::FormatID::R16_UNORM;
2748 case VK_FORMAT_R16_USCALED:
2749 return angle::FormatID::R16_USCALED;
2750 case VK_FORMAT_R32G32B32A32_SFLOAT:
2751 return angle::FormatID::R32G32B32A32_FLOAT;
2752 case VK_FORMAT_R32G32B32A32_SINT:
2753 return angle::FormatID::R32G32B32A32_SINT;
2754 case VK_FORMAT_R32G32B32A32_UINT:
2755 return angle::FormatID::R32G32B32A32_UINT;
2756 case VK_FORMAT_R32G32B32_SFLOAT:
2757 return angle::FormatID::R32G32B32_FLOAT;
2758 case VK_FORMAT_R32G32B32_SINT:
2759 return angle::FormatID::R32G32B32_SINT;
2760 case VK_FORMAT_R32G32B32_UINT:
2761 return angle::FormatID::R32G32B32_UINT;
2762 case VK_FORMAT_R32G32_SFLOAT:
2763 return angle::FormatID::R32G32_FLOAT;
2764 case VK_FORMAT_R32G32_SINT:
2765 return angle::FormatID::R32G32_SINT;
2766 case VK_FORMAT_R32G32_UINT:
2767 return angle::FormatID::R32G32_UINT;
2768 case VK_FORMAT_R32_SFLOAT:
2769 return angle::FormatID::R32_FLOAT;
2770 case VK_FORMAT_R32_SINT:
2771 return angle::FormatID::R32_SINT;
2772 case VK_FORMAT_R32_UINT:
2773 return angle::FormatID::R32_UINT;
2774 case VK_FORMAT_R4G4B4A4_UNORM_PACK16:
2775 return angle::FormatID::R4G4B4A4_UNORM;
2776 case VK_FORMAT_R5G5B5A1_UNORM_PACK16:
2777 return angle::FormatID::R5G5B5A1_UNORM;
2778 case VK_FORMAT_R5G6B5_UNORM_PACK16:
2779 return angle::FormatID::R5G6B5_UNORM;
2780 case VK_FORMAT_R8G8B8A8_SINT:
2781 return angle::FormatID::R8G8B8A8_SINT;
2782 case VK_FORMAT_R8G8B8A8_SNORM:
2783 return angle::FormatID::R8G8B8A8_SNORM;
2784 case VK_FORMAT_R8G8B8A8_SSCALED:
2785 return angle::FormatID::R8G8B8A8_SSCALED;
2786 case VK_FORMAT_R8G8B8A8_UINT:
2787 return angle::FormatID::R8G8B8A8_UINT;
2788 case VK_FORMAT_R8G8B8A8_UNORM:
2789 return angle::FormatID::R8G8B8A8_UNORM;
2790 case VK_FORMAT_R8G8B8A8_SRGB:
2791 return angle::FormatID::R8G8B8A8_UNORM_SRGB;
2792 case VK_FORMAT_R8G8B8A8_USCALED:
2793 return angle::FormatID::R8G8B8A8_USCALED;
2794 case VK_FORMAT_R8G8B8_SINT:
2795 return angle::FormatID::R8G8B8_SINT;
2796 case VK_FORMAT_R8G8B8_SNORM:
2797 return angle::FormatID::R8G8B8_SNORM;
2798 case VK_FORMAT_R8G8B8_SSCALED:
2799 return angle::FormatID::R8G8B8_SSCALED;
2800 case VK_FORMAT_R8G8B8_UINT:
2801 return angle::FormatID::R8G8B8_UINT;
2802 case VK_FORMAT_R8G8B8_UNORM:
2803 return angle::FormatID::R8G8B8_UNORM;
2804 case VK_FORMAT_R8G8B8_SRGB:
2805 return angle::FormatID::R8G8B8_UNORM_SRGB;
2806 case VK_FORMAT_R8G8B8_USCALED:
2807 return angle::FormatID::R8G8B8_USCALED;
2808 case VK_FORMAT_R8G8_SINT:
2809 return angle::FormatID::R8G8_SINT;
2810 case VK_FORMAT_R8G8_SNORM:
2811 return angle::FormatID::R8G8_SNORM;
2812 case VK_FORMAT_R8G8_SSCALED:
2813 return angle::FormatID::R8G8_SSCALED;
2814 case VK_FORMAT_R8G8_UINT:
2815 return angle::FormatID::R8G8_UINT;
2816 case VK_FORMAT_R8G8_UNORM:
2817 return angle::FormatID::R8G8_UNORM;
2818 case VK_FORMAT_R8G8_SRGB:
2819 return angle::FormatID::R8G8_UNORM_SRGB;
2820 case VK_FORMAT_R8G8_USCALED:
2821 return angle::FormatID::R8G8_USCALED;
2822 case VK_FORMAT_R8_SINT:
2823 return angle::FormatID::R8_SINT;
2824 case VK_FORMAT_R8_SNORM:
2825 return angle::FormatID::R8_SNORM;
2826 case VK_FORMAT_R8_SSCALED:
2827 return angle::FormatID::R8_SSCALED;
2828 case VK_FORMAT_R8_UINT:
2829 return angle::FormatID::R8_UINT;
2830 case VK_FORMAT_R8_UNORM:
2831 return angle::FormatID::R8_UNORM;
2832 case VK_FORMAT_R8_SRGB:
2833 return angle::FormatID::R8_UNORM_SRGB;
2834 case VK_FORMAT_R8_USCALED:
2835 return angle::FormatID::R8_USCALED;
2836 case VK_FORMAT_E5B9G9R9_UFLOAT_PACK32:
2837 return angle::FormatID::R9G9B9E5_SHAREDEXP;
2838 case VK_FORMAT_S8_UINT:
2839 return angle::FormatID::S8_UINT;
2840
2841 default:
2842 UNREACHABLE();
2843 return angle::FormatID::NONE;
2844 }
2845 }
2846 } // namespace vk
2847 } // namespace rx
2848