xref: /aosp_15_r20/external/angle/src/libANGLE/renderer/metal/mtl_format_table_autogen.mm (revision 8975f5c5ed3d1c378011245431ada316dfb6f244)
1// GENERATED FILE - DO NOT EDIT.
2// Generated by gen_mtl_format_table.py using data from mtl_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// Metal Format table:
9//   Conversion from ANGLE format to Metal format.
10
11#import <Metal/Metal.h>
12#include <TargetConditionals.h>
13
14#include "image_util/copyimage.h"
15#include "image_util/generatemip.h"
16#include "image_util/loadimage.h"
17#include "libANGLE/renderer/Format.h"
18#include "libANGLE/renderer/metal/DisplayMtl.h"
19#include "libANGLE/renderer/metal/mtl_format_utils.h"
20#include "libANGLE/renderer/metal/mtl_utils.h"
21
22using namespace angle;
23
24namespace rx
25{
26namespace mtl
27{
28
29angle::FormatID Format::MetalToAngleFormatID(MTLPixelFormat formatMtl)
30{
31    // Actual conversion
32    switch (formatMtl)
33    {
34        case MTLPixelFormatA8Unorm:
35            return angle::FormatID::A8_UNORM;
36        case MTLPixelFormatBGR10A2Unorm:
37            return angle::FormatID::B10G10R10A2_UNORM;
38        case MTLPixelFormatBGRA8Unorm:
39            return angle::FormatID::B8G8R8A8_UNORM;
40        case MTLPixelFormatBGRA8Unorm_sRGB:
41            return angle::FormatID::B8G8R8A8_UNORM_SRGB;
42        case MTLPixelFormatDepth32Float:
43            return angle::FormatID::D32_FLOAT;
44        case MTLPixelFormatDepth32Float_Stencil8:
45            return angle::FormatID::D32_FLOAT_S8X24_UINT;
46        case MTLPixelFormatInvalid:
47            return angle::FormatID::NONE;
48        case MTLPixelFormatRGB10A2Uint:
49            return angle::FormatID::R10G10B10A2_UINT;
50        case MTLPixelFormatRGB10A2Unorm:
51            return angle::FormatID::R10G10B10A2_UNORM;
52        case MTLPixelFormatRG11B10Float:
53            return angle::FormatID::R11G11B10_FLOAT;
54        case MTLPixelFormatRGBA16Float:
55            return angle::FormatID::R16G16B16A16_FLOAT;
56        case MTLPixelFormatRGBA16Sint:
57            return angle::FormatID::R16G16B16A16_SINT;
58        case MTLPixelFormatRGBA16Snorm:
59            return angle::FormatID::R16G16B16A16_SNORM;
60        case MTLPixelFormatRGBA16Uint:
61            return angle::FormatID::R16G16B16A16_UINT;
62        case MTLPixelFormatRGBA16Unorm:
63            return angle::FormatID::R16G16B16A16_UNORM;
64        case MTLPixelFormatRG16Float:
65            return angle::FormatID::R16G16_FLOAT;
66        case MTLPixelFormatRG16Sint:
67            return angle::FormatID::R16G16_SINT;
68        case MTLPixelFormatRG16Snorm:
69            return angle::FormatID::R16G16_SNORM;
70        case MTLPixelFormatRG16Uint:
71            return angle::FormatID::R16G16_UINT;
72        case MTLPixelFormatRG16Unorm:
73            return angle::FormatID::R16G16_UNORM;
74        case MTLPixelFormatR16Float:
75            return angle::FormatID::R16_FLOAT;
76        case MTLPixelFormatR16Sint:
77            return angle::FormatID::R16_SINT;
78        case MTLPixelFormatR16Snorm:
79            return angle::FormatID::R16_SNORM;
80        case MTLPixelFormatR16Uint:
81            return angle::FormatID::R16_UINT;
82        case MTLPixelFormatR16Unorm:
83            return angle::FormatID::R16_UNORM;
84        case MTLPixelFormatRGBA32Float:
85            return angle::FormatID::R32G32B32A32_FLOAT;
86        case MTLPixelFormatRGBA32Sint:
87            return angle::FormatID::R32G32B32A32_SINT;
88        case MTLPixelFormatRGBA32Uint:
89            return angle::FormatID::R32G32B32A32_UINT;
90        case MTLPixelFormatRG32Float:
91            return angle::FormatID::R32G32_FLOAT;
92        case MTLPixelFormatRG32Sint:
93            return angle::FormatID::R32G32_SINT;
94        case MTLPixelFormatRG32Uint:
95            return angle::FormatID::R32G32_UINT;
96        case MTLPixelFormatR32Float:
97            return angle::FormatID::R32_FLOAT;
98        case MTLPixelFormatR32Sint:
99            return angle::FormatID::R32_SINT;
100        case MTLPixelFormatR32Uint:
101            return angle::FormatID::R32_UINT;
102        case MTLPixelFormatRGBA8Sint:
103            return angle::FormatID::R8G8B8A8_SINT;
104        case MTLPixelFormatRGBA8Snorm:
105            return angle::FormatID::R8G8B8A8_SNORM;
106        case MTLPixelFormatRGBA8Uint:
107            return angle::FormatID::R8G8B8A8_UINT;
108        case MTLPixelFormatRGBA8Unorm:
109            return angle::FormatID::R8G8B8A8_UNORM;
110        case MTLPixelFormatRGBA8Unorm_sRGB:
111            return angle::FormatID::R8G8B8A8_UNORM_SRGB;
112        case MTLPixelFormatRG8Sint:
113            return angle::FormatID::R8G8_SINT;
114        case MTLPixelFormatRG8Snorm:
115            return angle::FormatID::R8G8_SNORM;
116        case MTLPixelFormatRG8Uint:
117            return angle::FormatID::R8G8_UINT;
118        case MTLPixelFormatRG8Unorm:
119            return angle::FormatID::R8G8_UNORM;
120        case MTLPixelFormatR8Sint:
121            return angle::FormatID::R8_SINT;
122        case MTLPixelFormatR8Snorm:
123            return angle::FormatID::R8_SNORM;
124        case MTLPixelFormatR8Uint:
125            return angle::FormatID::R8_UINT;
126        case MTLPixelFormatR8Unorm:
127            return angle::FormatID::R8_UNORM;
128        case MTLPixelFormatRGB9E5Float:
129            return angle::FormatID::R9G9B9E5_SHAREDEXP;
130        case MTLPixelFormatStencil8:
131            return angle::FormatID::S8_UINT;
132#if TARGET_OS_OSX || TARGET_OS_MACCATALYST ||                       \
133    (TARGET_OS_IOS && __IPHONE_OS_VERSION_MAX_ALLOWED >= 160400) || \
134    (TARGET_OS_TV && __TV_OS_VERSION_MAX_ALLOWED >= 160400) || TARGET_OS_VISION
135        case MTLPixelFormatBC1_RGBA:
136            return angle::FormatID::BC1_RGBA_UNORM_BLOCK;
137        case MTLPixelFormatBC1_RGBA_sRGB:
138            return angle::FormatID::BC1_RGBA_UNORM_SRGB_BLOCK;
139        case MTLPixelFormatBC2_RGBA:
140            return angle::FormatID::BC2_RGBA_UNORM_BLOCK;
141        case MTLPixelFormatBC2_RGBA_sRGB:
142            return angle::FormatID::BC2_RGBA_UNORM_SRGB_BLOCK;
143        case MTLPixelFormatBC3_RGBA:
144            return angle::FormatID::BC3_RGBA_UNORM_BLOCK;
145        case MTLPixelFormatBC3_RGBA_sRGB:
146            return angle::FormatID::BC3_RGBA_UNORM_SRGB_BLOCK;
147        case MTLPixelFormatBC4_RSnorm:
148            return angle::FormatID::BC4_RED_SNORM_BLOCK;
149        case MTLPixelFormatBC4_RUnorm:
150            return angle::FormatID::BC4_RED_UNORM_BLOCK;
151        case MTLPixelFormatBC5_RGSnorm:
152            return angle::FormatID::BC5_RG_SNORM_BLOCK;
153        case MTLPixelFormatBC5_RGUnorm:
154            return angle::FormatID::BC5_RG_UNORM_BLOCK;
155        case MTLPixelFormatBC6H_RGBFloat:
156            return angle::FormatID::BC6H_RGB_SFLOAT_BLOCK;
157        case MTLPixelFormatBC6H_RGBUfloat:
158            return angle::FormatID::BC6H_RGB_UFLOAT_BLOCK;
159        case MTLPixelFormatBC7_RGBAUnorm:
160            return angle::FormatID::BC7_RGBA_UNORM_BLOCK;
161        case MTLPixelFormatBC7_RGBAUnorm_sRGB:
162            return angle::FormatID::BC7_RGBA_UNORM_SRGB_BLOCK;
163#endif  // BC formats
164#if TARGET_OS_OSX || TARGET_OS_MACCATALYST
165        case MTLPixelFormatDepth16Unorm:
166            return angle::FormatID::D16_UNORM;
167        case MTLPixelFormatDepth24Unorm_Stencil8:
168            return angle::FormatID::D24_UNORM_S8_UINT;
169#endif  // TARGET_OS_OSX || TARGET_OS_MACCATALYST
170#if TARGET_OS_IPHONE || (TARGET_OS_OSX && (__MAC_OS_X_VERSION_MAX_ALLOWED >= 110000))
171        case MTLPixelFormatASTC_10x10_sRGB:
172            return angle::FormatID::ASTC_10x10_SRGB_BLOCK;
173        case MTLPixelFormatASTC_10x5_sRGB:
174            return angle::FormatID::ASTC_10x5_SRGB_BLOCK;
175        case MTLPixelFormatASTC_10x6_sRGB:
176            return angle::FormatID::ASTC_10x6_SRGB_BLOCK;
177        case MTLPixelFormatASTC_10x8_sRGB:
178            return angle::FormatID::ASTC_10x8_SRGB_BLOCK;
179        case MTLPixelFormatASTC_12x10_sRGB:
180            return angle::FormatID::ASTC_12x10_SRGB_BLOCK;
181        case MTLPixelFormatASTC_12x12_sRGB:
182            return angle::FormatID::ASTC_12x12_SRGB_BLOCK;
183        case MTLPixelFormatASTC_4x4_sRGB:
184            return angle::FormatID::ASTC_4x4_SRGB_BLOCK;
185        case MTLPixelFormatASTC_5x4_sRGB:
186            return angle::FormatID::ASTC_5x4_SRGB_BLOCK;
187        case MTLPixelFormatASTC_5x5_sRGB:
188            return angle::FormatID::ASTC_5x5_SRGB_BLOCK;
189        case MTLPixelFormatASTC_6x5_sRGB:
190            return angle::FormatID::ASTC_6x5_SRGB_BLOCK;
191        case MTLPixelFormatASTC_6x6_sRGB:
192            return angle::FormatID::ASTC_6x6_SRGB_BLOCK;
193        case MTLPixelFormatASTC_8x5_sRGB:
194            return angle::FormatID::ASTC_8x5_SRGB_BLOCK;
195        case MTLPixelFormatASTC_8x6_sRGB:
196            return angle::FormatID::ASTC_8x6_SRGB_BLOCK;
197        case MTLPixelFormatASTC_8x8_sRGB:
198            return angle::FormatID::ASTC_8x8_SRGB_BLOCK;
199        case MTLPixelFormatEAC_RG11Snorm:
200            return angle::FormatID::EAC_R11G11_SNORM_BLOCK;
201        case MTLPixelFormatEAC_RG11Unorm:
202            return angle::FormatID::EAC_R11G11_UNORM_BLOCK;
203        case MTLPixelFormatEAC_R11Snorm:
204            return angle::FormatID::EAC_R11_SNORM_BLOCK;
205        case MTLPixelFormatEAC_R11Unorm:
206            return angle::FormatID::EAC_R11_UNORM_BLOCK;
207        case MTLPixelFormatETC2_RGB8A1_sRGB:
208            return angle::FormatID::ETC2_R8G8B8A1_SRGB_BLOCK;
209        case MTLPixelFormatETC2_RGB8A1:
210            return angle::FormatID::ETC2_R8G8B8A1_UNORM_BLOCK;
211        case MTLPixelFormatEAC_RGBA8_sRGB:
212            return angle::FormatID::ETC2_R8G8B8A8_SRGB_BLOCK;
213        case MTLPixelFormatEAC_RGBA8:
214            return angle::FormatID::ETC2_R8G8B8A8_UNORM_BLOCK;
215        case MTLPixelFormatETC2_RGB8_sRGB:
216            return angle::FormatID::ETC2_R8G8B8_SRGB_BLOCK;
217        case MTLPixelFormatETC2_RGB8:
218            return angle::FormatID::ETC2_R8G8B8_UNORM_BLOCK;
219        case MTLPixelFormatPVRTC_RGBA_2BPP:
220            return angle::FormatID::PVRTC1_RGBA_2BPP_UNORM_BLOCK;
221        case MTLPixelFormatPVRTC_RGBA_2BPP_sRGB:
222            return angle::FormatID::PVRTC1_RGBA_2BPP_UNORM_SRGB_BLOCK;
223        case MTLPixelFormatPVRTC_RGBA_4BPP:
224            return angle::FormatID::PVRTC1_RGBA_4BPP_UNORM_BLOCK;
225        case MTLPixelFormatPVRTC_RGBA_4BPP_sRGB:
226            return angle::FormatID::PVRTC1_RGBA_4BPP_UNORM_SRGB_BLOCK;
227        case MTLPixelFormatPVRTC_RGB_2BPP:
228            return angle::FormatID::PVRTC1_RGB_2BPP_UNORM_BLOCK;
229        case MTLPixelFormatPVRTC_RGB_2BPP_sRGB:
230            return angle::FormatID::PVRTC1_RGB_2BPP_UNORM_SRGB_BLOCK;
231        case MTLPixelFormatPVRTC_RGB_4BPP:
232            return angle::FormatID::PVRTC1_RGB_4BPP_UNORM_BLOCK;
233        case MTLPixelFormatPVRTC_RGB_4BPP_sRGB:
234            return angle::FormatID::PVRTC1_RGB_4BPP_UNORM_SRGB_BLOCK;
235        case MTLPixelFormatABGR4Unorm:
236            return angle::FormatID::R4G4B4A4_UNORM;
237        case MTLPixelFormatA1BGR5Unorm:
238            return angle::FormatID::R5G5B5A1_UNORM;
239        case MTLPixelFormatB5G6R5Unorm:
240            return angle::FormatID::R5G6B5_UNORM;
241        case MTLPixelFormatRG8Unorm_sRGB:
242            return angle::FormatID::R8G8_UNORM_SRGB;
243        case MTLPixelFormatR8Unorm_sRGB:
244            return angle::FormatID::R8_UNORM_SRGB;
245        case MTLPixelFormatASTC_10x10_LDR:
246            return angle::FormatID::ASTC_10x10_UNORM_BLOCK;
247        case MTLPixelFormatASTC_10x5_LDR:
248            return angle::FormatID::ASTC_10x5_UNORM_BLOCK;
249        case MTLPixelFormatASTC_10x6_LDR:
250            return angle::FormatID::ASTC_10x6_UNORM_BLOCK;
251        case MTLPixelFormatASTC_10x8_LDR:
252            return angle::FormatID::ASTC_10x8_UNORM_BLOCK;
253        case MTLPixelFormatASTC_12x10_LDR:
254            return angle::FormatID::ASTC_12x10_UNORM_BLOCK;
255        case MTLPixelFormatASTC_12x12_LDR:
256            return angle::FormatID::ASTC_12x12_UNORM_BLOCK;
257        case MTLPixelFormatASTC_4x4_LDR:
258            return angle::FormatID::ASTC_4x4_UNORM_BLOCK;
259        case MTLPixelFormatASTC_5x4_LDR:
260            return angle::FormatID::ASTC_5x4_UNORM_BLOCK;
261        case MTLPixelFormatASTC_5x5_LDR:
262            return angle::FormatID::ASTC_5x5_UNORM_BLOCK;
263        case MTLPixelFormatASTC_6x5_LDR:
264            return angle::FormatID::ASTC_6x5_UNORM_BLOCK;
265        case MTLPixelFormatASTC_6x6_LDR:
266            return angle::FormatID::ASTC_6x6_UNORM_BLOCK;
267        case MTLPixelFormatASTC_8x5_LDR:
268            return angle::FormatID::ASTC_8x5_UNORM_BLOCK;
269        case MTLPixelFormatASTC_8x6_LDR:
270            return angle::FormatID::ASTC_8x6_UNORM_BLOCK;
271        case MTLPixelFormatASTC_8x8_LDR:
272            return angle::FormatID::ASTC_8x8_UNORM_BLOCK;
273#    if TARGET_OS_IOS || TARGET_OS_OSX || TARGET_OS_VISION
274        case MTLPixelFormatASTC_10x10_HDR:
275            return angle::FormatID::ASTC_10x10_UNORM_BLOCK;
276        case MTLPixelFormatASTC_10x5_HDR:
277            return angle::FormatID::ASTC_10x5_UNORM_BLOCK;
278        case MTLPixelFormatASTC_10x6_HDR:
279            return angle::FormatID::ASTC_10x6_UNORM_BLOCK;
280        case MTLPixelFormatASTC_10x8_HDR:
281            return angle::FormatID::ASTC_10x8_UNORM_BLOCK;
282        case MTLPixelFormatASTC_12x10_HDR:
283            return angle::FormatID::ASTC_12x10_UNORM_BLOCK;
284        case MTLPixelFormatASTC_12x12_HDR:
285            return angle::FormatID::ASTC_12x12_UNORM_BLOCK;
286        case MTLPixelFormatASTC_4x4_HDR:
287            return angle::FormatID::ASTC_4x4_UNORM_BLOCK;
288        case MTLPixelFormatASTC_5x4_HDR:
289            return angle::FormatID::ASTC_5x4_UNORM_BLOCK;
290        case MTLPixelFormatASTC_5x5_HDR:
291            return angle::FormatID::ASTC_5x5_UNORM_BLOCK;
292        case MTLPixelFormatASTC_6x5_HDR:
293            return angle::FormatID::ASTC_6x5_UNORM_BLOCK;
294        case MTLPixelFormatASTC_6x6_HDR:
295            return angle::FormatID::ASTC_6x6_UNORM_BLOCK;
296        case MTLPixelFormatASTC_8x5_HDR:
297            return angle::FormatID::ASTC_8x5_UNORM_BLOCK;
298        case MTLPixelFormatASTC_8x6_HDR:
299            return angle::FormatID::ASTC_8x6_UNORM_BLOCK;
300        case MTLPixelFormatASTC_8x8_HDR:
301            return angle::FormatID::ASTC_8x8_UNORM_BLOCK;
302#    endif  // TARGET_OS_IOS || TARGET_OS_OSX || TARGET_OS_VISION
303#endif      // TARGET_OS_IPHONE || mac 11.0+
304        default:
305            return angle::FormatID::NONE;
306    }
307}
308
309void Format::init(const DisplayMtl *display, angle::FormatID intendedFormatId_)
310{
311    this->intendedFormatId = intendedFormatId_;
312#if TARGET_OS_OSX || TARGET_OS_MACCATALYST
313    id<MTLDevice> metalDevice = display->getMetalDevice();
314#endif
315
316    // Actual conversion
317    switch (this->intendedFormatId)
318    {
319        case angle::FormatID::A8_UNORM:
320
321            this->metalFormat    = MTLPixelFormatA8Unorm;
322            this->actualFormatId = angle::FormatID::A8_UNORM;
323            break;
324
325        case angle::FormatID::B10G10R10A2_UNORM:
326
327            this->metalFormat    = MTLPixelFormatBGR10A2Unorm;
328            this->actualFormatId = angle::FormatID::B10G10R10A2_UNORM;
329            break;
330
331        case angle::FormatID::B8G8R8A8_UNORM:
332
333            this->metalFormat    = MTLPixelFormatBGRA8Unorm;
334            this->actualFormatId = angle::FormatID::B8G8R8A8_UNORM;
335            break;
336
337        case angle::FormatID::B8G8R8A8_UNORM_SRGB:
338
339            this->metalFormat    = MTLPixelFormatBGRA8Unorm_sRGB;
340            this->actualFormatId = angle::FormatID::B8G8R8A8_UNORM_SRGB;
341            break;
342
343        case angle::FormatID::D32_FLOAT:
344
345            this->metalFormat    = MTLPixelFormatDepth32Float;
346            this->actualFormatId = angle::FormatID::D32_FLOAT;
347            break;
348
349        case angle::FormatID::D32_FLOAT_S8X24_UINT:
350
351            this->metalFormat    = MTLPixelFormatDepth32Float_Stencil8;
352            this->actualFormatId = angle::FormatID::D32_FLOAT_S8X24_UINT;
353            break;
354
355        case angle::FormatID::NONE:
356
357            this->metalFormat    = MTLPixelFormatInvalid;
358            this->actualFormatId = angle::FormatID::NONE;
359            break;
360
361        case angle::FormatID::R10G10B10A2_UINT:
362
363            this->metalFormat    = MTLPixelFormatRGB10A2Uint;
364            this->actualFormatId = angle::FormatID::R10G10B10A2_UINT;
365            break;
366
367        case angle::FormatID::R10G10B10A2_UNORM:
368
369            this->metalFormat    = MTLPixelFormatRGB10A2Unorm;
370            this->actualFormatId = angle::FormatID::R10G10B10A2_UNORM;
371            break;
372
373        case angle::FormatID::R11G11B10_FLOAT:
374
375            this->metalFormat    = MTLPixelFormatRG11B10Float;
376            this->actualFormatId = angle::FormatID::R11G11B10_FLOAT;
377            break;
378
379        case angle::FormatID::R16G16B16A16_FLOAT:
380
381            this->metalFormat    = MTLPixelFormatRGBA16Float;
382            this->actualFormatId = angle::FormatID::R16G16B16A16_FLOAT;
383            break;
384
385        case angle::FormatID::R16G16B16A16_SINT:
386
387            this->metalFormat    = MTLPixelFormatRGBA16Sint;
388            this->actualFormatId = angle::FormatID::R16G16B16A16_SINT;
389            break;
390
391        case angle::FormatID::R16G16B16A16_SNORM:
392
393            this->metalFormat    = MTLPixelFormatRGBA16Snorm;
394            this->actualFormatId = angle::FormatID::R16G16B16A16_SNORM;
395            break;
396
397        case angle::FormatID::R16G16B16A16_UINT:
398
399            this->metalFormat    = MTLPixelFormatRGBA16Uint;
400            this->actualFormatId = angle::FormatID::R16G16B16A16_UINT;
401            break;
402
403        case angle::FormatID::R16G16B16A16_UNORM:
404
405            this->metalFormat    = MTLPixelFormatRGBA16Unorm;
406            this->actualFormatId = angle::FormatID::R16G16B16A16_UNORM;
407            break;
408
409        case angle::FormatID::R16G16_FLOAT:
410
411            this->metalFormat    = MTLPixelFormatRG16Float;
412            this->actualFormatId = angle::FormatID::R16G16_FLOAT;
413            break;
414
415        case angle::FormatID::R16G16_SINT:
416
417            this->metalFormat    = MTLPixelFormatRG16Sint;
418            this->actualFormatId = angle::FormatID::R16G16_SINT;
419            break;
420
421        case angle::FormatID::R16G16_SNORM:
422
423            this->metalFormat    = MTLPixelFormatRG16Snorm;
424            this->actualFormatId = angle::FormatID::R16G16_SNORM;
425            break;
426
427        case angle::FormatID::R16G16_UINT:
428
429            this->metalFormat    = MTLPixelFormatRG16Uint;
430            this->actualFormatId = angle::FormatID::R16G16_UINT;
431            break;
432
433        case angle::FormatID::R16G16_UNORM:
434
435            this->metalFormat    = MTLPixelFormatRG16Unorm;
436            this->actualFormatId = angle::FormatID::R16G16_UNORM;
437            break;
438
439        case angle::FormatID::R16_FLOAT:
440
441            this->metalFormat    = MTLPixelFormatR16Float;
442            this->actualFormatId = angle::FormatID::R16_FLOAT;
443            break;
444
445        case angle::FormatID::R16_SINT:
446
447            this->metalFormat    = MTLPixelFormatR16Sint;
448            this->actualFormatId = angle::FormatID::R16_SINT;
449            break;
450
451        case angle::FormatID::R16_SNORM:
452
453            this->metalFormat    = MTLPixelFormatR16Snorm;
454            this->actualFormatId = angle::FormatID::R16_SNORM;
455            break;
456
457        case angle::FormatID::R16_UINT:
458
459            this->metalFormat    = MTLPixelFormatR16Uint;
460            this->actualFormatId = angle::FormatID::R16_UINT;
461            break;
462
463        case angle::FormatID::R16_UNORM:
464
465            this->metalFormat    = MTLPixelFormatR16Unorm;
466            this->actualFormatId = angle::FormatID::R16_UNORM;
467            break;
468
469        case angle::FormatID::R32G32B32A32_FLOAT:
470
471            this->metalFormat    = MTLPixelFormatRGBA32Float;
472            this->actualFormatId = angle::FormatID::R32G32B32A32_FLOAT;
473            break;
474
475        case angle::FormatID::R32G32B32A32_SINT:
476
477            this->metalFormat    = MTLPixelFormatRGBA32Sint;
478            this->actualFormatId = angle::FormatID::R32G32B32A32_SINT;
479            break;
480
481        case angle::FormatID::R32G32B32A32_UINT:
482
483            this->metalFormat    = MTLPixelFormatRGBA32Uint;
484            this->actualFormatId = angle::FormatID::R32G32B32A32_UINT;
485            break;
486
487        case angle::FormatID::R32G32_FLOAT:
488
489            this->metalFormat    = MTLPixelFormatRG32Float;
490            this->actualFormatId = angle::FormatID::R32G32_FLOAT;
491            break;
492
493        case angle::FormatID::R32G32_SINT:
494
495            this->metalFormat    = MTLPixelFormatRG32Sint;
496            this->actualFormatId = angle::FormatID::R32G32_SINT;
497            break;
498
499        case angle::FormatID::R32G32_UINT:
500
501            this->metalFormat    = MTLPixelFormatRG32Uint;
502            this->actualFormatId = angle::FormatID::R32G32_UINT;
503            break;
504
505        case angle::FormatID::R32_FLOAT:
506
507            this->metalFormat    = MTLPixelFormatR32Float;
508            this->actualFormatId = angle::FormatID::R32_FLOAT;
509            break;
510
511        case angle::FormatID::R32_SINT:
512
513            this->metalFormat    = MTLPixelFormatR32Sint;
514            this->actualFormatId = angle::FormatID::R32_SINT;
515            break;
516
517        case angle::FormatID::R32_UINT:
518
519            this->metalFormat    = MTLPixelFormatR32Uint;
520            this->actualFormatId = angle::FormatID::R32_UINT;
521            break;
522
523        case angle::FormatID::R8G8B8A8_SINT:
524
525            this->metalFormat    = MTLPixelFormatRGBA8Sint;
526            this->actualFormatId = angle::FormatID::R8G8B8A8_SINT;
527            break;
528
529        case angle::FormatID::R8G8B8A8_SNORM:
530
531            this->metalFormat    = MTLPixelFormatRGBA8Snorm;
532            this->actualFormatId = angle::FormatID::R8G8B8A8_SNORM;
533            break;
534
535        case angle::FormatID::R8G8B8A8_UINT:
536
537            this->metalFormat    = MTLPixelFormatRGBA8Uint;
538            this->actualFormatId = angle::FormatID::R8G8B8A8_UINT;
539            break;
540
541        case angle::FormatID::R8G8B8A8_UNORM:
542
543            this->metalFormat    = MTLPixelFormatRGBA8Unorm;
544            this->actualFormatId = angle::FormatID::R8G8B8A8_UNORM;
545            break;
546
547        case angle::FormatID::R8G8B8A8_UNORM_SRGB:
548
549            this->metalFormat    = MTLPixelFormatRGBA8Unorm_sRGB;
550            this->actualFormatId = angle::FormatID::R8G8B8A8_UNORM_SRGB;
551            break;
552
553        case angle::FormatID::R8G8_SINT:
554
555            this->metalFormat    = MTLPixelFormatRG8Sint;
556            this->actualFormatId = angle::FormatID::R8G8_SINT;
557            break;
558
559        case angle::FormatID::R8G8_SNORM:
560
561            this->metalFormat    = MTLPixelFormatRG8Snorm;
562            this->actualFormatId = angle::FormatID::R8G8_SNORM;
563            break;
564
565        case angle::FormatID::R8G8_UINT:
566
567            this->metalFormat    = MTLPixelFormatRG8Uint;
568            this->actualFormatId = angle::FormatID::R8G8_UINT;
569            break;
570
571        case angle::FormatID::R8G8_UNORM:
572
573            this->metalFormat    = MTLPixelFormatRG8Unorm;
574            this->actualFormatId = angle::FormatID::R8G8_UNORM;
575            break;
576
577        case angle::FormatID::R8_SINT:
578
579            this->metalFormat    = MTLPixelFormatR8Sint;
580            this->actualFormatId = angle::FormatID::R8_SINT;
581            break;
582
583        case angle::FormatID::R8_SNORM:
584
585            this->metalFormat    = MTLPixelFormatR8Snorm;
586            this->actualFormatId = angle::FormatID::R8_SNORM;
587            break;
588
589        case angle::FormatID::R8_UINT:
590
591            this->metalFormat    = MTLPixelFormatR8Uint;
592            this->actualFormatId = angle::FormatID::R8_UINT;
593            break;
594
595        case angle::FormatID::R8_UNORM:
596
597            this->metalFormat    = MTLPixelFormatR8Unorm;
598            this->actualFormatId = angle::FormatID::R8_UNORM;
599            break;
600
601        case angle::FormatID::R9G9B9E5_SHAREDEXP:
602
603            this->metalFormat    = MTLPixelFormatRGB9E5Float;
604            this->actualFormatId = angle::FormatID::R9G9B9E5_SHAREDEXP;
605            break;
606
607        case angle::FormatID::S8_UINT:
608
609            this->metalFormat    = MTLPixelFormatStencil8;
610            this->actualFormatId = angle::FormatID::S8_UINT;
611            break;
612
613        case angle::FormatID::A16_FLOAT:
614
615            this->metalFormat    = MTLPixelFormatRGBA16Float;
616            this->actualFormatId = angle::FormatID::R16G16B16A16_FLOAT;
617            break;
618
619        case angle::FormatID::A32_FLOAT:
620
621            this->metalFormat    = MTLPixelFormatRGBA32Float;
622            this->actualFormatId = angle::FormatID::R32G32B32A32_FLOAT;
623            break;
624
625        case angle::FormatID::B8G8R8X8_UNORM:
626
627            this->metalFormat    = MTLPixelFormatBGRA8Unorm;
628            this->actualFormatId = angle::FormatID::B8G8R8A8_UNORM;
629            break;
630
631        case angle::FormatID::B8G8R8X8_UNORM_SRGB:
632
633            this->metalFormat    = MTLPixelFormatBGRA8Unorm_sRGB;
634            this->actualFormatId = angle::FormatID::B8G8R8A8_UNORM_SRGB;
635            break;
636
637        case angle::FormatID::D24_UNORM_X8_UINT:
638
639            this->metalFormat    = MTLPixelFormatDepth32Float;
640            this->actualFormatId = angle::FormatID::D32_FLOAT;
641            break;
642
643        case angle::FormatID::D32_UNORM:
644
645            this->metalFormat    = MTLPixelFormatDepth32Float;
646            this->actualFormatId = angle::FormatID::D32_FLOAT;
647            break;
648
649        case angle::FormatID::L16A16_FLOAT:
650
651            this->metalFormat    = MTLPixelFormatRGBA16Float;
652            this->actualFormatId = angle::FormatID::R16G16B16A16_FLOAT;
653            break;
654
655        case angle::FormatID::L16_FLOAT:
656
657            this->metalFormat    = MTLPixelFormatRGBA16Float;
658            this->actualFormatId = angle::FormatID::R16G16B16A16_FLOAT;
659            this->initFunction =
660                Initialize4ComponentData<GLhalf, 0x0000, 0x0000, 0x0000, gl::Float16One>;
661            break;
662
663        case angle::FormatID::L32A32_FLOAT:
664
665            this->metalFormat    = MTLPixelFormatRGBA32Float;
666            this->actualFormatId = angle::FormatID::R32G32B32A32_FLOAT;
667            break;
668
669        case angle::FormatID::L32_FLOAT:
670
671            this->metalFormat    = MTLPixelFormatRGBA32Float;
672            this->actualFormatId = angle::FormatID::R32G32B32A32_FLOAT;
673            this->initFunction   = Initialize4ComponentData<GLfloat, 0x00000000, 0x00000000,
674                                                            0x00000000, gl::Float32One>;
675            break;
676
677        case angle::FormatID::L4A4_UNORM:
678
679            this->metalFormat    = MTLPixelFormatRGBA8Unorm;
680            this->actualFormatId = angle::FormatID::R8G8B8A8_UNORM;
681            break;
682
683        case angle::FormatID::L8A8_UNORM:
684
685            this->metalFormat    = MTLPixelFormatRGBA8Unorm;
686            this->actualFormatId = angle::FormatID::R8G8B8A8_UNORM;
687            break;
688
689        case angle::FormatID::L8_UNORM:
690
691            this->metalFormat    = MTLPixelFormatRGBA8Unorm;
692            this->actualFormatId = angle::FormatID::R8G8B8A8_UNORM;
693            this->initFunction   = Initialize4ComponentData<GLubyte, 0x00, 0x00, 0x00, 0xFF>;
694            break;
695
696        case angle::FormatID::R16G16B16_FLOAT:
697
698            this->metalFormat    = MTLPixelFormatRGBA16Float;
699            this->actualFormatId = angle::FormatID::R16G16B16A16_FLOAT;
700            this->initFunction =
701                Initialize4ComponentData<GLhalf, 0x0000, 0x0000, 0x0000, gl::Float16One>;
702            break;
703
704        case angle::FormatID::R16G16B16_SINT:
705
706            this->metalFormat    = MTLPixelFormatRGBA16Sint;
707            this->actualFormatId = angle::FormatID::R16G16B16A16_SINT;
708            this->initFunction = Initialize4ComponentData<GLshort, 0x0000, 0x0000, 0x0000, 0x0001>;
709            break;
710
711        case angle::FormatID::R16G16B16_SNORM:
712
713            this->metalFormat    = MTLPixelFormatRGBA16Snorm;
714            this->actualFormatId = angle::FormatID::R16G16B16A16_SNORM;
715            this->initFunction = Initialize4ComponentData<GLushort, 0x0000, 0x0000, 0x0000, 0x7FFF>;
716            break;
717
718        case angle::FormatID::R16G16B16_UINT:
719
720            this->metalFormat    = MTLPixelFormatRGBA16Uint;
721            this->actualFormatId = angle::FormatID::R16G16B16A16_UINT;
722            this->initFunction = Initialize4ComponentData<GLushort, 0x0000, 0x0000, 0x0000, 0x0001>;
723            break;
724
725        case angle::FormatID::R16G16B16_UNORM:
726
727            this->metalFormat    = MTLPixelFormatRGBA16Unorm;
728            this->actualFormatId = angle::FormatID::R16G16B16A16_UNORM;
729            this->initFunction = Initialize4ComponentData<GLushort, 0x0000, 0x0000, 0x0000, 0xFFFF>;
730            break;
731
732        case angle::FormatID::R32G32B32_FLOAT:
733
734            this->metalFormat    = MTLPixelFormatRGBA32Float;
735            this->actualFormatId = angle::FormatID::R32G32B32A32_FLOAT;
736            this->initFunction   = Initialize4ComponentData<GLfloat, 0x00000000, 0x00000000,
737                                                            0x00000000, gl::Float32One>;
738            break;
739
740        case angle::FormatID::R32G32B32_SINT:
741
742            this->metalFormat    = MTLPixelFormatRGBA32Sint;
743            this->actualFormatId = angle::FormatID::R32G32B32A32_SINT;
744            this->initFunction =
745                Initialize4ComponentData<GLint, 0x00000000, 0x00000000, 0x00000000, 0x00000001>;
746            break;
747
748        case angle::FormatID::R32G32B32_UINT:
749
750            this->metalFormat    = MTLPixelFormatRGBA32Uint;
751            this->actualFormatId = angle::FormatID::R32G32B32A32_UINT;
752            this->initFunction =
753                Initialize4ComponentData<GLuint, 0x00000000, 0x00000000, 0x00000000, 0x00000001>;
754            break;
755
756        case angle::FormatID::R8G8B8X8_UNORM:
757
758            this->metalFormat    = MTLPixelFormatRGBA8Unorm;
759            this->actualFormatId = angle::FormatID::R8G8B8A8_UNORM;
760            break;
761
762        case angle::FormatID::R8G8B8X8_UNORM_SRGB:
763
764            this->metalFormat    = MTLPixelFormatRGBA8Unorm_sRGB;
765            this->actualFormatId = angle::FormatID::R8G8B8A8_UNORM_SRGB;
766            break;
767
768        case angle::FormatID::R8G8B8_SINT:
769
770            this->metalFormat    = MTLPixelFormatRGBA8Sint;
771            this->actualFormatId = angle::FormatID::R8G8B8A8_SINT;
772            this->initFunction   = Initialize4ComponentData<GLbyte, 0x00, 0x00, 0x00, 0x01>;
773            break;
774
775        case angle::FormatID::R8G8B8_SNORM:
776
777            this->metalFormat    = MTLPixelFormatRGBA8Snorm;
778            this->actualFormatId = angle::FormatID::R8G8B8A8_SNORM;
779            this->initFunction   = Initialize4ComponentData<GLbyte, 0x00, 0x00, 0x00, 0x7F>;
780            break;
781
782        case angle::FormatID::R8G8B8_UINT:
783
784            this->metalFormat    = MTLPixelFormatRGBA8Uint;
785            this->actualFormatId = angle::FormatID::R8G8B8A8_UINT;
786            this->initFunction   = Initialize4ComponentData<GLubyte, 0x00, 0x00, 0x00, 0x01>;
787            break;
788
789        case angle::FormatID::R8G8B8_UNORM:
790
791            this->metalFormat    = MTLPixelFormatRGBA8Unorm;
792            this->actualFormatId = angle::FormatID::R8G8B8A8_UNORM;
793            this->initFunction   = Initialize4ComponentData<GLubyte, 0x00, 0x00, 0x00, 0xFF>;
794            break;
795
796        case angle::FormatID::R8G8B8_UNORM_SRGB:
797
798            this->metalFormat    = MTLPixelFormatRGBA8Unorm_sRGB;
799            this->actualFormatId = angle::FormatID::R8G8B8A8_UNORM_SRGB;
800            this->initFunction   = Initialize4ComponentData<GLubyte, 0x00, 0x00, 0x00, 0xFF>;
801            break;
802
803#if TARGET_OS_OSX || TARGET_OS_MACCATALYST
804        case angle::FormatID::BC1_RGBA_UNORM_BLOCK:
805
806            this->metalFormat    = MTLPixelFormatBC1_RGBA;
807            this->actualFormatId = angle::FormatID::BC1_RGBA_UNORM_BLOCK;
808            break;
809
810        case angle::FormatID::BC1_RGBA_UNORM_SRGB_BLOCK:
811
812            this->metalFormat    = MTLPixelFormatBC1_RGBA_sRGB;
813            this->actualFormatId = angle::FormatID::BC1_RGBA_UNORM_SRGB_BLOCK;
814            break;
815
816        case angle::FormatID::BC2_RGBA_UNORM_BLOCK:
817
818            this->metalFormat    = MTLPixelFormatBC2_RGBA;
819            this->actualFormatId = angle::FormatID::BC2_RGBA_UNORM_BLOCK;
820            break;
821
822        case angle::FormatID::BC2_RGBA_UNORM_SRGB_BLOCK:
823
824            this->metalFormat    = MTLPixelFormatBC2_RGBA_sRGB;
825            this->actualFormatId = angle::FormatID::BC2_RGBA_UNORM_SRGB_BLOCK;
826            break;
827
828        case angle::FormatID::BC3_RGBA_UNORM_BLOCK:
829
830            this->metalFormat    = MTLPixelFormatBC3_RGBA;
831            this->actualFormatId = angle::FormatID::BC3_RGBA_UNORM_BLOCK;
832            break;
833
834        case angle::FormatID::BC3_RGBA_UNORM_SRGB_BLOCK:
835
836            this->metalFormat    = MTLPixelFormatBC3_RGBA_sRGB;
837            this->actualFormatId = angle::FormatID::BC3_RGBA_UNORM_SRGB_BLOCK;
838            break;
839
840        case angle::FormatID::BC4_RED_SNORM_BLOCK:
841
842            this->metalFormat    = MTLPixelFormatBC4_RSnorm;
843            this->actualFormatId = angle::FormatID::BC4_RED_SNORM_BLOCK;
844            break;
845
846        case angle::FormatID::BC4_RED_UNORM_BLOCK:
847
848            this->metalFormat    = MTLPixelFormatBC4_RUnorm;
849            this->actualFormatId = angle::FormatID::BC4_RED_UNORM_BLOCK;
850            break;
851
852        case angle::FormatID::BC5_RG_SNORM_BLOCK:
853
854            this->metalFormat    = MTLPixelFormatBC5_RGSnorm;
855            this->actualFormatId = angle::FormatID::BC5_RG_SNORM_BLOCK;
856            break;
857
858        case angle::FormatID::BC5_RG_UNORM_BLOCK:
859
860            this->metalFormat    = MTLPixelFormatBC5_RGUnorm;
861            this->actualFormatId = angle::FormatID::BC5_RG_UNORM_BLOCK;
862            break;
863
864        case angle::FormatID::BC6H_RGB_SFLOAT_BLOCK:
865
866            this->metalFormat    = MTLPixelFormatBC6H_RGBFloat;
867            this->actualFormatId = angle::FormatID::BC6H_RGB_SFLOAT_BLOCK;
868            break;
869
870        case angle::FormatID::BC6H_RGB_UFLOAT_BLOCK:
871
872            this->metalFormat    = MTLPixelFormatBC6H_RGBUfloat;
873            this->actualFormatId = angle::FormatID::BC6H_RGB_UFLOAT_BLOCK;
874            break;
875
876        case angle::FormatID::BC7_RGBA_UNORM_BLOCK:
877
878            this->metalFormat    = MTLPixelFormatBC7_RGBAUnorm;
879            this->actualFormatId = angle::FormatID::BC7_RGBA_UNORM_BLOCK;
880            break;
881
882        case angle::FormatID::BC7_RGBA_UNORM_SRGB_BLOCK:
883
884            this->metalFormat    = MTLPixelFormatBC7_RGBAUnorm_sRGB;
885            this->actualFormatId = angle::FormatID::BC7_RGBA_UNORM_SRGB_BLOCK;
886            break;
887
888        case angle::FormatID::D16_UNORM:
889
890            if (display->supportsAppleGPUFamily(1))
891            {
892                this->metalFormat    = MTLPixelFormatDepth16Unorm;
893                this->actualFormatId = angle::FormatID::D16_UNORM;
894            }
895            else
896            {
897                this->metalFormat    = MTLPixelFormatDepth32Float;
898                this->actualFormatId = angle::FormatID::D32_FLOAT;
899            }
900            break;
901
902        case angle::FormatID::D24_UNORM_S8_UINT:
903
904            if (metalDevice.depth24Stencil8PixelFormatSupported &&
905                !display->getFeatures().forceD24S8AsUnsupported.enabled)
906            {
907                this->metalFormat    = MTLPixelFormatDepth24Unorm_Stencil8;
908                this->actualFormatId = angle::FormatID::D24_UNORM_S8_UINT;
909            }
910            else
911            {
912                this->metalFormat    = MTLPixelFormatDepth32Float_Stencil8;
913                this->actualFormatId = angle::FormatID::D32_FLOAT_S8X24_UINT;
914            }
915            break;
916
917        case angle::FormatID::BC1_RGB_UNORM_BLOCK:
918            if (display->getFeatures().hasTextureSwizzle.enabled)
919            {
920
921                this->metalFormat    = MTLPixelFormatBC1_RGBA;
922                this->actualFormatId = angle::FormatID::BC1_RGBA_UNORM_BLOCK;
923                this->swizzled       = true;
924                this->swizzle        = {GL_RED, GL_GREEN, GL_BLUE, GL_ONE};
925            }
926            else
927            {
928
929                this->metalFormat    = MTLPixelFormatBC1_RGBA;
930                this->actualFormatId = angle::FormatID::BC1_RGBA_UNORM_BLOCK;
931            }
932            break;
933
934        case angle::FormatID::BC1_RGB_UNORM_SRGB_BLOCK:
935            if (display->getFeatures().hasTextureSwizzle.enabled)
936            {
937
938                this->metalFormat    = MTLPixelFormatBC1_RGBA_sRGB;
939                this->actualFormatId = angle::FormatID::BC1_RGBA_UNORM_SRGB_BLOCK;
940                this->swizzled       = true;
941                this->swizzle        = {GL_RED, GL_GREEN, GL_BLUE, GL_ONE};
942            }
943            else
944            {
945
946                this->metalFormat    = MTLPixelFormatBC1_RGBA_sRGB;
947                this->actualFormatId = angle::FormatID::BC1_RGBA_UNORM_SRGB_BLOCK;
948            }
949            break;
950
951#endif
952#if (TARGET_OS_OSX && (__MAC_OS_X_VERSION_MAX_ALLOWED < 110000)) || TARGET_OS_MACCATALYST
953        case angle::FormatID::EAC_R11G11_SNORM_BLOCK:
954
955            this->metalFormat    = MTLPixelFormatRG16Snorm;
956            this->actualFormatId = angle::FormatID::R16G16_SNORM;
957            break;
958
959        case angle::FormatID::EAC_R11G11_UNORM_BLOCK:
960
961            this->metalFormat    = MTLPixelFormatRG16Unorm;
962            this->actualFormatId = angle::FormatID::R16G16_UNORM;
963            break;
964
965        case angle::FormatID::EAC_R11_SNORM_BLOCK:
966
967            this->metalFormat    = MTLPixelFormatR16Snorm;
968            this->actualFormatId = angle::FormatID::R16_SNORM;
969            break;
970
971        case angle::FormatID::EAC_R11_UNORM_BLOCK:
972
973            this->metalFormat    = MTLPixelFormatR16Unorm;
974            this->actualFormatId = angle::FormatID::R16_UNORM;
975            break;
976
977        case angle::FormatID::ETC1_R8G8B8_UNORM_BLOCK:
978
979            this->metalFormat    = MTLPixelFormatRGBA8Unorm;
980            this->actualFormatId = angle::FormatID::R8G8B8A8_UNORM;
981            this->initFunction   = Initialize4ComponentData<GLubyte, 0x00, 0x00, 0x00, 0xFF>;
982            break;
983
984        case angle::FormatID::ETC2_R8G8B8A1_SRGB_BLOCK:
985
986            this->metalFormat    = MTLPixelFormatRGBA8Unorm_sRGB;
987            this->actualFormatId = angle::FormatID::R8G8B8A8_UNORM_SRGB;
988            this->initFunction   = Initialize4ComponentData<GLubyte, 0x00, 0x00, 0x00, 0xFF>;
989            break;
990
991        case angle::FormatID::ETC2_R8G8B8A1_UNORM_BLOCK:
992
993            this->metalFormat    = MTLPixelFormatRGBA8Unorm;
994            this->actualFormatId = angle::FormatID::R8G8B8A8_UNORM;
995            this->initFunction   = Initialize4ComponentData<GLubyte, 0x00, 0x00, 0x00, 0xFF>;
996            break;
997
998        case angle::FormatID::ETC2_R8G8B8A8_SRGB_BLOCK:
999
1000            this->metalFormat    = MTLPixelFormatRGBA8Unorm_sRGB;
1001            this->actualFormatId = angle::FormatID::R8G8B8A8_UNORM_SRGB;
1002            break;
1003
1004        case angle::FormatID::ETC2_R8G8B8A8_UNORM_BLOCK:
1005
1006            this->metalFormat    = MTLPixelFormatRGBA8Unorm;
1007            this->actualFormatId = angle::FormatID::R8G8B8A8_UNORM;
1008            break;
1009
1010        case angle::FormatID::ETC2_R8G8B8_SRGB_BLOCK:
1011
1012            this->metalFormat    = MTLPixelFormatRGBA8Unorm_sRGB;
1013            this->actualFormatId = angle::FormatID::R8G8B8A8_UNORM_SRGB;
1014            this->initFunction   = Initialize4ComponentData<GLubyte, 0x00, 0x00, 0x00, 0xFF>;
1015            break;
1016
1017        case angle::FormatID::ETC2_R8G8B8_UNORM_BLOCK:
1018
1019            this->metalFormat    = MTLPixelFormatRGBA8Unorm;
1020            this->actualFormatId = angle::FormatID::R8G8B8A8_UNORM;
1021            this->initFunction   = Initialize4ComponentData<GLubyte, 0x00, 0x00, 0x00, 0xFF>;
1022            break;
1023
1024        case angle::FormatID::R4G4B4A4_UNORM:
1025
1026            this->metalFormat    = MTLPixelFormatRGBA8Unorm;
1027            this->actualFormatId = angle::FormatID::R8G8B8A8_UNORM;
1028            break;
1029
1030        case angle::FormatID::R5G5B5A1_UNORM:
1031
1032            this->metalFormat    = MTLPixelFormatRGBA8Unorm;
1033            this->actualFormatId = angle::FormatID::R8G8B8A8_UNORM;
1034            break;
1035
1036        case angle::FormatID::R5G6B5_UNORM:
1037
1038            this->metalFormat    = MTLPixelFormatRGBA8Unorm;
1039            this->actualFormatId = angle::FormatID::R8G8B8A8_UNORM;
1040            this->initFunction   = Initialize4ComponentData<GLubyte, 0x00, 0x00, 0x00, 0xFF>;
1041            break;
1042
1043#endif
1044#if TARGET_OS_SIMULATOR
1045        case angle::FormatID::ASTC_10x10_SRGB_BLOCK:
1046
1047            this->metalFormat    = MTLPixelFormatASTC_10x10_sRGB;
1048            this->actualFormatId = angle::FormatID::ASTC_10x10_SRGB_BLOCK;
1049            break;
1050
1051        case angle::FormatID::ASTC_10x5_SRGB_BLOCK:
1052
1053            this->metalFormat    = MTLPixelFormatASTC_10x5_sRGB;
1054            this->actualFormatId = angle::FormatID::ASTC_10x5_SRGB_BLOCK;
1055            break;
1056
1057        case angle::FormatID::ASTC_10x6_SRGB_BLOCK:
1058
1059            this->metalFormat    = MTLPixelFormatASTC_10x6_sRGB;
1060            this->actualFormatId = angle::FormatID::ASTC_10x6_SRGB_BLOCK;
1061            break;
1062
1063        case angle::FormatID::ASTC_10x8_SRGB_BLOCK:
1064
1065            this->metalFormat    = MTLPixelFormatASTC_10x8_sRGB;
1066            this->actualFormatId = angle::FormatID::ASTC_10x8_SRGB_BLOCK;
1067            break;
1068
1069        case angle::FormatID::ASTC_12x10_SRGB_BLOCK:
1070
1071            this->metalFormat    = MTLPixelFormatASTC_12x10_sRGB;
1072            this->actualFormatId = angle::FormatID::ASTC_12x10_SRGB_BLOCK;
1073            break;
1074
1075        case angle::FormatID::ASTC_12x12_SRGB_BLOCK:
1076
1077            this->metalFormat    = MTLPixelFormatASTC_12x12_sRGB;
1078            this->actualFormatId = angle::FormatID::ASTC_12x12_SRGB_BLOCK;
1079            break;
1080
1081        case angle::FormatID::ASTC_4x4_SRGB_BLOCK:
1082
1083            this->metalFormat    = MTLPixelFormatASTC_4x4_sRGB;
1084            this->actualFormatId = angle::FormatID::ASTC_4x4_SRGB_BLOCK;
1085            break;
1086
1087        case angle::FormatID::ASTC_5x4_SRGB_BLOCK:
1088
1089            this->metalFormat    = MTLPixelFormatASTC_5x4_sRGB;
1090            this->actualFormatId = angle::FormatID::ASTC_5x4_SRGB_BLOCK;
1091            break;
1092
1093        case angle::FormatID::ASTC_5x5_SRGB_BLOCK:
1094
1095            this->metalFormat    = MTLPixelFormatASTC_5x5_sRGB;
1096            this->actualFormatId = angle::FormatID::ASTC_5x5_SRGB_BLOCK;
1097            break;
1098
1099        case angle::FormatID::ASTC_6x5_SRGB_BLOCK:
1100
1101            this->metalFormat    = MTLPixelFormatASTC_6x5_sRGB;
1102            this->actualFormatId = angle::FormatID::ASTC_6x5_SRGB_BLOCK;
1103            break;
1104
1105        case angle::FormatID::ASTC_6x6_SRGB_BLOCK:
1106
1107            this->metalFormat    = MTLPixelFormatASTC_6x6_sRGB;
1108            this->actualFormatId = angle::FormatID::ASTC_6x6_SRGB_BLOCK;
1109            break;
1110
1111        case angle::FormatID::ASTC_8x5_SRGB_BLOCK:
1112
1113            this->metalFormat    = MTLPixelFormatASTC_8x5_sRGB;
1114            this->actualFormatId = angle::FormatID::ASTC_8x5_SRGB_BLOCK;
1115            break;
1116
1117        case angle::FormatID::ASTC_8x6_SRGB_BLOCK:
1118
1119            this->metalFormat    = MTLPixelFormatASTC_8x6_sRGB;
1120            this->actualFormatId = angle::FormatID::ASTC_8x6_SRGB_BLOCK;
1121            break;
1122
1123        case angle::FormatID::ASTC_8x8_SRGB_BLOCK:
1124
1125            this->metalFormat    = MTLPixelFormatASTC_8x8_sRGB;
1126            this->actualFormatId = angle::FormatID::ASTC_8x8_SRGB_BLOCK;
1127            break;
1128
1129        case angle::FormatID::EAC_R11G11_SNORM_BLOCK:
1130
1131            this->metalFormat    = MTLPixelFormatEAC_RG11Snorm;
1132            this->actualFormatId = angle::FormatID::EAC_R11G11_SNORM_BLOCK;
1133            break;
1134
1135        case angle::FormatID::EAC_R11G11_UNORM_BLOCK:
1136
1137            this->metalFormat    = MTLPixelFormatEAC_RG11Unorm;
1138            this->actualFormatId = angle::FormatID::EAC_R11G11_UNORM_BLOCK;
1139            break;
1140
1141        case angle::FormatID::EAC_R11_SNORM_BLOCK:
1142
1143            this->metalFormat    = MTLPixelFormatEAC_R11Snorm;
1144            this->actualFormatId = angle::FormatID::EAC_R11_SNORM_BLOCK;
1145            break;
1146
1147        case angle::FormatID::EAC_R11_UNORM_BLOCK:
1148
1149            this->metalFormat    = MTLPixelFormatEAC_R11Unorm;
1150            this->actualFormatId = angle::FormatID::EAC_R11_UNORM_BLOCK;
1151            break;
1152
1153        case angle::FormatID::ETC1_R8G8B8_UNORM_BLOCK:
1154
1155            this->metalFormat    = MTLPixelFormatETC2_RGB8;
1156            this->actualFormatId = angle::FormatID::ETC1_R8G8B8_UNORM_BLOCK;
1157            break;
1158
1159        case angle::FormatID::ETC2_R8G8B8A1_SRGB_BLOCK:
1160
1161            this->metalFormat    = MTLPixelFormatETC2_RGB8A1_sRGB;
1162            this->actualFormatId = angle::FormatID::ETC2_R8G8B8A1_SRGB_BLOCK;
1163            break;
1164
1165        case angle::FormatID::ETC2_R8G8B8A1_UNORM_BLOCK:
1166
1167            this->metalFormat    = MTLPixelFormatETC2_RGB8A1;
1168            this->actualFormatId = angle::FormatID::ETC2_R8G8B8A1_UNORM_BLOCK;
1169            break;
1170
1171        case angle::FormatID::ETC2_R8G8B8A8_SRGB_BLOCK:
1172
1173            this->metalFormat    = MTLPixelFormatEAC_RGBA8_sRGB;
1174            this->actualFormatId = angle::FormatID::ETC2_R8G8B8A8_SRGB_BLOCK;
1175            break;
1176
1177        case angle::FormatID::ETC2_R8G8B8A8_UNORM_BLOCK:
1178
1179            this->metalFormat    = MTLPixelFormatEAC_RGBA8;
1180            this->actualFormatId = angle::FormatID::ETC2_R8G8B8A8_UNORM_BLOCK;
1181            break;
1182
1183        case angle::FormatID::ETC2_R8G8B8_SRGB_BLOCK:
1184
1185            this->metalFormat    = MTLPixelFormatETC2_RGB8_sRGB;
1186            this->actualFormatId = angle::FormatID::ETC2_R8G8B8_SRGB_BLOCK;
1187            break;
1188
1189        case angle::FormatID::ETC2_R8G8B8_UNORM_BLOCK:
1190
1191            this->metalFormat    = MTLPixelFormatETC2_RGB8;
1192            this->actualFormatId = angle::FormatID::ETC2_R8G8B8_UNORM_BLOCK;
1193            break;
1194
1195        case angle::FormatID::D16_UNORM:
1196
1197            this->metalFormat    = MTLPixelFormatDepth32Float;
1198            this->actualFormatId = angle::FormatID::D32_FLOAT;
1199            break;
1200
1201        case angle::FormatID::D24_UNORM_S8_UINT:
1202
1203            this->metalFormat    = MTLPixelFormatDepth32Float_Stencil8;
1204            this->actualFormatId = angle::FormatID::D32_FLOAT_S8X24_UINT;
1205            break;
1206
1207        case angle::FormatID::R4G4B4A4_UNORM:
1208
1209            this->metalFormat    = MTLPixelFormatRGBA8Unorm;
1210            this->actualFormatId = angle::FormatID::R8G8B8A8_UNORM;
1211            break;
1212
1213        case angle::FormatID::R5G5B5A1_UNORM:
1214
1215            this->metalFormat    = MTLPixelFormatRGBA8Unorm;
1216            this->actualFormatId = angle::FormatID::R8G8B8A8_UNORM;
1217            break;
1218
1219        case angle::FormatID::R5G6B5_UNORM:
1220
1221            this->metalFormat    = MTLPixelFormatRGBA8Unorm;
1222            this->actualFormatId = angle::FormatID::R8G8B8A8_UNORM;
1223            this->initFunction   = Initialize4ComponentData<GLubyte, 0x00, 0x00, 0x00, 0xFF>;
1224            break;
1225
1226#    if TARGET_OS_IOS || TARGET_OS_VISION
1227        case angle::FormatID::ASTC_10x10_UNORM_BLOCK:
1228
1229            if (display->supportsAppleGPUFamily(6))
1230            {
1231                this->metalFormat    = MTLPixelFormatASTC_10x10_HDR;
1232                this->actualFormatId = angle::FormatID::ASTC_10x10_UNORM_BLOCK;
1233            }
1234            else
1235            {
1236                this->metalFormat    = MTLPixelFormatASTC_10x10_LDR;
1237                this->actualFormatId = angle::FormatID::ASTC_10x10_UNORM_BLOCK;
1238            }
1239            break;
1240
1241        case angle::FormatID::ASTC_10x5_UNORM_BLOCK:
1242
1243            if (display->supportsAppleGPUFamily(6))
1244            {
1245                this->metalFormat    = MTLPixelFormatASTC_10x5_HDR;
1246                this->actualFormatId = angle::FormatID::ASTC_10x5_UNORM_BLOCK;
1247            }
1248            else
1249            {
1250                this->metalFormat    = MTLPixelFormatASTC_10x5_LDR;
1251                this->actualFormatId = angle::FormatID::ASTC_10x5_UNORM_BLOCK;
1252            }
1253            break;
1254
1255        case angle::FormatID::ASTC_10x6_UNORM_BLOCK:
1256
1257            if (display->supportsAppleGPUFamily(6))
1258            {
1259                this->metalFormat    = MTLPixelFormatASTC_10x6_HDR;
1260                this->actualFormatId = angle::FormatID::ASTC_10x6_UNORM_BLOCK;
1261            }
1262            else
1263            {
1264                this->metalFormat    = MTLPixelFormatASTC_10x6_LDR;
1265                this->actualFormatId = angle::FormatID::ASTC_10x6_UNORM_BLOCK;
1266            }
1267            break;
1268
1269        case angle::FormatID::ASTC_10x8_UNORM_BLOCK:
1270
1271            if (display->supportsAppleGPUFamily(6))
1272            {
1273                this->metalFormat    = MTLPixelFormatASTC_10x8_HDR;
1274                this->actualFormatId = angle::FormatID::ASTC_10x8_UNORM_BLOCK;
1275            }
1276            else
1277            {
1278                this->metalFormat    = MTLPixelFormatASTC_10x8_LDR;
1279                this->actualFormatId = angle::FormatID::ASTC_10x8_UNORM_BLOCK;
1280            }
1281            break;
1282
1283        case angle::FormatID::ASTC_12x10_UNORM_BLOCK:
1284
1285            if (display->supportsAppleGPUFamily(6))
1286            {
1287                this->metalFormat    = MTLPixelFormatASTC_12x10_HDR;
1288                this->actualFormatId = angle::FormatID::ASTC_12x10_UNORM_BLOCK;
1289            }
1290            else
1291            {
1292                this->metalFormat    = MTLPixelFormatASTC_12x10_LDR;
1293                this->actualFormatId = angle::FormatID::ASTC_12x10_UNORM_BLOCK;
1294            }
1295            break;
1296
1297        case angle::FormatID::ASTC_12x12_UNORM_BLOCK:
1298
1299            if (display->supportsAppleGPUFamily(6))
1300            {
1301                this->metalFormat    = MTLPixelFormatASTC_12x12_HDR;
1302                this->actualFormatId = angle::FormatID::ASTC_12x12_UNORM_BLOCK;
1303            }
1304            else
1305            {
1306                this->metalFormat    = MTLPixelFormatASTC_12x12_LDR;
1307                this->actualFormatId = angle::FormatID::ASTC_12x12_UNORM_BLOCK;
1308            }
1309            break;
1310
1311        case angle::FormatID::ASTC_4x4_UNORM_BLOCK:
1312
1313            if (display->supportsAppleGPUFamily(6))
1314            {
1315                this->metalFormat    = MTLPixelFormatASTC_4x4_HDR;
1316                this->actualFormatId = angle::FormatID::ASTC_4x4_UNORM_BLOCK;
1317            }
1318            else
1319            {
1320                this->metalFormat    = MTLPixelFormatASTC_4x4_LDR;
1321                this->actualFormatId = angle::FormatID::ASTC_4x4_UNORM_BLOCK;
1322            }
1323            break;
1324
1325        case angle::FormatID::ASTC_5x4_UNORM_BLOCK:
1326
1327            if (display->supportsAppleGPUFamily(6))
1328            {
1329                this->metalFormat    = MTLPixelFormatASTC_5x4_HDR;
1330                this->actualFormatId = angle::FormatID::ASTC_5x4_UNORM_BLOCK;
1331            }
1332            else
1333            {
1334                this->metalFormat    = MTLPixelFormatASTC_5x4_LDR;
1335                this->actualFormatId = angle::FormatID::ASTC_5x4_UNORM_BLOCK;
1336            }
1337            break;
1338
1339        case angle::FormatID::ASTC_5x5_UNORM_BLOCK:
1340
1341            if (display->supportsAppleGPUFamily(6))
1342            {
1343                this->metalFormat    = MTLPixelFormatASTC_5x5_HDR;
1344                this->actualFormatId = angle::FormatID::ASTC_5x5_UNORM_BLOCK;
1345            }
1346            else
1347            {
1348                this->metalFormat    = MTLPixelFormatASTC_5x5_LDR;
1349                this->actualFormatId = angle::FormatID::ASTC_5x5_UNORM_BLOCK;
1350            }
1351            break;
1352
1353        case angle::FormatID::ASTC_6x5_UNORM_BLOCK:
1354
1355            if (display->supportsAppleGPUFamily(6))
1356            {
1357                this->metalFormat    = MTLPixelFormatASTC_6x5_HDR;
1358                this->actualFormatId = angle::FormatID::ASTC_6x5_UNORM_BLOCK;
1359            }
1360            else
1361            {
1362                this->metalFormat    = MTLPixelFormatASTC_6x5_LDR;
1363                this->actualFormatId = angle::FormatID::ASTC_6x5_UNORM_BLOCK;
1364            }
1365            break;
1366
1367        case angle::FormatID::ASTC_6x6_UNORM_BLOCK:
1368
1369            if (display->supportsAppleGPUFamily(6))
1370            {
1371                this->metalFormat    = MTLPixelFormatASTC_6x6_HDR;
1372                this->actualFormatId = angle::FormatID::ASTC_6x6_UNORM_BLOCK;
1373            }
1374            else
1375            {
1376                this->metalFormat    = MTLPixelFormatASTC_6x6_LDR;
1377                this->actualFormatId = angle::FormatID::ASTC_6x6_UNORM_BLOCK;
1378            }
1379            break;
1380
1381        case angle::FormatID::ASTC_8x5_UNORM_BLOCK:
1382
1383            if (display->supportsAppleGPUFamily(6))
1384            {
1385                this->metalFormat    = MTLPixelFormatASTC_8x5_HDR;
1386                this->actualFormatId = angle::FormatID::ASTC_8x5_UNORM_BLOCK;
1387            }
1388            else
1389            {
1390                this->metalFormat    = MTLPixelFormatASTC_8x5_LDR;
1391                this->actualFormatId = angle::FormatID::ASTC_8x5_UNORM_BLOCK;
1392            }
1393            break;
1394
1395        case angle::FormatID::ASTC_8x6_UNORM_BLOCK:
1396
1397            if (display->supportsAppleGPUFamily(6))
1398            {
1399                this->metalFormat    = MTLPixelFormatASTC_8x6_HDR;
1400                this->actualFormatId = angle::FormatID::ASTC_8x6_UNORM_BLOCK;
1401            }
1402            else
1403            {
1404                this->metalFormat    = MTLPixelFormatASTC_8x6_LDR;
1405                this->actualFormatId = angle::FormatID::ASTC_8x6_UNORM_BLOCK;
1406            }
1407            break;
1408
1409        case angle::FormatID::ASTC_8x8_UNORM_BLOCK:
1410
1411            if (display->supportsAppleGPUFamily(6))
1412            {
1413                this->metalFormat    = MTLPixelFormatASTC_8x8_HDR;
1414                this->actualFormatId = angle::FormatID::ASTC_8x8_UNORM_BLOCK;
1415            }
1416            else
1417            {
1418                this->metalFormat    = MTLPixelFormatASTC_8x8_LDR;
1419                this->actualFormatId = angle::FormatID::ASTC_8x8_UNORM_BLOCK;
1420            }
1421            break;
1422
1423#    elif TARGET_OS_TV || TARGET_OS_WATCH
1424        case angle::FormatID::ASTC_10x10_UNORM_BLOCK:
1425
1426            this->metalFormat    = MTLPixelFormatASTC_10x10_LDR;
1427            this->actualFormatId = angle::FormatID::ASTC_10x10_UNORM_BLOCK;
1428            break;
1429
1430        case angle::FormatID::ASTC_10x5_UNORM_BLOCK:
1431
1432            this->metalFormat    = MTLPixelFormatASTC_10x5_LDR;
1433            this->actualFormatId = angle::FormatID::ASTC_10x5_UNORM_BLOCK;
1434            break;
1435
1436        case angle::FormatID::ASTC_10x6_UNORM_BLOCK:
1437
1438            this->metalFormat    = MTLPixelFormatASTC_10x6_LDR;
1439            this->actualFormatId = angle::FormatID::ASTC_10x6_UNORM_BLOCK;
1440            break;
1441
1442        case angle::FormatID::ASTC_10x8_UNORM_BLOCK:
1443
1444            this->metalFormat    = MTLPixelFormatASTC_10x8_LDR;
1445            this->actualFormatId = angle::FormatID::ASTC_10x8_UNORM_BLOCK;
1446            break;
1447
1448        case angle::FormatID::ASTC_12x10_UNORM_BLOCK:
1449
1450            this->metalFormat    = MTLPixelFormatASTC_12x10_LDR;
1451            this->actualFormatId = angle::FormatID::ASTC_12x10_UNORM_BLOCK;
1452            break;
1453
1454        case angle::FormatID::ASTC_12x12_UNORM_BLOCK:
1455
1456            this->metalFormat    = MTLPixelFormatASTC_12x12_LDR;
1457            this->actualFormatId = angle::FormatID::ASTC_12x12_UNORM_BLOCK;
1458            break;
1459
1460        case angle::FormatID::ASTC_4x4_UNORM_BLOCK:
1461
1462            this->metalFormat    = MTLPixelFormatASTC_4x4_LDR;
1463            this->actualFormatId = angle::FormatID::ASTC_4x4_UNORM_BLOCK;
1464            break;
1465
1466        case angle::FormatID::ASTC_5x4_UNORM_BLOCK:
1467
1468            this->metalFormat    = MTLPixelFormatASTC_5x4_LDR;
1469            this->actualFormatId = angle::FormatID::ASTC_5x4_UNORM_BLOCK;
1470            break;
1471
1472        case angle::FormatID::ASTC_5x5_UNORM_BLOCK:
1473
1474            this->metalFormat    = MTLPixelFormatASTC_5x5_LDR;
1475            this->actualFormatId = angle::FormatID::ASTC_5x5_UNORM_BLOCK;
1476            break;
1477
1478        case angle::FormatID::ASTC_6x5_UNORM_BLOCK:
1479
1480            this->metalFormat    = MTLPixelFormatASTC_6x5_LDR;
1481            this->actualFormatId = angle::FormatID::ASTC_6x5_UNORM_BLOCK;
1482            break;
1483
1484        case angle::FormatID::ASTC_6x6_UNORM_BLOCK:
1485
1486            this->metalFormat    = MTLPixelFormatASTC_6x6_LDR;
1487            this->actualFormatId = angle::FormatID::ASTC_6x6_UNORM_BLOCK;
1488            break;
1489
1490        case angle::FormatID::ASTC_8x5_UNORM_BLOCK:
1491
1492            this->metalFormat    = MTLPixelFormatASTC_8x5_LDR;
1493            this->actualFormatId = angle::FormatID::ASTC_8x5_UNORM_BLOCK;
1494            break;
1495
1496        case angle::FormatID::ASTC_8x6_UNORM_BLOCK:
1497
1498            this->metalFormat    = MTLPixelFormatASTC_8x6_LDR;
1499            this->actualFormatId = angle::FormatID::ASTC_8x6_UNORM_BLOCK;
1500            break;
1501
1502        case angle::FormatID::ASTC_8x8_UNORM_BLOCK:
1503
1504            this->metalFormat    = MTLPixelFormatASTC_8x8_LDR;
1505            this->actualFormatId = angle::FormatID::ASTC_8x8_UNORM_BLOCK;
1506            break;
1507
1508#    endif  // ASTC formats
1509#    if (TARGET_OS_IOS && __IPHONE_OS_VERSION_MAX_ALLOWED >= 160400) || \
1510        (TARGET_OS_TV && __TV_OS_VERSION_MAX_ALLOWED >= 160400) || TARGET_OS_VISION
1511        case angle::FormatID::BC1_RGBA_UNORM_BLOCK:
1512
1513            this->metalFormat    = MTLPixelFormatBC1_RGBA;
1514            this->actualFormatId = angle::FormatID::BC1_RGBA_UNORM_BLOCK;
1515            break;
1516
1517        case angle::FormatID::BC1_RGBA_UNORM_SRGB_BLOCK:
1518
1519            this->metalFormat    = MTLPixelFormatBC1_RGBA_sRGB;
1520            this->actualFormatId = angle::FormatID::BC1_RGBA_UNORM_SRGB_BLOCK;
1521            break;
1522
1523        case angle::FormatID::BC2_RGBA_UNORM_BLOCK:
1524
1525            this->metalFormat    = MTLPixelFormatBC2_RGBA;
1526            this->actualFormatId = angle::FormatID::BC2_RGBA_UNORM_BLOCK;
1527            break;
1528
1529        case angle::FormatID::BC2_RGBA_UNORM_SRGB_BLOCK:
1530
1531            this->metalFormat    = MTLPixelFormatBC2_RGBA_sRGB;
1532            this->actualFormatId = angle::FormatID::BC2_RGBA_UNORM_SRGB_BLOCK;
1533            break;
1534
1535        case angle::FormatID::BC3_RGBA_UNORM_BLOCK:
1536
1537            this->metalFormat    = MTLPixelFormatBC3_RGBA;
1538            this->actualFormatId = angle::FormatID::BC3_RGBA_UNORM_BLOCK;
1539            break;
1540
1541        case angle::FormatID::BC3_RGBA_UNORM_SRGB_BLOCK:
1542
1543            this->metalFormat    = MTLPixelFormatBC3_RGBA_sRGB;
1544            this->actualFormatId = angle::FormatID::BC3_RGBA_UNORM_SRGB_BLOCK;
1545            break;
1546
1547        case angle::FormatID::BC4_RED_SNORM_BLOCK:
1548
1549            this->metalFormat    = MTLPixelFormatBC4_RSnorm;
1550            this->actualFormatId = angle::FormatID::BC4_RED_SNORM_BLOCK;
1551            break;
1552
1553        case angle::FormatID::BC4_RED_UNORM_BLOCK:
1554
1555            this->metalFormat    = MTLPixelFormatBC4_RUnorm;
1556            this->actualFormatId = angle::FormatID::BC4_RED_UNORM_BLOCK;
1557            break;
1558
1559        case angle::FormatID::BC5_RG_SNORM_BLOCK:
1560
1561            this->metalFormat    = MTLPixelFormatBC5_RGSnorm;
1562            this->actualFormatId = angle::FormatID::BC5_RG_SNORM_BLOCK;
1563            break;
1564
1565        case angle::FormatID::BC5_RG_UNORM_BLOCK:
1566
1567            this->metalFormat    = MTLPixelFormatBC5_RGUnorm;
1568            this->actualFormatId = angle::FormatID::BC5_RG_UNORM_BLOCK;
1569            break;
1570
1571        case angle::FormatID::BC6H_RGB_SFLOAT_BLOCK:
1572
1573            this->metalFormat    = MTLPixelFormatBC6H_RGBFloat;
1574            this->actualFormatId = angle::FormatID::BC6H_RGB_SFLOAT_BLOCK;
1575            break;
1576
1577        case angle::FormatID::BC6H_RGB_UFLOAT_BLOCK:
1578
1579            this->metalFormat    = MTLPixelFormatBC6H_RGBUfloat;
1580            this->actualFormatId = angle::FormatID::BC6H_RGB_UFLOAT_BLOCK;
1581            break;
1582
1583        case angle::FormatID::BC7_RGBA_UNORM_BLOCK:
1584
1585            this->metalFormat    = MTLPixelFormatBC7_RGBAUnorm;
1586            this->actualFormatId = angle::FormatID::BC7_RGBA_UNORM_BLOCK;
1587            break;
1588
1589        case angle::FormatID::BC7_RGBA_UNORM_SRGB_BLOCK:
1590
1591            this->metalFormat    = MTLPixelFormatBC7_RGBAUnorm_sRGB;
1592            this->actualFormatId = angle::FormatID::BC7_RGBA_UNORM_SRGB_BLOCK;
1593            break;
1594
1595        case angle::FormatID::BC1_RGB_UNORM_BLOCK:
1596            if (display->getFeatures().hasTextureSwizzle.enabled)
1597            {
1598
1599                this->metalFormat    = MTLPixelFormatBC1_RGBA;
1600                this->actualFormatId = angle::FormatID::BC1_RGBA_UNORM_BLOCK;
1601                this->swizzled       = true;
1602                this->swizzle        = {GL_RED, GL_GREEN, GL_BLUE, GL_ONE};
1603            }
1604            else
1605            {
1606
1607                this->metalFormat    = MTLPixelFormatBC1_RGBA;
1608                this->actualFormatId = angle::FormatID::BC1_RGBA_UNORM_BLOCK;
1609            }
1610            break;
1611
1612        case angle::FormatID::BC1_RGB_UNORM_SRGB_BLOCK:
1613            if (display->getFeatures().hasTextureSwizzle.enabled)
1614            {
1615
1616                this->metalFormat    = MTLPixelFormatBC1_RGBA_sRGB;
1617                this->actualFormatId = angle::FormatID::BC1_RGBA_UNORM_SRGB_BLOCK;
1618                this->swizzled       = true;
1619                this->swizzle        = {GL_RED, GL_GREEN, GL_BLUE, GL_ONE};
1620            }
1621            else
1622            {
1623
1624                this->metalFormat    = MTLPixelFormatBC1_RGBA_sRGB;
1625                this->actualFormatId = angle::FormatID::BC1_RGBA_UNORM_SRGB_BLOCK;
1626            }
1627            break;
1628
1629#    endif  // BC formats on iOS/tvOS/visionOS
1630#elif TARGET_OS_IPHONE && !TARGET_OS_MACCATALYST
1631        case angle::FormatID::ASTC_10x10_SRGB_BLOCK:
1632
1633            this->metalFormat    = MTLPixelFormatASTC_10x10_sRGB;
1634            this->actualFormatId = angle::FormatID::ASTC_10x10_SRGB_BLOCK;
1635            break;
1636
1637        case angle::FormatID::ASTC_10x5_SRGB_BLOCK:
1638
1639            this->metalFormat    = MTLPixelFormatASTC_10x5_sRGB;
1640            this->actualFormatId = angle::FormatID::ASTC_10x5_SRGB_BLOCK;
1641            break;
1642
1643        case angle::FormatID::ASTC_10x6_SRGB_BLOCK:
1644
1645            this->metalFormat    = MTLPixelFormatASTC_10x6_sRGB;
1646            this->actualFormatId = angle::FormatID::ASTC_10x6_SRGB_BLOCK;
1647            break;
1648
1649        case angle::FormatID::ASTC_10x8_SRGB_BLOCK:
1650
1651            this->metalFormat    = MTLPixelFormatASTC_10x8_sRGB;
1652            this->actualFormatId = angle::FormatID::ASTC_10x8_SRGB_BLOCK;
1653            break;
1654
1655        case angle::FormatID::ASTC_12x10_SRGB_BLOCK:
1656
1657            this->metalFormat    = MTLPixelFormatASTC_12x10_sRGB;
1658            this->actualFormatId = angle::FormatID::ASTC_12x10_SRGB_BLOCK;
1659            break;
1660
1661        case angle::FormatID::ASTC_12x12_SRGB_BLOCK:
1662
1663            this->metalFormat    = MTLPixelFormatASTC_12x12_sRGB;
1664            this->actualFormatId = angle::FormatID::ASTC_12x12_SRGB_BLOCK;
1665            break;
1666
1667        case angle::FormatID::ASTC_4x4_SRGB_BLOCK:
1668
1669            this->metalFormat    = MTLPixelFormatASTC_4x4_sRGB;
1670            this->actualFormatId = angle::FormatID::ASTC_4x4_SRGB_BLOCK;
1671            break;
1672
1673        case angle::FormatID::ASTC_5x4_SRGB_BLOCK:
1674
1675            this->metalFormat    = MTLPixelFormatASTC_5x4_sRGB;
1676            this->actualFormatId = angle::FormatID::ASTC_5x4_SRGB_BLOCK;
1677            break;
1678
1679        case angle::FormatID::ASTC_5x5_SRGB_BLOCK:
1680
1681            this->metalFormat    = MTLPixelFormatASTC_5x5_sRGB;
1682            this->actualFormatId = angle::FormatID::ASTC_5x5_SRGB_BLOCK;
1683            break;
1684
1685        case angle::FormatID::ASTC_6x5_SRGB_BLOCK:
1686
1687            this->metalFormat    = MTLPixelFormatASTC_6x5_sRGB;
1688            this->actualFormatId = angle::FormatID::ASTC_6x5_SRGB_BLOCK;
1689            break;
1690
1691        case angle::FormatID::ASTC_6x6_SRGB_BLOCK:
1692
1693            this->metalFormat    = MTLPixelFormatASTC_6x6_sRGB;
1694            this->actualFormatId = angle::FormatID::ASTC_6x6_SRGB_BLOCK;
1695            break;
1696
1697        case angle::FormatID::ASTC_8x5_SRGB_BLOCK:
1698
1699            this->metalFormat    = MTLPixelFormatASTC_8x5_sRGB;
1700            this->actualFormatId = angle::FormatID::ASTC_8x5_SRGB_BLOCK;
1701            break;
1702
1703        case angle::FormatID::ASTC_8x6_SRGB_BLOCK:
1704
1705            this->metalFormat    = MTLPixelFormatASTC_8x6_sRGB;
1706            this->actualFormatId = angle::FormatID::ASTC_8x6_SRGB_BLOCK;
1707            break;
1708
1709        case angle::FormatID::ASTC_8x8_SRGB_BLOCK:
1710
1711            this->metalFormat    = MTLPixelFormatASTC_8x8_sRGB;
1712            this->actualFormatId = angle::FormatID::ASTC_8x8_SRGB_BLOCK;
1713            break;
1714
1715        case angle::FormatID::D16_UNORM:
1716
1717            this->metalFormat    = MTLPixelFormatDepth16Unorm;
1718            this->actualFormatId = angle::FormatID::D16_UNORM;
1719            break;
1720
1721        case angle::FormatID::EAC_R11G11_SNORM_BLOCK:
1722
1723            this->metalFormat    = MTLPixelFormatEAC_RG11Snorm;
1724            this->actualFormatId = angle::FormatID::EAC_R11G11_SNORM_BLOCK;
1725            break;
1726
1727        case angle::FormatID::EAC_R11G11_UNORM_BLOCK:
1728
1729            this->metalFormat    = MTLPixelFormatEAC_RG11Unorm;
1730            this->actualFormatId = angle::FormatID::EAC_R11G11_UNORM_BLOCK;
1731            break;
1732
1733        case angle::FormatID::EAC_R11_SNORM_BLOCK:
1734
1735            this->metalFormat    = MTLPixelFormatEAC_R11Snorm;
1736            this->actualFormatId = angle::FormatID::EAC_R11_SNORM_BLOCK;
1737            break;
1738
1739        case angle::FormatID::EAC_R11_UNORM_BLOCK:
1740
1741            this->metalFormat    = MTLPixelFormatEAC_R11Unorm;
1742            this->actualFormatId = angle::FormatID::EAC_R11_UNORM_BLOCK;
1743            break;
1744
1745        case angle::FormatID::ETC1_R8G8B8_UNORM_BLOCK:
1746
1747            this->metalFormat    = MTLPixelFormatETC2_RGB8;
1748            this->actualFormatId = angle::FormatID::ETC1_R8G8B8_UNORM_BLOCK;
1749            break;
1750
1751        case angle::FormatID::ETC2_R8G8B8A1_SRGB_BLOCK:
1752
1753            this->metalFormat    = MTLPixelFormatETC2_RGB8A1_sRGB;
1754            this->actualFormatId = angle::FormatID::ETC2_R8G8B8A1_SRGB_BLOCK;
1755            break;
1756
1757        case angle::FormatID::ETC2_R8G8B8A1_UNORM_BLOCK:
1758
1759            this->metalFormat    = MTLPixelFormatETC2_RGB8A1;
1760            this->actualFormatId = angle::FormatID::ETC2_R8G8B8A1_UNORM_BLOCK;
1761            break;
1762
1763        case angle::FormatID::ETC2_R8G8B8A8_SRGB_BLOCK:
1764
1765            this->metalFormat    = MTLPixelFormatEAC_RGBA8_sRGB;
1766            this->actualFormatId = angle::FormatID::ETC2_R8G8B8A8_SRGB_BLOCK;
1767            break;
1768
1769        case angle::FormatID::ETC2_R8G8B8A8_UNORM_BLOCK:
1770
1771            this->metalFormat    = MTLPixelFormatEAC_RGBA8;
1772            this->actualFormatId = angle::FormatID::ETC2_R8G8B8A8_UNORM_BLOCK;
1773            break;
1774
1775        case angle::FormatID::ETC2_R8G8B8_SRGB_BLOCK:
1776
1777            this->metalFormat    = MTLPixelFormatETC2_RGB8_sRGB;
1778            this->actualFormatId = angle::FormatID::ETC2_R8G8B8_SRGB_BLOCK;
1779            break;
1780
1781        case angle::FormatID::ETC2_R8G8B8_UNORM_BLOCK:
1782
1783            this->metalFormat    = MTLPixelFormatETC2_RGB8;
1784            this->actualFormatId = angle::FormatID::ETC2_R8G8B8_UNORM_BLOCK;
1785            break;
1786
1787        case angle::FormatID::PVRTC1_RGBA_2BPP_UNORM_BLOCK:
1788
1789            this->metalFormat    = MTLPixelFormatPVRTC_RGBA_2BPP;
1790            this->actualFormatId = angle::FormatID::PVRTC1_RGBA_2BPP_UNORM_BLOCK;
1791            break;
1792
1793        case angle::FormatID::PVRTC1_RGBA_2BPP_UNORM_SRGB_BLOCK:
1794
1795            this->metalFormat    = MTLPixelFormatPVRTC_RGBA_2BPP_sRGB;
1796            this->actualFormatId = angle::FormatID::PVRTC1_RGBA_2BPP_UNORM_SRGB_BLOCK;
1797            break;
1798
1799        case angle::FormatID::PVRTC1_RGBA_4BPP_UNORM_BLOCK:
1800
1801            this->metalFormat    = MTLPixelFormatPVRTC_RGBA_4BPP;
1802            this->actualFormatId = angle::FormatID::PVRTC1_RGBA_4BPP_UNORM_BLOCK;
1803            break;
1804
1805        case angle::FormatID::PVRTC1_RGBA_4BPP_UNORM_SRGB_BLOCK:
1806
1807            this->metalFormat    = MTLPixelFormatPVRTC_RGBA_4BPP_sRGB;
1808            this->actualFormatId = angle::FormatID::PVRTC1_RGBA_4BPP_UNORM_SRGB_BLOCK;
1809            break;
1810
1811        case angle::FormatID::PVRTC1_RGB_2BPP_UNORM_BLOCK:
1812
1813            this->metalFormat    = MTLPixelFormatPVRTC_RGB_2BPP;
1814            this->actualFormatId = angle::FormatID::PVRTC1_RGB_2BPP_UNORM_BLOCK;
1815            break;
1816
1817        case angle::FormatID::PVRTC1_RGB_2BPP_UNORM_SRGB_BLOCK:
1818
1819            this->metalFormat    = MTLPixelFormatPVRTC_RGB_2BPP_sRGB;
1820            this->actualFormatId = angle::FormatID::PVRTC1_RGB_2BPP_UNORM_SRGB_BLOCK;
1821            break;
1822
1823        case angle::FormatID::PVRTC1_RGB_4BPP_UNORM_BLOCK:
1824
1825            this->metalFormat    = MTLPixelFormatPVRTC_RGB_4BPP;
1826            this->actualFormatId = angle::FormatID::PVRTC1_RGB_4BPP_UNORM_BLOCK;
1827            break;
1828
1829        case angle::FormatID::PVRTC1_RGB_4BPP_UNORM_SRGB_BLOCK:
1830
1831            this->metalFormat    = MTLPixelFormatPVRTC_RGB_4BPP_sRGB;
1832            this->actualFormatId = angle::FormatID::PVRTC1_RGB_4BPP_UNORM_SRGB_BLOCK;
1833            break;
1834
1835        case angle::FormatID::R4G4B4A4_UNORM:
1836
1837            this->metalFormat    = MTLPixelFormatABGR4Unorm;
1838            this->actualFormatId = angle::FormatID::R4G4B4A4_UNORM;
1839            break;
1840
1841        case angle::FormatID::R5G5B5A1_UNORM:
1842
1843            this->metalFormat    = MTLPixelFormatA1BGR5Unorm;
1844            this->actualFormatId = angle::FormatID::R5G5B5A1_UNORM;
1845            break;
1846
1847        case angle::FormatID::R5G6B5_UNORM:
1848
1849            this->metalFormat    = MTLPixelFormatB5G6R5Unorm;
1850            this->actualFormatId = angle::FormatID::R5G6B5_UNORM;
1851            break;
1852
1853        case angle::FormatID::R8G8_UNORM_SRGB:
1854
1855            this->metalFormat    = MTLPixelFormatRG8Unorm_sRGB;
1856            this->actualFormatId = angle::FormatID::R8G8_UNORM_SRGB;
1857            break;
1858
1859        case angle::FormatID::R8_UNORM_SRGB:
1860
1861            this->metalFormat    = MTLPixelFormatR8Unorm_sRGB;
1862            this->actualFormatId = angle::FormatID::R8_UNORM_SRGB;
1863            break;
1864
1865        case angle::FormatID::D24_UNORM_S8_UINT:
1866
1867            this->metalFormat    = MTLPixelFormatDepth32Float_Stencil8;
1868            this->actualFormatId = angle::FormatID::D32_FLOAT_S8X24_UINT;
1869            break;
1870
1871#    if TARGET_OS_IOS || TARGET_OS_VISION
1872        case angle::FormatID::ASTC_10x10_UNORM_BLOCK:
1873
1874            if (display->supportsAppleGPUFamily(6))
1875            {
1876                this->metalFormat    = MTLPixelFormatASTC_10x10_HDR;
1877                this->actualFormatId = angle::FormatID::ASTC_10x10_UNORM_BLOCK;
1878            }
1879            else
1880            {
1881                this->metalFormat    = MTLPixelFormatASTC_10x10_LDR;
1882                this->actualFormatId = angle::FormatID::ASTC_10x10_UNORM_BLOCK;
1883            }
1884            break;
1885
1886        case angle::FormatID::ASTC_10x5_UNORM_BLOCK:
1887
1888            if (display->supportsAppleGPUFamily(6))
1889            {
1890                this->metalFormat    = MTLPixelFormatASTC_10x5_HDR;
1891                this->actualFormatId = angle::FormatID::ASTC_10x5_UNORM_BLOCK;
1892            }
1893            else
1894            {
1895                this->metalFormat    = MTLPixelFormatASTC_10x5_LDR;
1896                this->actualFormatId = angle::FormatID::ASTC_10x5_UNORM_BLOCK;
1897            }
1898            break;
1899
1900        case angle::FormatID::ASTC_10x6_UNORM_BLOCK:
1901
1902            if (display->supportsAppleGPUFamily(6))
1903            {
1904                this->metalFormat    = MTLPixelFormatASTC_10x6_HDR;
1905                this->actualFormatId = angle::FormatID::ASTC_10x6_UNORM_BLOCK;
1906            }
1907            else
1908            {
1909                this->metalFormat    = MTLPixelFormatASTC_10x6_LDR;
1910                this->actualFormatId = angle::FormatID::ASTC_10x6_UNORM_BLOCK;
1911            }
1912            break;
1913
1914        case angle::FormatID::ASTC_10x8_UNORM_BLOCK:
1915
1916            if (display->supportsAppleGPUFamily(6))
1917            {
1918                this->metalFormat    = MTLPixelFormatASTC_10x8_HDR;
1919                this->actualFormatId = angle::FormatID::ASTC_10x8_UNORM_BLOCK;
1920            }
1921            else
1922            {
1923                this->metalFormat    = MTLPixelFormatASTC_10x8_LDR;
1924                this->actualFormatId = angle::FormatID::ASTC_10x8_UNORM_BLOCK;
1925            }
1926            break;
1927
1928        case angle::FormatID::ASTC_12x10_UNORM_BLOCK:
1929
1930            if (display->supportsAppleGPUFamily(6))
1931            {
1932                this->metalFormat    = MTLPixelFormatASTC_12x10_HDR;
1933                this->actualFormatId = angle::FormatID::ASTC_12x10_UNORM_BLOCK;
1934            }
1935            else
1936            {
1937                this->metalFormat    = MTLPixelFormatASTC_12x10_LDR;
1938                this->actualFormatId = angle::FormatID::ASTC_12x10_UNORM_BLOCK;
1939            }
1940            break;
1941
1942        case angle::FormatID::ASTC_12x12_UNORM_BLOCK:
1943
1944            if (display->supportsAppleGPUFamily(6))
1945            {
1946                this->metalFormat    = MTLPixelFormatASTC_12x12_HDR;
1947                this->actualFormatId = angle::FormatID::ASTC_12x12_UNORM_BLOCK;
1948            }
1949            else
1950            {
1951                this->metalFormat    = MTLPixelFormatASTC_12x12_LDR;
1952                this->actualFormatId = angle::FormatID::ASTC_12x12_UNORM_BLOCK;
1953            }
1954            break;
1955
1956        case angle::FormatID::ASTC_4x4_UNORM_BLOCK:
1957
1958            if (display->supportsAppleGPUFamily(6))
1959            {
1960                this->metalFormat    = MTLPixelFormatASTC_4x4_HDR;
1961                this->actualFormatId = angle::FormatID::ASTC_4x4_UNORM_BLOCK;
1962            }
1963            else
1964            {
1965                this->metalFormat    = MTLPixelFormatASTC_4x4_LDR;
1966                this->actualFormatId = angle::FormatID::ASTC_4x4_UNORM_BLOCK;
1967            }
1968            break;
1969
1970        case angle::FormatID::ASTC_5x4_UNORM_BLOCK:
1971
1972            if (display->supportsAppleGPUFamily(6))
1973            {
1974                this->metalFormat    = MTLPixelFormatASTC_5x4_HDR;
1975                this->actualFormatId = angle::FormatID::ASTC_5x4_UNORM_BLOCK;
1976            }
1977            else
1978            {
1979                this->metalFormat    = MTLPixelFormatASTC_5x4_LDR;
1980                this->actualFormatId = angle::FormatID::ASTC_5x4_UNORM_BLOCK;
1981            }
1982            break;
1983
1984        case angle::FormatID::ASTC_5x5_UNORM_BLOCK:
1985
1986            if (display->supportsAppleGPUFamily(6))
1987            {
1988                this->metalFormat    = MTLPixelFormatASTC_5x5_HDR;
1989                this->actualFormatId = angle::FormatID::ASTC_5x5_UNORM_BLOCK;
1990            }
1991            else
1992            {
1993                this->metalFormat    = MTLPixelFormatASTC_5x5_LDR;
1994                this->actualFormatId = angle::FormatID::ASTC_5x5_UNORM_BLOCK;
1995            }
1996            break;
1997
1998        case angle::FormatID::ASTC_6x5_UNORM_BLOCK:
1999
2000            if (display->supportsAppleGPUFamily(6))
2001            {
2002                this->metalFormat    = MTLPixelFormatASTC_6x5_HDR;
2003                this->actualFormatId = angle::FormatID::ASTC_6x5_UNORM_BLOCK;
2004            }
2005            else
2006            {
2007                this->metalFormat    = MTLPixelFormatASTC_6x5_LDR;
2008                this->actualFormatId = angle::FormatID::ASTC_6x5_UNORM_BLOCK;
2009            }
2010            break;
2011
2012        case angle::FormatID::ASTC_6x6_UNORM_BLOCK:
2013
2014            if (display->supportsAppleGPUFamily(6))
2015            {
2016                this->metalFormat    = MTLPixelFormatASTC_6x6_HDR;
2017                this->actualFormatId = angle::FormatID::ASTC_6x6_UNORM_BLOCK;
2018            }
2019            else
2020            {
2021                this->metalFormat    = MTLPixelFormatASTC_6x6_LDR;
2022                this->actualFormatId = angle::FormatID::ASTC_6x6_UNORM_BLOCK;
2023            }
2024            break;
2025
2026        case angle::FormatID::ASTC_8x5_UNORM_BLOCK:
2027
2028            if (display->supportsAppleGPUFamily(6))
2029            {
2030                this->metalFormat    = MTLPixelFormatASTC_8x5_HDR;
2031                this->actualFormatId = angle::FormatID::ASTC_8x5_UNORM_BLOCK;
2032            }
2033            else
2034            {
2035                this->metalFormat    = MTLPixelFormatASTC_8x5_LDR;
2036                this->actualFormatId = angle::FormatID::ASTC_8x5_UNORM_BLOCK;
2037            }
2038            break;
2039
2040        case angle::FormatID::ASTC_8x6_UNORM_BLOCK:
2041
2042            if (display->supportsAppleGPUFamily(6))
2043            {
2044                this->metalFormat    = MTLPixelFormatASTC_8x6_HDR;
2045                this->actualFormatId = angle::FormatID::ASTC_8x6_UNORM_BLOCK;
2046            }
2047            else
2048            {
2049                this->metalFormat    = MTLPixelFormatASTC_8x6_LDR;
2050                this->actualFormatId = angle::FormatID::ASTC_8x6_UNORM_BLOCK;
2051            }
2052            break;
2053
2054        case angle::FormatID::ASTC_8x8_UNORM_BLOCK:
2055
2056            if (display->supportsAppleGPUFamily(6))
2057            {
2058                this->metalFormat    = MTLPixelFormatASTC_8x8_HDR;
2059                this->actualFormatId = angle::FormatID::ASTC_8x8_UNORM_BLOCK;
2060            }
2061            else
2062            {
2063                this->metalFormat    = MTLPixelFormatASTC_8x8_LDR;
2064                this->actualFormatId = angle::FormatID::ASTC_8x8_UNORM_BLOCK;
2065            }
2066            break;
2067
2068#    elif TARGET_OS_TV || TARGET_OS_WATCH
2069        case angle::FormatID::ASTC_10x10_UNORM_BLOCK:
2070
2071            this->metalFormat    = MTLPixelFormatASTC_10x10_LDR;
2072            this->actualFormatId = angle::FormatID::ASTC_10x10_UNORM_BLOCK;
2073            break;
2074
2075        case angle::FormatID::ASTC_10x5_UNORM_BLOCK:
2076
2077            this->metalFormat    = MTLPixelFormatASTC_10x5_LDR;
2078            this->actualFormatId = angle::FormatID::ASTC_10x5_UNORM_BLOCK;
2079            break;
2080
2081        case angle::FormatID::ASTC_10x6_UNORM_BLOCK:
2082
2083            this->metalFormat    = MTLPixelFormatASTC_10x6_LDR;
2084            this->actualFormatId = angle::FormatID::ASTC_10x6_UNORM_BLOCK;
2085            break;
2086
2087        case angle::FormatID::ASTC_10x8_UNORM_BLOCK:
2088
2089            this->metalFormat    = MTLPixelFormatASTC_10x8_LDR;
2090            this->actualFormatId = angle::FormatID::ASTC_10x8_UNORM_BLOCK;
2091            break;
2092
2093        case angle::FormatID::ASTC_12x10_UNORM_BLOCK:
2094
2095            this->metalFormat    = MTLPixelFormatASTC_12x10_LDR;
2096            this->actualFormatId = angle::FormatID::ASTC_12x10_UNORM_BLOCK;
2097            break;
2098
2099        case angle::FormatID::ASTC_12x12_UNORM_BLOCK:
2100
2101            this->metalFormat    = MTLPixelFormatASTC_12x12_LDR;
2102            this->actualFormatId = angle::FormatID::ASTC_12x12_UNORM_BLOCK;
2103            break;
2104
2105        case angle::FormatID::ASTC_4x4_UNORM_BLOCK:
2106
2107            this->metalFormat    = MTLPixelFormatASTC_4x4_LDR;
2108            this->actualFormatId = angle::FormatID::ASTC_4x4_UNORM_BLOCK;
2109            break;
2110
2111        case angle::FormatID::ASTC_5x4_UNORM_BLOCK:
2112
2113            this->metalFormat    = MTLPixelFormatASTC_5x4_LDR;
2114            this->actualFormatId = angle::FormatID::ASTC_5x4_UNORM_BLOCK;
2115            break;
2116
2117        case angle::FormatID::ASTC_5x5_UNORM_BLOCK:
2118
2119            this->metalFormat    = MTLPixelFormatASTC_5x5_LDR;
2120            this->actualFormatId = angle::FormatID::ASTC_5x5_UNORM_BLOCK;
2121            break;
2122
2123        case angle::FormatID::ASTC_6x5_UNORM_BLOCK:
2124
2125            this->metalFormat    = MTLPixelFormatASTC_6x5_LDR;
2126            this->actualFormatId = angle::FormatID::ASTC_6x5_UNORM_BLOCK;
2127            break;
2128
2129        case angle::FormatID::ASTC_6x6_UNORM_BLOCK:
2130
2131            this->metalFormat    = MTLPixelFormatASTC_6x6_LDR;
2132            this->actualFormatId = angle::FormatID::ASTC_6x6_UNORM_BLOCK;
2133            break;
2134
2135        case angle::FormatID::ASTC_8x5_UNORM_BLOCK:
2136
2137            this->metalFormat    = MTLPixelFormatASTC_8x5_LDR;
2138            this->actualFormatId = angle::FormatID::ASTC_8x5_UNORM_BLOCK;
2139            break;
2140
2141        case angle::FormatID::ASTC_8x6_UNORM_BLOCK:
2142
2143            this->metalFormat    = MTLPixelFormatASTC_8x6_LDR;
2144            this->actualFormatId = angle::FormatID::ASTC_8x6_UNORM_BLOCK;
2145            break;
2146
2147        case angle::FormatID::ASTC_8x8_UNORM_BLOCK:
2148
2149            this->metalFormat    = MTLPixelFormatASTC_8x8_LDR;
2150            this->actualFormatId = angle::FormatID::ASTC_8x8_UNORM_BLOCK;
2151            break;
2152
2153#    endif  // ASTC formats
2154#    if (TARGET_OS_IOS && __IPHONE_OS_VERSION_MAX_ALLOWED >= 160400) || \
2155        (TARGET_OS_TV && __TV_OS_VERSION_MAX_ALLOWED >= 160400) || TARGET_OS_VISION
2156        case angle::FormatID::BC1_RGBA_UNORM_BLOCK:
2157
2158            this->metalFormat    = MTLPixelFormatBC1_RGBA;
2159            this->actualFormatId = angle::FormatID::BC1_RGBA_UNORM_BLOCK;
2160            break;
2161
2162        case angle::FormatID::BC1_RGBA_UNORM_SRGB_BLOCK:
2163
2164            this->metalFormat    = MTLPixelFormatBC1_RGBA_sRGB;
2165            this->actualFormatId = angle::FormatID::BC1_RGBA_UNORM_SRGB_BLOCK;
2166            break;
2167
2168        case angle::FormatID::BC2_RGBA_UNORM_BLOCK:
2169
2170            this->metalFormat    = MTLPixelFormatBC2_RGBA;
2171            this->actualFormatId = angle::FormatID::BC2_RGBA_UNORM_BLOCK;
2172            break;
2173
2174        case angle::FormatID::BC2_RGBA_UNORM_SRGB_BLOCK:
2175
2176            this->metalFormat    = MTLPixelFormatBC2_RGBA_sRGB;
2177            this->actualFormatId = angle::FormatID::BC2_RGBA_UNORM_SRGB_BLOCK;
2178            break;
2179
2180        case angle::FormatID::BC3_RGBA_UNORM_BLOCK:
2181
2182            this->metalFormat    = MTLPixelFormatBC3_RGBA;
2183            this->actualFormatId = angle::FormatID::BC3_RGBA_UNORM_BLOCK;
2184            break;
2185
2186        case angle::FormatID::BC3_RGBA_UNORM_SRGB_BLOCK:
2187
2188            this->metalFormat    = MTLPixelFormatBC3_RGBA_sRGB;
2189            this->actualFormatId = angle::FormatID::BC3_RGBA_UNORM_SRGB_BLOCK;
2190            break;
2191
2192        case angle::FormatID::BC4_RED_SNORM_BLOCK:
2193
2194            this->metalFormat    = MTLPixelFormatBC4_RSnorm;
2195            this->actualFormatId = angle::FormatID::BC4_RED_SNORM_BLOCK;
2196            break;
2197
2198        case angle::FormatID::BC4_RED_UNORM_BLOCK:
2199
2200            this->metalFormat    = MTLPixelFormatBC4_RUnorm;
2201            this->actualFormatId = angle::FormatID::BC4_RED_UNORM_BLOCK;
2202            break;
2203
2204        case angle::FormatID::BC5_RG_SNORM_BLOCK:
2205
2206            this->metalFormat    = MTLPixelFormatBC5_RGSnorm;
2207            this->actualFormatId = angle::FormatID::BC5_RG_SNORM_BLOCK;
2208            break;
2209
2210        case angle::FormatID::BC5_RG_UNORM_BLOCK:
2211
2212            this->metalFormat    = MTLPixelFormatBC5_RGUnorm;
2213            this->actualFormatId = angle::FormatID::BC5_RG_UNORM_BLOCK;
2214            break;
2215
2216        case angle::FormatID::BC6H_RGB_SFLOAT_BLOCK:
2217
2218            this->metalFormat    = MTLPixelFormatBC6H_RGBFloat;
2219            this->actualFormatId = angle::FormatID::BC6H_RGB_SFLOAT_BLOCK;
2220            break;
2221
2222        case angle::FormatID::BC6H_RGB_UFLOAT_BLOCK:
2223
2224            this->metalFormat    = MTLPixelFormatBC6H_RGBUfloat;
2225            this->actualFormatId = angle::FormatID::BC6H_RGB_UFLOAT_BLOCK;
2226            break;
2227
2228        case angle::FormatID::BC7_RGBA_UNORM_BLOCK:
2229
2230            this->metalFormat    = MTLPixelFormatBC7_RGBAUnorm;
2231            this->actualFormatId = angle::FormatID::BC7_RGBA_UNORM_BLOCK;
2232            break;
2233
2234        case angle::FormatID::BC7_RGBA_UNORM_SRGB_BLOCK:
2235
2236            this->metalFormat    = MTLPixelFormatBC7_RGBAUnorm_sRGB;
2237            this->actualFormatId = angle::FormatID::BC7_RGBA_UNORM_SRGB_BLOCK;
2238            break;
2239
2240        case angle::FormatID::BC1_RGB_UNORM_BLOCK:
2241            if (display->getFeatures().hasTextureSwizzle.enabled)
2242            {
2243
2244                this->metalFormat    = MTLPixelFormatBC1_RGBA;
2245                this->actualFormatId = angle::FormatID::BC1_RGBA_UNORM_BLOCK;
2246                this->swizzled       = true;
2247                this->swizzle        = {GL_RED, GL_GREEN, GL_BLUE, GL_ONE};
2248            }
2249            else
2250            {
2251
2252                this->metalFormat    = MTLPixelFormatBC1_RGBA;
2253                this->actualFormatId = angle::FormatID::BC1_RGBA_UNORM_BLOCK;
2254            }
2255            break;
2256
2257        case angle::FormatID::BC1_RGB_UNORM_SRGB_BLOCK:
2258            if (display->getFeatures().hasTextureSwizzle.enabled)
2259            {
2260
2261                this->metalFormat    = MTLPixelFormatBC1_RGBA_sRGB;
2262                this->actualFormatId = angle::FormatID::BC1_RGBA_UNORM_SRGB_BLOCK;
2263                this->swizzled       = true;
2264                this->swizzle        = {GL_RED, GL_GREEN, GL_BLUE, GL_ONE};
2265            }
2266            else
2267            {
2268
2269                this->metalFormat    = MTLPixelFormatBC1_RGBA_sRGB;
2270                this->actualFormatId = angle::FormatID::BC1_RGBA_UNORM_SRGB_BLOCK;
2271            }
2272            break;
2273
2274#    endif  // BC formats on iOS/tvOS/visionOS
2275#endif      // TARGET_OS_IPHONE
2276#if (TARGET_OS_OSX && (__MAC_OS_X_VERSION_MAX_ALLOWED >= 110000))
2277        case angle::FormatID::ASTC_10x10_SRGB_BLOCK:
2278
2279            this->metalFormat    = MTLPixelFormatASTC_10x10_sRGB;
2280            this->actualFormatId = angle::FormatID::ASTC_10x10_SRGB_BLOCK;
2281            break;
2282
2283        case angle::FormatID::ASTC_10x5_SRGB_BLOCK:
2284
2285            this->metalFormat    = MTLPixelFormatASTC_10x5_sRGB;
2286            this->actualFormatId = angle::FormatID::ASTC_10x5_SRGB_BLOCK;
2287            break;
2288
2289        case angle::FormatID::ASTC_10x6_SRGB_BLOCK:
2290
2291            this->metalFormat    = MTLPixelFormatASTC_10x6_sRGB;
2292            this->actualFormatId = angle::FormatID::ASTC_10x6_SRGB_BLOCK;
2293            break;
2294
2295        case angle::FormatID::ASTC_10x8_SRGB_BLOCK:
2296
2297            this->metalFormat    = MTLPixelFormatASTC_10x8_sRGB;
2298            this->actualFormatId = angle::FormatID::ASTC_10x8_SRGB_BLOCK;
2299            break;
2300
2301        case angle::FormatID::ASTC_12x10_SRGB_BLOCK:
2302
2303            this->metalFormat    = MTLPixelFormatASTC_12x10_sRGB;
2304            this->actualFormatId = angle::FormatID::ASTC_12x10_SRGB_BLOCK;
2305            break;
2306
2307        case angle::FormatID::ASTC_12x12_SRGB_BLOCK:
2308
2309            this->metalFormat    = MTLPixelFormatASTC_12x12_sRGB;
2310            this->actualFormatId = angle::FormatID::ASTC_12x12_SRGB_BLOCK;
2311            break;
2312
2313        case angle::FormatID::ASTC_4x4_SRGB_BLOCK:
2314
2315            this->metalFormat    = MTLPixelFormatASTC_4x4_sRGB;
2316            this->actualFormatId = angle::FormatID::ASTC_4x4_SRGB_BLOCK;
2317            break;
2318
2319        case angle::FormatID::ASTC_5x4_SRGB_BLOCK:
2320
2321            this->metalFormat    = MTLPixelFormatASTC_5x4_sRGB;
2322            this->actualFormatId = angle::FormatID::ASTC_5x4_SRGB_BLOCK;
2323            break;
2324
2325        case angle::FormatID::ASTC_5x5_SRGB_BLOCK:
2326
2327            this->metalFormat    = MTLPixelFormatASTC_5x5_sRGB;
2328            this->actualFormatId = angle::FormatID::ASTC_5x5_SRGB_BLOCK;
2329            break;
2330
2331        case angle::FormatID::ASTC_6x5_SRGB_BLOCK:
2332
2333            this->metalFormat    = MTLPixelFormatASTC_6x5_sRGB;
2334            this->actualFormatId = angle::FormatID::ASTC_6x5_SRGB_BLOCK;
2335            break;
2336
2337        case angle::FormatID::ASTC_6x6_SRGB_BLOCK:
2338
2339            this->metalFormat    = MTLPixelFormatASTC_6x6_sRGB;
2340            this->actualFormatId = angle::FormatID::ASTC_6x6_SRGB_BLOCK;
2341            break;
2342
2343        case angle::FormatID::ASTC_8x5_SRGB_BLOCK:
2344
2345            this->metalFormat    = MTLPixelFormatASTC_8x5_sRGB;
2346            this->actualFormatId = angle::FormatID::ASTC_8x5_SRGB_BLOCK;
2347            break;
2348
2349        case angle::FormatID::ASTC_8x6_SRGB_BLOCK:
2350
2351            this->metalFormat    = MTLPixelFormatASTC_8x6_sRGB;
2352            this->actualFormatId = angle::FormatID::ASTC_8x6_SRGB_BLOCK;
2353            break;
2354
2355        case angle::FormatID::ASTC_8x8_SRGB_BLOCK:
2356
2357            this->metalFormat    = MTLPixelFormatASTC_8x8_sRGB;
2358            this->actualFormatId = angle::FormatID::ASTC_8x8_SRGB_BLOCK;
2359            break;
2360
2361        case angle::FormatID::EAC_R11G11_SNORM_BLOCK:
2362
2363            if (display->supportsAppleGPUFamily(1))
2364            {
2365                this->metalFormat    = MTLPixelFormatEAC_RG11Snorm;
2366                this->actualFormatId = angle::FormatID::EAC_R11G11_SNORM_BLOCK;
2367            }
2368            else
2369            {
2370                this->metalFormat    = MTLPixelFormatRG16Snorm;
2371                this->actualFormatId = angle::FormatID::R16G16_SNORM;
2372            }
2373            break;
2374
2375        case angle::FormatID::EAC_R11G11_UNORM_BLOCK:
2376
2377            if (display->supportsAppleGPUFamily(1))
2378            {
2379                this->metalFormat    = MTLPixelFormatEAC_RG11Unorm;
2380                this->actualFormatId = angle::FormatID::EAC_R11G11_UNORM_BLOCK;
2381            }
2382            else
2383            {
2384                this->metalFormat    = MTLPixelFormatRG16Unorm;
2385                this->actualFormatId = angle::FormatID::R16G16_UNORM;
2386            }
2387            break;
2388
2389        case angle::FormatID::EAC_R11_SNORM_BLOCK:
2390
2391            if (display->supportsAppleGPUFamily(1))
2392            {
2393                this->metalFormat    = MTLPixelFormatEAC_R11Snorm;
2394                this->actualFormatId = angle::FormatID::EAC_R11_SNORM_BLOCK;
2395            }
2396            else
2397            {
2398                this->metalFormat    = MTLPixelFormatR16Snorm;
2399                this->actualFormatId = angle::FormatID::R16_SNORM;
2400            }
2401            break;
2402
2403        case angle::FormatID::EAC_R11_UNORM_BLOCK:
2404
2405            if (display->supportsAppleGPUFamily(1))
2406            {
2407                this->metalFormat    = MTLPixelFormatEAC_R11Unorm;
2408                this->actualFormatId = angle::FormatID::EAC_R11_UNORM_BLOCK;
2409            }
2410            else
2411            {
2412                this->metalFormat    = MTLPixelFormatR16Unorm;
2413                this->actualFormatId = angle::FormatID::R16_UNORM;
2414            }
2415            break;
2416
2417        case angle::FormatID::ETC1_R8G8B8_UNORM_BLOCK:
2418
2419            if (display->supportsAppleGPUFamily(1))
2420            {
2421                this->metalFormat    = MTLPixelFormatETC2_RGB8;
2422                this->actualFormatId = angle::FormatID::ETC1_R8G8B8_UNORM_BLOCK;
2423            }
2424            else
2425            {
2426                this->metalFormat    = MTLPixelFormatRGBA8Unorm;
2427                this->actualFormatId = angle::FormatID::R8G8B8A8_UNORM;
2428                this->initFunction   = Initialize4ComponentData<GLubyte, 0x00, 0x00, 0x00, 0xFF>;
2429            }
2430            break;
2431
2432        case angle::FormatID::ETC2_R8G8B8A1_SRGB_BLOCK:
2433
2434            if (display->supportsAppleGPUFamily(1))
2435            {
2436                this->metalFormat    = MTLPixelFormatETC2_RGB8A1_sRGB;
2437                this->actualFormatId = angle::FormatID::ETC2_R8G8B8A1_SRGB_BLOCK;
2438            }
2439            else
2440            {
2441                this->metalFormat    = MTLPixelFormatRGBA8Unorm_sRGB;
2442                this->actualFormatId = angle::FormatID::R8G8B8A8_UNORM_SRGB;
2443                this->initFunction   = Initialize4ComponentData<GLubyte, 0x00, 0x00, 0x00, 0xFF>;
2444            }
2445            break;
2446
2447        case angle::FormatID::ETC2_R8G8B8A1_UNORM_BLOCK:
2448
2449            if (display->supportsAppleGPUFamily(1))
2450            {
2451                this->metalFormat    = MTLPixelFormatETC2_RGB8A1;
2452                this->actualFormatId = angle::FormatID::ETC2_R8G8B8A1_UNORM_BLOCK;
2453            }
2454            else
2455            {
2456                this->metalFormat    = MTLPixelFormatRGBA8Unorm;
2457                this->actualFormatId = angle::FormatID::R8G8B8A8_UNORM;
2458                this->initFunction   = Initialize4ComponentData<GLubyte, 0x00, 0x00, 0x00, 0xFF>;
2459            }
2460            break;
2461
2462        case angle::FormatID::ETC2_R8G8B8A8_SRGB_BLOCK:
2463
2464            if (display->supportsAppleGPUFamily(1))
2465            {
2466                this->metalFormat    = MTLPixelFormatEAC_RGBA8_sRGB;
2467                this->actualFormatId = angle::FormatID::ETC2_R8G8B8A8_SRGB_BLOCK;
2468            }
2469            else
2470            {
2471                this->metalFormat    = MTLPixelFormatRGBA8Unorm_sRGB;
2472                this->actualFormatId = angle::FormatID::R8G8B8A8_UNORM_SRGB;
2473            }
2474            break;
2475
2476        case angle::FormatID::ETC2_R8G8B8A8_UNORM_BLOCK:
2477
2478            if (display->supportsAppleGPUFamily(1))
2479            {
2480                this->metalFormat    = MTLPixelFormatEAC_RGBA8;
2481                this->actualFormatId = angle::FormatID::ETC2_R8G8B8A8_UNORM_BLOCK;
2482            }
2483            else
2484            {
2485                this->metalFormat    = MTLPixelFormatRGBA8Unorm;
2486                this->actualFormatId = angle::FormatID::R8G8B8A8_UNORM;
2487            }
2488            break;
2489
2490        case angle::FormatID::ETC2_R8G8B8_SRGB_BLOCK:
2491
2492            if (display->supportsAppleGPUFamily(1))
2493            {
2494                this->metalFormat    = MTLPixelFormatETC2_RGB8_sRGB;
2495                this->actualFormatId = angle::FormatID::ETC2_R8G8B8_SRGB_BLOCK;
2496            }
2497            else
2498            {
2499                this->metalFormat    = MTLPixelFormatRGBA8Unorm_sRGB;
2500                this->actualFormatId = angle::FormatID::R8G8B8A8_UNORM_SRGB;
2501                this->initFunction   = Initialize4ComponentData<GLubyte, 0x00, 0x00, 0x00, 0xFF>;
2502            }
2503            break;
2504
2505        case angle::FormatID::ETC2_R8G8B8_UNORM_BLOCK:
2506
2507            if (display->supportsAppleGPUFamily(1))
2508            {
2509                this->metalFormat    = MTLPixelFormatETC2_RGB8;
2510                this->actualFormatId = angle::FormatID::ETC2_R8G8B8_UNORM_BLOCK;
2511            }
2512            else
2513            {
2514                this->metalFormat    = MTLPixelFormatRGBA8Unorm;
2515                this->actualFormatId = angle::FormatID::R8G8B8A8_UNORM;
2516                this->initFunction   = Initialize4ComponentData<GLubyte, 0x00, 0x00, 0x00, 0xFF>;
2517            }
2518            break;
2519
2520        case angle::FormatID::PVRTC1_RGBA_2BPP_UNORM_BLOCK:
2521
2522            this->metalFormat    = MTLPixelFormatPVRTC_RGBA_2BPP;
2523            this->actualFormatId = angle::FormatID::PVRTC1_RGBA_2BPP_UNORM_BLOCK;
2524            break;
2525
2526        case angle::FormatID::PVRTC1_RGBA_2BPP_UNORM_SRGB_BLOCK:
2527
2528            this->metalFormat    = MTLPixelFormatPVRTC_RGBA_2BPP_sRGB;
2529            this->actualFormatId = angle::FormatID::PVRTC1_RGBA_2BPP_UNORM_SRGB_BLOCK;
2530            break;
2531
2532        case angle::FormatID::PVRTC1_RGBA_4BPP_UNORM_BLOCK:
2533
2534            this->metalFormat    = MTLPixelFormatPVRTC_RGBA_4BPP;
2535            this->actualFormatId = angle::FormatID::PVRTC1_RGBA_4BPP_UNORM_BLOCK;
2536            break;
2537
2538        case angle::FormatID::PVRTC1_RGBA_4BPP_UNORM_SRGB_BLOCK:
2539
2540            this->metalFormat    = MTLPixelFormatPVRTC_RGBA_4BPP_sRGB;
2541            this->actualFormatId = angle::FormatID::PVRTC1_RGBA_4BPP_UNORM_SRGB_BLOCK;
2542            break;
2543
2544        case angle::FormatID::PVRTC1_RGB_2BPP_UNORM_BLOCK:
2545
2546            this->metalFormat    = MTLPixelFormatPVRTC_RGB_2BPP;
2547            this->actualFormatId = angle::FormatID::PVRTC1_RGB_2BPP_UNORM_BLOCK;
2548            break;
2549
2550        case angle::FormatID::PVRTC1_RGB_2BPP_UNORM_SRGB_BLOCK:
2551
2552            this->metalFormat    = MTLPixelFormatPVRTC_RGB_2BPP_sRGB;
2553            this->actualFormatId = angle::FormatID::PVRTC1_RGB_2BPP_UNORM_SRGB_BLOCK;
2554            break;
2555
2556        case angle::FormatID::PVRTC1_RGB_4BPP_UNORM_BLOCK:
2557
2558            this->metalFormat    = MTLPixelFormatPVRTC_RGB_4BPP;
2559            this->actualFormatId = angle::FormatID::PVRTC1_RGB_4BPP_UNORM_BLOCK;
2560            break;
2561
2562        case angle::FormatID::PVRTC1_RGB_4BPP_UNORM_SRGB_BLOCK:
2563
2564            this->metalFormat    = MTLPixelFormatPVRTC_RGB_4BPP_sRGB;
2565            this->actualFormatId = angle::FormatID::PVRTC1_RGB_4BPP_UNORM_SRGB_BLOCK;
2566            break;
2567
2568        case angle::FormatID::R4G4B4A4_UNORM:
2569
2570            if (display->supportsAppleGPUFamily(1))
2571            {
2572                this->metalFormat    = MTLPixelFormatABGR4Unorm;
2573                this->actualFormatId = angle::FormatID::R4G4B4A4_UNORM;
2574            }
2575            else
2576            {
2577                this->metalFormat    = MTLPixelFormatRGBA8Unorm;
2578                this->actualFormatId = angle::FormatID::R8G8B8A8_UNORM;
2579            }
2580            break;
2581
2582        case angle::FormatID::R5G5B5A1_UNORM:
2583
2584            if (display->supportsAppleGPUFamily(1))
2585            {
2586                this->metalFormat    = MTLPixelFormatA1BGR5Unorm;
2587                this->actualFormatId = angle::FormatID::R5G5B5A1_UNORM;
2588            }
2589            else
2590            {
2591                this->metalFormat    = MTLPixelFormatRGBA8Unorm;
2592                this->actualFormatId = angle::FormatID::R8G8B8A8_UNORM;
2593            }
2594            break;
2595
2596        case angle::FormatID::R5G6B5_UNORM:
2597
2598            if (display->supportsAppleGPUFamily(1))
2599            {
2600                this->metalFormat    = MTLPixelFormatB5G6R5Unorm;
2601                this->actualFormatId = angle::FormatID::R5G6B5_UNORM;
2602            }
2603            else
2604            {
2605                this->metalFormat    = MTLPixelFormatRGBA8Unorm;
2606                this->actualFormatId = angle::FormatID::R8G8B8A8_UNORM;
2607                this->initFunction   = Initialize4ComponentData<GLubyte, 0x00, 0x00, 0x00, 0xFF>;
2608            }
2609            break;
2610
2611        case angle::FormatID::R8G8_UNORM_SRGB:
2612
2613            this->metalFormat    = MTLPixelFormatRG8Unorm_sRGB;
2614            this->actualFormatId = angle::FormatID::R8G8_UNORM_SRGB;
2615            break;
2616
2617        case angle::FormatID::R8_UNORM_SRGB:
2618
2619            this->metalFormat    = MTLPixelFormatR8Unorm_sRGB;
2620            this->actualFormatId = angle::FormatID::R8_UNORM_SRGB;
2621            break;
2622
2623        case angle::FormatID::ASTC_10x10_UNORM_BLOCK:
2624
2625            if (display->supportsAppleGPUFamily(6))
2626            {
2627                this->metalFormat    = MTLPixelFormatASTC_10x10_HDR;
2628                this->actualFormatId = angle::FormatID::ASTC_10x10_UNORM_BLOCK;
2629            }
2630            else
2631            {
2632                this->metalFormat    = MTLPixelFormatASTC_10x10_LDR;
2633                this->actualFormatId = angle::FormatID::ASTC_10x10_UNORM_BLOCK;
2634            }
2635            break;
2636
2637        case angle::FormatID::ASTC_10x5_UNORM_BLOCK:
2638
2639            if (display->supportsAppleGPUFamily(6))
2640            {
2641                this->metalFormat    = MTLPixelFormatASTC_10x5_HDR;
2642                this->actualFormatId = angle::FormatID::ASTC_10x5_UNORM_BLOCK;
2643            }
2644            else
2645            {
2646                this->metalFormat    = MTLPixelFormatASTC_10x5_LDR;
2647                this->actualFormatId = angle::FormatID::ASTC_10x5_UNORM_BLOCK;
2648            }
2649            break;
2650
2651        case angle::FormatID::ASTC_10x6_UNORM_BLOCK:
2652
2653            if (display->supportsAppleGPUFamily(6))
2654            {
2655                this->metalFormat    = MTLPixelFormatASTC_10x6_HDR;
2656                this->actualFormatId = angle::FormatID::ASTC_10x6_UNORM_BLOCK;
2657            }
2658            else
2659            {
2660                this->metalFormat    = MTLPixelFormatASTC_10x6_LDR;
2661                this->actualFormatId = angle::FormatID::ASTC_10x6_UNORM_BLOCK;
2662            }
2663            break;
2664
2665        case angle::FormatID::ASTC_10x8_UNORM_BLOCK:
2666
2667            if (display->supportsAppleGPUFamily(6))
2668            {
2669                this->metalFormat    = MTLPixelFormatASTC_10x8_HDR;
2670                this->actualFormatId = angle::FormatID::ASTC_10x8_UNORM_BLOCK;
2671            }
2672            else
2673            {
2674                this->metalFormat    = MTLPixelFormatASTC_10x8_LDR;
2675                this->actualFormatId = angle::FormatID::ASTC_10x8_UNORM_BLOCK;
2676            }
2677            break;
2678
2679        case angle::FormatID::ASTC_12x10_UNORM_BLOCK:
2680
2681            if (display->supportsAppleGPUFamily(6))
2682            {
2683                this->metalFormat    = MTLPixelFormatASTC_12x10_HDR;
2684                this->actualFormatId = angle::FormatID::ASTC_12x10_UNORM_BLOCK;
2685            }
2686            else
2687            {
2688                this->metalFormat    = MTLPixelFormatASTC_12x10_LDR;
2689                this->actualFormatId = angle::FormatID::ASTC_12x10_UNORM_BLOCK;
2690            }
2691            break;
2692
2693        case angle::FormatID::ASTC_12x12_UNORM_BLOCK:
2694
2695            if (display->supportsAppleGPUFamily(6))
2696            {
2697                this->metalFormat    = MTLPixelFormatASTC_12x12_HDR;
2698                this->actualFormatId = angle::FormatID::ASTC_12x12_UNORM_BLOCK;
2699            }
2700            else
2701            {
2702                this->metalFormat    = MTLPixelFormatASTC_12x12_LDR;
2703                this->actualFormatId = angle::FormatID::ASTC_12x12_UNORM_BLOCK;
2704            }
2705            break;
2706
2707        case angle::FormatID::ASTC_4x4_UNORM_BLOCK:
2708
2709            if (display->supportsAppleGPUFamily(6))
2710            {
2711                this->metalFormat    = MTLPixelFormatASTC_4x4_HDR;
2712                this->actualFormatId = angle::FormatID::ASTC_4x4_UNORM_BLOCK;
2713            }
2714            else
2715            {
2716                this->metalFormat    = MTLPixelFormatASTC_4x4_LDR;
2717                this->actualFormatId = angle::FormatID::ASTC_4x4_UNORM_BLOCK;
2718            }
2719            break;
2720
2721        case angle::FormatID::ASTC_5x4_UNORM_BLOCK:
2722
2723            if (display->supportsAppleGPUFamily(6))
2724            {
2725                this->metalFormat    = MTLPixelFormatASTC_5x4_HDR;
2726                this->actualFormatId = angle::FormatID::ASTC_5x4_UNORM_BLOCK;
2727            }
2728            else
2729            {
2730                this->metalFormat    = MTLPixelFormatASTC_5x4_LDR;
2731                this->actualFormatId = angle::FormatID::ASTC_5x4_UNORM_BLOCK;
2732            }
2733            break;
2734
2735        case angle::FormatID::ASTC_5x5_UNORM_BLOCK:
2736
2737            if (display->supportsAppleGPUFamily(6))
2738            {
2739                this->metalFormat    = MTLPixelFormatASTC_5x5_HDR;
2740                this->actualFormatId = angle::FormatID::ASTC_5x5_UNORM_BLOCK;
2741            }
2742            else
2743            {
2744                this->metalFormat    = MTLPixelFormatASTC_5x5_LDR;
2745                this->actualFormatId = angle::FormatID::ASTC_5x5_UNORM_BLOCK;
2746            }
2747            break;
2748
2749        case angle::FormatID::ASTC_6x5_UNORM_BLOCK:
2750
2751            if (display->supportsAppleGPUFamily(6))
2752            {
2753                this->metalFormat    = MTLPixelFormatASTC_6x5_HDR;
2754                this->actualFormatId = angle::FormatID::ASTC_6x5_UNORM_BLOCK;
2755            }
2756            else
2757            {
2758                this->metalFormat    = MTLPixelFormatASTC_6x5_LDR;
2759                this->actualFormatId = angle::FormatID::ASTC_6x5_UNORM_BLOCK;
2760            }
2761            break;
2762
2763        case angle::FormatID::ASTC_6x6_UNORM_BLOCK:
2764
2765            if (display->supportsAppleGPUFamily(6))
2766            {
2767                this->metalFormat    = MTLPixelFormatASTC_6x6_HDR;
2768                this->actualFormatId = angle::FormatID::ASTC_6x6_UNORM_BLOCK;
2769            }
2770            else
2771            {
2772                this->metalFormat    = MTLPixelFormatASTC_6x6_LDR;
2773                this->actualFormatId = angle::FormatID::ASTC_6x6_UNORM_BLOCK;
2774            }
2775            break;
2776
2777        case angle::FormatID::ASTC_8x5_UNORM_BLOCK:
2778
2779            if (display->supportsAppleGPUFamily(6))
2780            {
2781                this->metalFormat    = MTLPixelFormatASTC_8x5_HDR;
2782                this->actualFormatId = angle::FormatID::ASTC_8x5_UNORM_BLOCK;
2783            }
2784            else
2785            {
2786                this->metalFormat    = MTLPixelFormatASTC_8x5_LDR;
2787                this->actualFormatId = angle::FormatID::ASTC_8x5_UNORM_BLOCK;
2788            }
2789            break;
2790
2791        case angle::FormatID::ASTC_8x6_UNORM_BLOCK:
2792
2793            if (display->supportsAppleGPUFamily(6))
2794            {
2795                this->metalFormat    = MTLPixelFormatASTC_8x6_HDR;
2796                this->actualFormatId = angle::FormatID::ASTC_8x6_UNORM_BLOCK;
2797            }
2798            else
2799            {
2800                this->metalFormat    = MTLPixelFormatASTC_8x6_LDR;
2801                this->actualFormatId = angle::FormatID::ASTC_8x6_UNORM_BLOCK;
2802            }
2803            break;
2804
2805        case angle::FormatID::ASTC_8x8_UNORM_BLOCK:
2806
2807            if (display->supportsAppleGPUFamily(6))
2808            {
2809                this->metalFormat    = MTLPixelFormatASTC_8x8_HDR;
2810                this->actualFormatId = angle::FormatID::ASTC_8x8_UNORM_BLOCK;
2811            }
2812            else
2813            {
2814                this->metalFormat    = MTLPixelFormatASTC_8x8_LDR;
2815                this->actualFormatId = angle::FormatID::ASTC_8x8_UNORM_BLOCK;
2816            }
2817            break;
2818
2819#endif  // TARGET_OS_OSX && (__MAC_OS_X_VERSION_MAX_ALLOWED >= 110000))
2820        default:
2821            this->metalFormat    = MTLPixelFormatInvalid;
2822            this->actualFormatId = angle::FormatID::NONE;
2823    }
2824}
2825
2826void VertexFormat::init(angle::FormatID angleFormatId, bool tightlyPacked)
2827{
2828    this->intendedFormatId = angleFormatId;
2829
2830    // Actual conversion
2831    switch (this->intendedFormatId)
2832    {
2833        case angle::FormatID::NONE:
2834            this->metalFormat        = MTLVertexFormatInvalid;
2835            this->actualFormatId     = angle::FormatID::NONE;
2836            this->vertexLoadFunction = nullptr;
2837            this->defaultAlpha       = 0;
2838            this->actualSameGLType   = false;
2839            break;
2840
2841        case angle::FormatID::R10G10B10A2_SNORM:
2842            this->metalFormat        = MTLVertexFormatInt1010102Normalized;
2843            this->actualFormatId     = angle::FormatID::R10G10B10A2_SNORM;
2844            this->vertexLoadFunction = CopyNativeVertexData<GLuint, 1, 1, 0>;
2845            this->defaultAlpha       = 0;
2846            break;
2847
2848        case angle::FormatID::R10G10B10A2_UNORM:
2849            this->metalFormat        = MTLVertexFormatUInt1010102Normalized;
2850            this->actualFormatId     = angle::FormatID::R10G10B10A2_UNORM;
2851            this->vertexLoadFunction = CopyNativeVertexData<GLuint, 1, 1, 0>;
2852            this->defaultAlpha       = 0;
2853            break;
2854
2855        case angle::FormatID::R16G16B16A16_FLOAT:
2856            this->metalFormat        = MTLVertexFormatHalf4;
2857            this->actualFormatId     = angle::FormatID::R16G16B16A16_FLOAT;
2858            this->vertexLoadFunction = CopyNativeVertexData<GLhalf, 4, 4, 0>;
2859            this->defaultAlpha       = 0;
2860            break;
2861
2862        case angle::FormatID::R16G16B16A16_SINT:
2863            this->metalFormat        = MTLVertexFormatShort4;
2864            this->actualFormatId     = angle::FormatID::R16G16B16A16_SINT;
2865            this->vertexLoadFunction = CopyNativeVertexData<GLshort, 4, 4, 0>;
2866            this->defaultAlpha       = 0;
2867            break;
2868
2869        case angle::FormatID::R16G16B16A16_SNORM:
2870            this->metalFormat        = MTLVertexFormatShort4Normalized;
2871            this->actualFormatId     = angle::FormatID::R16G16B16A16_SNORM;
2872            this->vertexLoadFunction = CopyNativeVertexData<GLshort, 4, 4, 0>;
2873            this->defaultAlpha       = 0;
2874            break;
2875
2876        case angle::FormatID::R16G16B16A16_SSCALED:
2877            this->metalFormat        = MTLVertexFormatShort4;
2878            this->actualFormatId     = angle::FormatID::R16G16B16A16_SSCALED;
2879            this->vertexLoadFunction = CopyNativeVertexData<GLshort, 4, 4, 0>;
2880            this->defaultAlpha       = 0;
2881            break;
2882
2883        case angle::FormatID::R16G16B16A16_UINT:
2884            this->metalFormat        = MTLVertexFormatUShort4;
2885            this->actualFormatId     = angle::FormatID::R16G16B16A16_UINT;
2886            this->vertexLoadFunction = CopyNativeVertexData<GLushort, 4, 4, 0>;
2887            this->defaultAlpha       = 0;
2888            break;
2889
2890        case angle::FormatID::R16G16B16A16_UNORM:
2891            this->metalFormat        = MTLVertexFormatUShort4Normalized;
2892            this->actualFormatId     = angle::FormatID::R16G16B16A16_UNORM;
2893            this->vertexLoadFunction = CopyNativeVertexData<GLushort, 4, 4, 0>;
2894            this->defaultAlpha       = 0;
2895            break;
2896
2897        case angle::FormatID::R16G16B16A16_USCALED:
2898            this->metalFormat        = MTLVertexFormatUShort4;
2899            this->actualFormatId     = angle::FormatID::R16G16B16A16_USCALED;
2900            this->vertexLoadFunction = CopyNativeVertexData<GLushort, 4, 4, 0>;
2901            this->defaultAlpha       = 0;
2902            break;
2903
2904        case angle::FormatID::R16G16B16_FLOAT:
2905            if (tightlyPacked)
2906            {
2907                this->metalFormat        = MTLVertexFormatHalf4;
2908                this->actualFormatId     = angle::FormatID::R16G16B16A16_FLOAT;
2909                this->vertexLoadFunction = CopyNativeVertexData<GLhalf, 3, 4, gl::Float16One>;
2910                this->defaultAlpha       = gl::Float16One;
2911            }
2912            else
2913            {
2914                this->metalFormat        = MTLVertexFormatHalf3;
2915                this->actualFormatId     = angle::FormatID::R16G16B16_FLOAT;
2916                this->vertexLoadFunction = CopyNativeVertexData<GLhalf, 3, 3, 0>;
2917                this->defaultAlpha       = 0;
2918            }
2919            break;
2920
2921        case angle::FormatID::R16G16B16_SINT:
2922            if (tightlyPacked)
2923            {
2924                this->metalFormat        = MTLVertexFormatShort4;
2925                this->actualFormatId     = angle::FormatID::R16G16B16A16_SINT;
2926                this->vertexLoadFunction = CopyNativeVertexData<GLshort, 3, 4, 1>;
2927                this->defaultAlpha       = 1;
2928            }
2929            else
2930            {
2931                this->metalFormat        = MTLVertexFormatShort3;
2932                this->actualFormatId     = angle::FormatID::R16G16B16_SINT;
2933                this->vertexLoadFunction = CopyNativeVertexData<GLshort, 3, 3, 0>;
2934                this->defaultAlpha       = 0;
2935            }
2936            break;
2937
2938        case angle::FormatID::R16G16B16_SNORM:
2939            if (tightlyPacked)
2940            {
2941                this->metalFormat    = MTLVertexFormatShort4Normalized;
2942                this->actualFormatId = angle::FormatID::R16G16B16A16_SNORM;
2943                this->vertexLoadFunction =
2944                    CopyNativeVertexData<GLshort, 3, 4, std::numeric_limits<GLshort>::max()>;
2945                this->defaultAlpha = std::numeric_limits<GLshort>::max();
2946            }
2947            else
2948            {
2949                this->metalFormat        = MTLVertexFormatShort3Normalized;
2950                this->actualFormatId     = angle::FormatID::R16G16B16_SNORM;
2951                this->vertexLoadFunction = CopyNativeVertexData<GLshort, 3, 3, 0>;
2952                this->defaultAlpha       = 0;
2953            }
2954            break;
2955
2956        case angle::FormatID::R16G16B16_SSCALED:
2957            if (tightlyPacked)
2958            {
2959                this->metalFormat        = MTLVertexFormatShort4;
2960                this->actualFormatId     = angle::FormatID::R16G16B16A16_SINT;
2961                this->vertexLoadFunction = CopyNativeVertexData<GLshort, 3, 4, 1>;
2962                this->defaultAlpha       = 1;
2963            }
2964            else
2965            {
2966                this->metalFormat        = MTLVertexFormatShort3;
2967                this->actualFormatId     = angle::FormatID::R16G16B16_SSCALED;
2968                this->vertexLoadFunction = CopyNativeVertexData<GLshort, 3, 3, 0>;
2969                this->defaultAlpha       = 0;
2970            }
2971            break;
2972
2973        case angle::FormatID::R16G16B16_UINT:
2974            if (tightlyPacked)
2975            {
2976                this->metalFormat        = MTLVertexFormatUShort4;
2977                this->actualFormatId     = angle::FormatID::R16G16B16A16_UINT;
2978                this->vertexLoadFunction = CopyNativeVertexData<GLushort, 3, 4, 1>;
2979                this->defaultAlpha       = 1;
2980            }
2981            else
2982            {
2983                this->metalFormat        = MTLVertexFormatUShort3;
2984                this->actualFormatId     = angle::FormatID::R16G16B16_UINT;
2985                this->vertexLoadFunction = CopyNativeVertexData<GLushort, 3, 3, 0>;
2986                this->defaultAlpha       = 0;
2987            }
2988            break;
2989
2990        case angle::FormatID::R16G16B16_UNORM:
2991            if (tightlyPacked)
2992            {
2993                this->metalFormat    = MTLVertexFormatUShort4Normalized;
2994                this->actualFormatId = angle::FormatID::R16G16B16A16_UNORM;
2995                this->vertexLoadFunction =
2996                    CopyNativeVertexData<GLushort, 3, 4, std::numeric_limits<GLushort>::max()>;
2997                this->defaultAlpha = std::numeric_limits<GLushort>::max();
2998            }
2999            else
3000            {
3001                this->metalFormat        = MTLVertexFormatUShort3Normalized;
3002                this->actualFormatId     = angle::FormatID::R16G16B16_UNORM;
3003                this->vertexLoadFunction = CopyNativeVertexData<GLushort, 3, 3, 0>;
3004                this->defaultAlpha       = 0;
3005            }
3006            break;
3007
3008        case angle::FormatID::R16G16B16_USCALED:
3009            if (tightlyPacked)
3010            {
3011                this->metalFormat        = MTLVertexFormatUShort4;
3012                this->actualFormatId     = angle::FormatID::R16G16B16A16_UINT;
3013                this->vertexLoadFunction = CopyNativeVertexData<GLushort, 3, 4, 1>;
3014                this->defaultAlpha       = 1;
3015            }
3016            else
3017            {
3018                this->metalFormat        = MTLVertexFormatUShort3;
3019                this->actualFormatId     = angle::FormatID::R16G16B16_USCALED;
3020                this->vertexLoadFunction = CopyNativeVertexData<GLushort, 3, 3, 0>;
3021                this->defaultAlpha       = 0;
3022            }
3023            break;
3024
3025        case angle::FormatID::R16G16_FLOAT:
3026            this->metalFormat        = MTLVertexFormatHalf2;
3027            this->actualFormatId     = angle::FormatID::R16G16_FLOAT;
3028            this->vertexLoadFunction = CopyNativeVertexData<GLhalf, 2, 2, 0>;
3029            this->defaultAlpha       = 0;
3030            break;
3031
3032        case angle::FormatID::R16G16_SINT:
3033            this->metalFormat        = MTLVertexFormatShort2;
3034            this->actualFormatId     = angle::FormatID::R16G16_SINT;
3035            this->vertexLoadFunction = CopyNativeVertexData<GLshort, 2, 2, 0>;
3036            this->defaultAlpha       = 0;
3037            break;
3038
3039        case angle::FormatID::R16G16_SNORM:
3040            this->metalFormat        = MTLVertexFormatShort2Normalized;
3041            this->actualFormatId     = angle::FormatID::R16G16_SNORM;
3042            this->vertexLoadFunction = CopyNativeVertexData<GLshort, 2, 2, 0>;
3043            this->defaultAlpha       = 0;
3044            break;
3045
3046        case angle::FormatID::R16G16_SSCALED:
3047            this->metalFormat        = MTLVertexFormatShort2;
3048            this->actualFormatId     = angle::FormatID::R16G16_SSCALED;
3049            this->vertexLoadFunction = CopyNativeVertexData<GLshort, 2, 2, 0>;
3050            this->defaultAlpha       = 0;
3051            break;
3052
3053        case angle::FormatID::R16G16_UINT:
3054            this->metalFormat        = MTLVertexFormatUShort2;
3055            this->actualFormatId     = angle::FormatID::R16G16_UINT;
3056            this->vertexLoadFunction = CopyNativeVertexData<GLushort, 2, 2, 0>;
3057            this->defaultAlpha       = 0;
3058            break;
3059
3060        case angle::FormatID::R16G16_UNORM:
3061            this->metalFormat        = MTLVertexFormatUShort2Normalized;
3062            this->actualFormatId     = angle::FormatID::R16G16_UNORM;
3063            this->vertexLoadFunction = CopyNativeVertexData<GLushort, 2, 2, 0>;
3064            this->defaultAlpha       = 0;
3065            break;
3066
3067        case angle::FormatID::R16G16_USCALED:
3068            this->metalFormat        = MTLVertexFormatUShort2;
3069            this->actualFormatId     = angle::FormatID::R16G16_USCALED;
3070            this->vertexLoadFunction = CopyNativeVertexData<GLushort, 2, 2, 0>;
3071            this->defaultAlpha       = 0;
3072            break;
3073
3074        case angle::FormatID::R16_FLOAT:
3075            if (tightlyPacked)
3076            {
3077                this->metalFormat        = MTLVertexFormatHalf2;
3078                this->actualFormatId     = angle::FormatID::R16G16_FLOAT;
3079                this->vertexLoadFunction = CopyNativeVertexData<GLhalf, 1, 2, 0>;
3080                this->defaultAlpha       = 0;
3081            }
3082            else
3083            {
3084                this->metalFormat        = MTLVertexFormatHalf;
3085                this->actualFormatId     = angle::FormatID::R16_FLOAT;
3086                this->vertexLoadFunction = CopyNativeVertexData<GLhalf, 1, 1, 0>;
3087                this->defaultAlpha       = 0;
3088            }
3089            break;
3090
3091        case angle::FormatID::R16_SINT:
3092            if (tightlyPacked)
3093            {
3094                this->metalFormat        = MTLVertexFormatShort2;
3095                this->actualFormatId     = angle::FormatID::R16G16_SINT;
3096                this->vertexLoadFunction = CopyNativeVertexData<GLshort, 1, 2, 0>;
3097                this->defaultAlpha       = 0;
3098            }
3099            else
3100            {
3101                this->metalFormat        = MTLVertexFormatShort;
3102                this->actualFormatId     = angle::FormatID::R16_SINT;
3103                this->vertexLoadFunction = CopyNativeVertexData<GLshort, 1, 1, 0>;
3104                this->defaultAlpha       = 0;
3105            }
3106            break;
3107
3108        case angle::FormatID::R16_SNORM:
3109            if (tightlyPacked)
3110            {
3111                this->metalFormat        = MTLVertexFormatShort2Normalized;
3112                this->actualFormatId     = angle::FormatID::R16G16_SNORM;
3113                this->vertexLoadFunction = CopyNativeVertexData<GLshort, 1, 2, 0>;
3114                this->defaultAlpha       = 0;
3115            }
3116            else
3117            {
3118                this->metalFormat        = MTLVertexFormatShortNormalized;
3119                this->actualFormatId     = angle::FormatID::R16_SNORM;
3120                this->vertexLoadFunction = CopyNativeVertexData<GLshort, 1, 1, 0>;
3121                this->defaultAlpha       = 0;
3122            }
3123            break;
3124
3125        case angle::FormatID::R16_SSCALED:
3126            if (tightlyPacked)
3127            {
3128                this->metalFormat        = MTLVertexFormatShort2;
3129                this->actualFormatId     = angle::FormatID::R16G16_SINT;
3130                this->vertexLoadFunction = CopyNativeVertexData<GLshort, 1, 2, 0>;
3131                this->defaultAlpha       = 0;
3132            }
3133            else
3134            {
3135                this->metalFormat        = MTLVertexFormatShort;
3136                this->actualFormatId     = angle::FormatID::R16_SSCALED;
3137                this->vertexLoadFunction = CopyNativeVertexData<GLshort, 1, 1, 0>;
3138                this->defaultAlpha       = 0;
3139            }
3140            break;
3141
3142        case angle::FormatID::R16_UINT:
3143            if (tightlyPacked)
3144            {
3145                this->metalFormat        = MTLVertexFormatUShort2;
3146                this->actualFormatId     = angle::FormatID::R16G16_UINT;
3147                this->vertexLoadFunction = CopyNativeVertexData<GLushort, 1, 2, 0>;
3148                this->defaultAlpha       = 0;
3149            }
3150            else
3151            {
3152                this->metalFormat        = MTLVertexFormatUShort;
3153                this->actualFormatId     = angle::FormatID::R16_UINT;
3154                this->vertexLoadFunction = CopyNativeVertexData<GLushort, 1, 1, 0>;
3155                this->defaultAlpha       = 0;
3156            }
3157            break;
3158
3159        case angle::FormatID::R16_UNORM:
3160            if (tightlyPacked)
3161            {
3162                this->metalFormat        = MTLVertexFormatUShort2Normalized;
3163                this->actualFormatId     = angle::FormatID::R16G16_UNORM;
3164                this->vertexLoadFunction = CopyNativeVertexData<GLushort, 1, 2, 0>;
3165                this->defaultAlpha       = 0;
3166            }
3167            else
3168            {
3169                this->metalFormat        = MTLVertexFormatUShortNormalized;
3170                this->actualFormatId     = angle::FormatID::R16_UNORM;
3171                this->vertexLoadFunction = CopyNativeVertexData<GLushort, 1, 1, 0>;
3172                this->defaultAlpha       = 0;
3173            }
3174            break;
3175
3176        case angle::FormatID::R16_USCALED:
3177            if (tightlyPacked)
3178            {
3179                this->metalFormat        = MTLVertexFormatUShort2;
3180                this->actualFormatId     = angle::FormatID::R16G16_UINT;
3181                this->vertexLoadFunction = CopyNativeVertexData<GLushort, 1, 2, 0>;
3182                this->defaultAlpha       = 0;
3183            }
3184            else
3185            {
3186                this->metalFormat        = MTLVertexFormatUShort;
3187                this->actualFormatId     = angle::FormatID::R16_USCALED;
3188                this->vertexLoadFunction = CopyNativeVertexData<GLushort, 1, 1, 0>;
3189                this->defaultAlpha       = 0;
3190            }
3191            break;
3192
3193        case angle::FormatID::R32G32B32A32_FLOAT:
3194            this->metalFormat        = MTLVertexFormatFloat4;
3195            this->actualFormatId     = angle::FormatID::R32G32B32A32_FLOAT;
3196            this->vertexLoadFunction = CopyNativeVertexData<GLfloat, 4, 4, 0>;
3197            this->defaultAlpha       = 0;
3198            break;
3199
3200        case angle::FormatID::R32G32B32A32_SINT:
3201            this->metalFormat        = MTLVertexFormatInt4;
3202            this->actualFormatId     = angle::FormatID::R32G32B32A32_SINT;
3203            this->vertexLoadFunction = CopyNativeVertexData<GLint, 4, 4, 0>;
3204            this->defaultAlpha       = 0;
3205            break;
3206
3207        case angle::FormatID::R32G32B32A32_UINT:
3208            this->metalFormat        = MTLVertexFormatUInt4;
3209            this->actualFormatId     = angle::FormatID::R32G32B32A32_UINT;
3210            this->vertexLoadFunction = CopyNativeVertexData<GLuint, 4, 4, 0>;
3211            this->defaultAlpha       = 0;
3212            break;
3213
3214        case angle::FormatID::R32G32B32_FLOAT:
3215            this->metalFormat        = MTLVertexFormatFloat3;
3216            this->actualFormatId     = angle::FormatID::R32G32B32_FLOAT;
3217            this->vertexLoadFunction = CopyNativeVertexData<GLfloat, 3, 3, 0>;
3218            this->defaultAlpha       = 0;
3219            break;
3220
3221        case angle::FormatID::R32G32B32_SINT:
3222            this->metalFormat        = MTLVertexFormatInt3;
3223            this->actualFormatId     = angle::FormatID::R32G32B32_SINT;
3224            this->vertexLoadFunction = CopyNativeVertexData<GLint, 3, 3, 0>;
3225            this->defaultAlpha       = 0;
3226            break;
3227
3228        case angle::FormatID::R32G32B32_UINT:
3229            this->metalFormat        = MTLVertexFormatUInt3;
3230            this->actualFormatId     = angle::FormatID::R32G32B32_UINT;
3231            this->vertexLoadFunction = CopyNativeVertexData<GLuint, 3, 3, 0>;
3232            this->defaultAlpha       = 0;
3233            break;
3234
3235        case angle::FormatID::R32G32_FLOAT:
3236            this->metalFormat        = MTLVertexFormatFloat2;
3237            this->actualFormatId     = angle::FormatID::R32G32_FLOAT;
3238            this->vertexLoadFunction = CopyNativeVertexData<GLfloat, 2, 2, 0>;
3239            this->defaultAlpha       = 0;
3240            break;
3241
3242        case angle::FormatID::R32G32_SINT:
3243            this->metalFormat        = MTLVertexFormatInt2;
3244            this->actualFormatId     = angle::FormatID::R32G32_SINT;
3245            this->vertexLoadFunction = CopyNativeVertexData<GLint, 2, 2, 0>;
3246            this->defaultAlpha       = 0;
3247            break;
3248
3249        case angle::FormatID::R32G32_UINT:
3250            this->metalFormat        = MTLVertexFormatUInt2;
3251            this->actualFormatId     = angle::FormatID::R32G32_UINT;
3252            this->vertexLoadFunction = CopyNativeVertexData<GLuint, 2, 2, 0>;
3253            this->defaultAlpha       = 0;
3254            break;
3255
3256        case angle::FormatID::R32_FLOAT:
3257            this->metalFormat        = MTLVertexFormatFloat;
3258            this->actualFormatId     = angle::FormatID::R32_FLOAT;
3259            this->vertexLoadFunction = CopyNativeVertexData<GLfloat, 1, 1, 0>;
3260            this->defaultAlpha       = 0;
3261            break;
3262
3263        case angle::FormatID::R32_SINT:
3264            this->metalFormat        = MTLVertexFormatInt;
3265            this->actualFormatId     = angle::FormatID::R32_SINT;
3266            this->vertexLoadFunction = CopyNativeVertexData<GLint, 1, 1, 0>;
3267            this->defaultAlpha       = 0;
3268            break;
3269
3270        case angle::FormatID::R32_UINT:
3271            this->metalFormat        = MTLVertexFormatUInt;
3272            this->actualFormatId     = angle::FormatID::R32_UINT;
3273            this->vertexLoadFunction = CopyNativeVertexData<GLuint, 1, 1, 0>;
3274            this->defaultAlpha       = 0;
3275            break;
3276
3277        case angle::FormatID::R8G8B8A8_SINT:
3278            this->metalFormat        = MTLVertexFormatChar4;
3279            this->actualFormatId     = angle::FormatID::R8G8B8A8_SINT;
3280            this->vertexLoadFunction = CopyNativeVertexData<GLbyte, 4, 4, 0>;
3281            this->defaultAlpha       = 0;
3282            break;
3283
3284        case angle::FormatID::R8G8B8A8_SNORM:
3285            this->metalFormat        = MTLVertexFormatChar4Normalized;
3286            this->actualFormatId     = angle::FormatID::R8G8B8A8_SNORM;
3287            this->vertexLoadFunction = CopyNativeVertexData<GLbyte, 4, 4, 0>;
3288            this->defaultAlpha       = 0;
3289            break;
3290
3291        case angle::FormatID::R8G8B8A8_SSCALED:
3292            this->metalFormat        = MTLVertexFormatChar4;
3293            this->actualFormatId     = angle::FormatID::R8G8B8A8_SSCALED;
3294            this->vertexLoadFunction = CopyNativeVertexData<GLbyte, 4, 4, 0>;
3295            this->defaultAlpha       = 0;
3296            break;
3297
3298        case angle::FormatID::R8G8B8A8_UINT:
3299            this->metalFormat        = MTLVertexFormatUChar4;
3300            this->actualFormatId     = angle::FormatID::R8G8B8A8_UINT;
3301            this->vertexLoadFunction = CopyNativeVertexData<GLubyte, 4, 4, 0>;
3302            this->defaultAlpha       = 0;
3303            break;
3304
3305        case angle::FormatID::R8G8B8A8_UNORM:
3306            this->metalFormat        = MTLVertexFormatUChar4Normalized;
3307            this->actualFormatId     = angle::FormatID::R8G8B8A8_UNORM;
3308            this->vertexLoadFunction = CopyNativeVertexData<GLubyte, 4, 4, 0>;
3309            this->defaultAlpha       = 0;
3310            break;
3311
3312        case angle::FormatID::R8G8B8A8_USCALED:
3313            this->metalFormat        = MTLVertexFormatUChar4;
3314            this->actualFormatId     = angle::FormatID::R8G8B8A8_USCALED;
3315            this->vertexLoadFunction = CopyNativeVertexData<GLubyte, 4, 4, 0>;
3316            this->defaultAlpha       = 0;
3317            break;
3318
3319        case angle::FormatID::R8G8B8_SINT:
3320            if (tightlyPacked)
3321            {
3322                this->metalFormat        = MTLVertexFormatChar4;
3323                this->actualFormatId     = angle::FormatID::R8G8B8A8_SINT;
3324                this->vertexLoadFunction = CopyNativeVertexData<GLbyte, 3, 4, 1>;
3325                this->defaultAlpha       = 1;
3326            }
3327            else
3328            {
3329                this->metalFormat        = MTLVertexFormatChar3;
3330                this->actualFormatId     = angle::FormatID::R8G8B8_SINT;
3331                this->vertexLoadFunction = CopyNativeVertexData<GLbyte, 3, 3, 0>;
3332                this->defaultAlpha       = 0;
3333            }
3334            break;
3335
3336        case angle::FormatID::R8G8B8_SNORM:
3337            if (tightlyPacked)
3338            {
3339                this->metalFormat    = MTLVertexFormatChar4Normalized;
3340                this->actualFormatId = angle::FormatID::R8G8B8A8_SNORM;
3341                this->vertexLoadFunction =
3342                    CopyNativeVertexData<GLbyte, 3, 4, std::numeric_limits<GLbyte>::max()>;
3343                this->defaultAlpha = std::numeric_limits<GLbyte>::max();
3344            }
3345            else
3346            {
3347                this->metalFormat        = MTLVertexFormatChar3Normalized;
3348                this->actualFormatId     = angle::FormatID::R8G8B8_SNORM;
3349                this->vertexLoadFunction = CopyNativeVertexData<GLbyte, 3, 3, 0>;
3350                this->defaultAlpha       = 0;
3351            }
3352            break;
3353
3354        case angle::FormatID::R8G8B8_SSCALED:
3355            if (tightlyPacked)
3356            {
3357                this->metalFormat        = MTLVertexFormatChar4;
3358                this->actualFormatId     = angle::FormatID::R8G8B8A8_SINT;
3359                this->vertexLoadFunction = CopyNativeVertexData<GLbyte, 3, 4, 1>;
3360                this->defaultAlpha       = 1;
3361            }
3362            else
3363            {
3364                this->metalFormat        = MTLVertexFormatChar3;
3365                this->actualFormatId     = angle::FormatID::R8G8B8_SSCALED;
3366                this->vertexLoadFunction = CopyNativeVertexData<GLbyte, 3, 3, 0>;
3367                this->defaultAlpha       = 0;
3368            }
3369            break;
3370
3371        case angle::FormatID::R8G8B8_UINT:
3372            if (tightlyPacked)
3373            {
3374                this->metalFormat        = MTLVertexFormatUChar4;
3375                this->actualFormatId     = angle::FormatID::R8G8B8A8_UINT;
3376                this->vertexLoadFunction = CopyNativeVertexData<GLubyte, 3, 4, 1>;
3377                this->defaultAlpha       = 1;
3378            }
3379            else
3380            {
3381                this->metalFormat        = MTLVertexFormatUChar3;
3382                this->actualFormatId     = angle::FormatID::R8G8B8_UINT;
3383                this->vertexLoadFunction = CopyNativeVertexData<GLubyte, 3, 3, 0>;
3384                this->defaultAlpha       = 0;
3385            }
3386            break;
3387
3388        case angle::FormatID::R8G8B8_UNORM:
3389            if (tightlyPacked)
3390            {
3391                this->metalFormat    = MTLVertexFormatUChar4Normalized;
3392                this->actualFormatId = angle::FormatID::R8G8B8A8_UNORM;
3393                this->vertexLoadFunction =
3394                    CopyNativeVertexData<GLubyte, 3, 4, std::numeric_limits<GLubyte>::max()>;
3395                this->defaultAlpha = std::numeric_limits<GLubyte>::max();
3396            }
3397            else
3398            {
3399                this->metalFormat        = MTLVertexFormatUChar3Normalized;
3400                this->actualFormatId     = angle::FormatID::R8G8B8_UNORM;
3401                this->vertexLoadFunction = CopyNativeVertexData<GLubyte, 3, 3, 0>;
3402                this->defaultAlpha       = 0;
3403            }
3404            break;
3405
3406        case angle::FormatID::R8G8B8_USCALED:
3407            if (tightlyPacked)
3408            {
3409                this->metalFormat        = MTLVertexFormatUChar4;
3410                this->actualFormatId     = angle::FormatID::R8G8B8A8_UINT;
3411                this->vertexLoadFunction = CopyNativeVertexData<GLubyte, 3, 4, 1>;
3412                this->defaultAlpha       = 1;
3413            }
3414            else
3415            {
3416                this->metalFormat        = MTLVertexFormatUChar3;
3417                this->actualFormatId     = angle::FormatID::R8G8B8_USCALED;
3418                this->vertexLoadFunction = CopyNativeVertexData<GLubyte, 3, 3, 0>;
3419                this->defaultAlpha       = 0;
3420            }
3421            break;
3422
3423        case angle::FormatID::R8G8_SINT:
3424            if (tightlyPacked)
3425            {
3426                this->metalFormat        = MTLVertexFormatChar4;
3427                this->actualFormatId     = angle::FormatID::R8G8B8A8_SINT;
3428                this->vertexLoadFunction = CopyNativeVertexData<GLbyte, 2, 4, 1>;
3429                this->defaultAlpha       = 1;
3430            }
3431            else
3432            {
3433                this->metalFormat        = MTLVertexFormatChar2;
3434                this->actualFormatId     = angle::FormatID::R8G8_SINT;
3435                this->vertexLoadFunction = CopyNativeVertexData<GLbyte, 2, 2, 0>;
3436                this->defaultAlpha       = 0;
3437            }
3438            break;
3439
3440        case angle::FormatID::R8G8_SNORM:
3441            if (tightlyPacked)
3442            {
3443                this->metalFormat    = MTLVertexFormatChar4Normalized;
3444                this->actualFormatId = angle::FormatID::R8G8B8A8_SNORM;
3445                this->vertexLoadFunction =
3446                    CopyNativeVertexData<GLbyte, 2, 4, std::numeric_limits<GLbyte>::max()>;
3447                this->defaultAlpha = std::numeric_limits<GLbyte>::max();
3448            }
3449            else
3450            {
3451                this->metalFormat        = MTLVertexFormatChar2Normalized;
3452                this->actualFormatId     = angle::FormatID::R8G8_SNORM;
3453                this->vertexLoadFunction = CopyNativeVertexData<GLbyte, 2, 2, 0>;
3454                this->defaultAlpha       = 0;
3455            }
3456            break;
3457
3458        case angle::FormatID::R8G8_SSCALED:
3459            if (tightlyPacked)
3460            {
3461                this->metalFormat        = MTLVertexFormatChar4;
3462                this->actualFormatId     = angle::FormatID::R8G8B8A8_SINT;
3463                this->vertexLoadFunction = CopyNativeVertexData<GLbyte, 2, 4, 1>;
3464                this->defaultAlpha       = 1;
3465            }
3466            else
3467            {
3468                this->metalFormat        = MTLVertexFormatChar2;
3469                this->actualFormatId     = angle::FormatID::R8G8_SSCALED;
3470                this->vertexLoadFunction = CopyNativeVertexData<GLbyte, 2, 2, 0>;
3471                this->defaultAlpha       = 0;
3472            }
3473            break;
3474
3475        case angle::FormatID::R8G8_UINT:
3476            if (tightlyPacked)
3477            {
3478                this->metalFormat        = MTLVertexFormatUChar4;
3479                this->actualFormatId     = angle::FormatID::R8G8B8A8_UINT;
3480                this->vertexLoadFunction = CopyNativeVertexData<GLubyte, 2, 4, 1>;
3481                this->defaultAlpha       = 1;
3482            }
3483            else
3484            {
3485                this->metalFormat        = MTLVertexFormatUChar2;
3486                this->actualFormatId     = angle::FormatID::R8G8_UINT;
3487                this->vertexLoadFunction = CopyNativeVertexData<GLubyte, 2, 2, 0>;
3488                this->defaultAlpha       = 0;
3489            }
3490            break;
3491
3492        case angle::FormatID::R8G8_UNORM:
3493            if (tightlyPacked)
3494            {
3495                this->metalFormat    = MTLVertexFormatUChar4Normalized;
3496                this->actualFormatId = angle::FormatID::R8G8B8A8_UNORM;
3497                this->vertexLoadFunction =
3498                    CopyNativeVertexData<GLubyte, 2, 4, std::numeric_limits<GLubyte>::max()>;
3499                this->defaultAlpha = std::numeric_limits<GLubyte>::max();
3500            }
3501            else
3502            {
3503                this->metalFormat        = MTLVertexFormatUChar2Normalized;
3504                this->actualFormatId     = angle::FormatID::R8G8_UNORM;
3505                this->vertexLoadFunction = CopyNativeVertexData<GLubyte, 2, 2, 0>;
3506                this->defaultAlpha       = 0;
3507            }
3508            break;
3509
3510        case angle::FormatID::R8G8_USCALED:
3511            if (tightlyPacked)
3512            {
3513                this->metalFormat        = MTLVertexFormatUChar4;
3514                this->actualFormatId     = angle::FormatID::R8G8B8A8_UINT;
3515                this->vertexLoadFunction = CopyNativeVertexData<GLubyte, 2, 4, 1>;
3516                this->defaultAlpha       = 1;
3517            }
3518            else
3519            {
3520                this->metalFormat        = MTLVertexFormatUChar2;
3521                this->actualFormatId     = angle::FormatID::R8G8_USCALED;
3522                this->vertexLoadFunction = CopyNativeVertexData<GLubyte, 2, 2, 0>;
3523                this->defaultAlpha       = 0;
3524            }
3525            break;
3526
3527        case angle::FormatID::R8_SINT:
3528            if (tightlyPacked)
3529            {
3530                this->metalFormat        = MTLVertexFormatChar4;
3531                this->actualFormatId     = angle::FormatID::R8G8B8A8_SINT;
3532                this->vertexLoadFunction = CopyNativeVertexData<GLbyte, 1, 4, 1>;
3533                this->defaultAlpha       = 1;
3534            }
3535            else
3536            {
3537                this->metalFormat        = MTLVertexFormatChar;
3538                this->actualFormatId     = angle::FormatID::R8_SINT;
3539                this->vertexLoadFunction = CopyNativeVertexData<GLbyte, 1, 1, 0>;
3540                this->defaultAlpha       = 0;
3541            }
3542            break;
3543
3544        case angle::FormatID::R8_SNORM:
3545            if (tightlyPacked)
3546            {
3547                this->metalFormat    = MTLVertexFormatChar4Normalized;
3548                this->actualFormatId = angle::FormatID::R8G8B8A8_SNORM;
3549                this->vertexLoadFunction =
3550                    CopyNativeVertexData<GLbyte, 1, 4, std::numeric_limits<GLbyte>::max()>;
3551                this->defaultAlpha = std::numeric_limits<GLbyte>::max();
3552            }
3553            else
3554            {
3555                this->metalFormat        = MTLVertexFormatCharNormalized;
3556                this->actualFormatId     = angle::FormatID::R8_SNORM;
3557                this->vertexLoadFunction = CopyNativeVertexData<GLbyte, 1, 1, 0>;
3558                this->defaultAlpha       = 0;
3559            }
3560            break;
3561
3562        case angle::FormatID::R8_SSCALED:
3563            if (tightlyPacked)
3564            {
3565                this->metalFormat        = MTLVertexFormatChar4;
3566                this->actualFormatId     = angle::FormatID::R8G8B8A8_SINT;
3567                this->vertexLoadFunction = CopyNativeVertexData<GLbyte, 1, 4, 1>;
3568                this->defaultAlpha       = 1;
3569            }
3570            else
3571            {
3572                this->metalFormat        = MTLVertexFormatChar;
3573                this->actualFormatId     = angle::FormatID::R8_SSCALED;
3574                this->vertexLoadFunction = CopyNativeVertexData<GLbyte, 1, 1, 0>;
3575                this->defaultAlpha       = 0;
3576            }
3577            break;
3578
3579        case angle::FormatID::R8_UINT:
3580            if (tightlyPacked)
3581            {
3582                this->metalFormat        = MTLVertexFormatUChar4;
3583                this->actualFormatId     = angle::FormatID::R8G8B8A8_UINT;
3584                this->vertexLoadFunction = CopyNativeVertexData<GLubyte, 1, 4, 1>;
3585                this->defaultAlpha       = 1;
3586            }
3587            else
3588            {
3589                this->metalFormat        = MTLVertexFormatUChar;
3590                this->actualFormatId     = angle::FormatID::R8_UINT;
3591                this->vertexLoadFunction = CopyNativeVertexData<GLubyte, 1, 1, 0>;
3592                this->defaultAlpha       = 0;
3593            }
3594            break;
3595
3596        case angle::FormatID::R8_UNORM:
3597            if (tightlyPacked)
3598            {
3599                this->metalFormat    = MTLVertexFormatUChar4Normalized;
3600                this->actualFormatId = angle::FormatID::R8G8B8A8_UNORM;
3601                this->vertexLoadFunction =
3602                    CopyNativeVertexData<GLubyte, 1, 4, std::numeric_limits<GLubyte>::max()>;
3603                this->defaultAlpha = std::numeric_limits<GLubyte>::max();
3604            }
3605            else
3606            {
3607                this->metalFormat        = MTLVertexFormatUCharNormalized;
3608                this->actualFormatId     = angle::FormatID::R8_UNORM;
3609                this->vertexLoadFunction = CopyNativeVertexData<GLubyte, 1, 1, 0>;
3610                this->defaultAlpha       = 0;
3611            }
3612            break;
3613
3614        case angle::FormatID::R8_USCALED:
3615            if (tightlyPacked)
3616            {
3617                this->metalFormat        = MTLVertexFormatUChar4;
3618                this->actualFormatId     = angle::FormatID::R8G8B8A8_UINT;
3619                this->vertexLoadFunction = CopyNativeVertexData<GLubyte, 1, 4, 1>;
3620                this->defaultAlpha       = 1;
3621            }
3622            else
3623            {
3624                this->metalFormat        = MTLVertexFormatUChar;
3625                this->actualFormatId     = angle::FormatID::R8_USCALED;
3626                this->vertexLoadFunction = CopyNativeVertexData<GLubyte, 1, 1, 0>;
3627                this->defaultAlpha       = 0;
3628            }
3629            break;
3630
3631        case angle::FormatID::R10G10B10A2_SINT:
3632            this->metalFormat        = MTLVertexFormatFloat4;
3633            this->actualFormatId     = angle::FormatID::R32G32B32A32_FLOAT;
3634            this->vertexLoadFunction = CopyXYZ10W2ToXYZWFloatVertexData<true, false, true, false>;
3635            this->defaultAlpha       = 0;
3636            this->actualSameGLType   = false;
3637            break;
3638
3639        case angle::FormatID::R10G10B10A2_SSCALED:
3640            this->metalFormat        = MTLVertexFormatFloat4;
3641            this->actualFormatId     = angle::FormatID::R32G32B32A32_FLOAT;
3642            this->vertexLoadFunction = CopyXYZ10W2ToXYZWFloatVertexData<true, false, true, false>;
3643            this->defaultAlpha       = 0;
3644            this->actualSameGLType   = false;
3645            break;
3646
3647        case angle::FormatID::R10G10B10A2_UINT:
3648            this->metalFormat        = MTLVertexFormatFloat4;
3649            this->actualFormatId     = angle::FormatID::R32G32B32A32_FLOAT;
3650            this->vertexLoadFunction = CopyXYZ10W2ToXYZWFloatVertexData<false, false, true, false>;
3651            this->defaultAlpha       = 0;
3652            this->actualSameGLType   = false;
3653            break;
3654
3655        case angle::FormatID::R10G10B10A2_USCALED:
3656            this->metalFormat        = MTLVertexFormatFloat4;
3657            this->actualFormatId     = angle::FormatID::R32G32B32A32_FLOAT;
3658            this->vertexLoadFunction = CopyXYZ10W2ToXYZWFloatVertexData<false, false, true, false>;
3659            this->defaultAlpha       = 0;
3660            this->actualSameGLType   = false;
3661            break;
3662
3663        case angle::FormatID::R32G32B32A32_FIXED:
3664            this->metalFormat        = MTLVertexFormatFloat4;
3665            this->actualFormatId     = angle::FormatID::R32G32B32A32_FLOAT;
3666            this->vertexLoadFunction = Copy32FixedTo32FVertexData<4, 4>;
3667            this->defaultAlpha       = 0;
3668            this->actualSameGLType   = false;
3669            break;
3670
3671        case angle::FormatID::R32G32B32A32_SNORM:
3672            this->metalFormat        = MTLVertexFormatFloat4;
3673            this->actualFormatId     = angle::FormatID::R32G32B32A32_FLOAT;
3674            this->vertexLoadFunction = CopyToFloatVertexData<GLint, 4, 4, true, false>;
3675            this->defaultAlpha       = 0;
3676            this->actualSameGLType   = false;
3677            break;
3678
3679        case angle::FormatID::R32G32B32A32_SSCALED:
3680            this->metalFormat        = MTLVertexFormatFloat4;
3681            this->actualFormatId     = angle::FormatID::R32G32B32A32_FLOAT;
3682            this->vertexLoadFunction = CopyToFloatVertexData<GLint, 4, 4, false, false>;
3683            this->defaultAlpha       = 0;
3684            this->actualSameGLType   = false;
3685            break;
3686
3687        case angle::FormatID::R32G32B32A32_UNORM:
3688            this->metalFormat        = MTLVertexFormatFloat4;
3689            this->actualFormatId     = angle::FormatID::R32G32B32A32_FLOAT;
3690            this->vertexLoadFunction = CopyToFloatVertexData<GLuint, 4, 4, true, false>;
3691            this->defaultAlpha       = 0;
3692            this->actualSameGLType   = false;
3693            break;
3694
3695        case angle::FormatID::R32G32B32A32_USCALED:
3696            this->metalFormat        = MTLVertexFormatFloat4;
3697            this->actualFormatId     = angle::FormatID::R32G32B32A32_FLOAT;
3698            this->vertexLoadFunction = CopyToFloatVertexData<GLuint, 4, 4, false, false>;
3699            this->defaultAlpha       = 0;
3700            this->actualSameGLType   = false;
3701            break;
3702
3703        case angle::FormatID::R32G32B32_FIXED:
3704            this->metalFormat        = MTLVertexFormatFloat3;
3705            this->actualFormatId     = angle::FormatID::R32G32B32_FLOAT;
3706            this->vertexLoadFunction = Copy32FixedTo32FVertexData<3, 3>;
3707            this->defaultAlpha       = 0;
3708            this->actualSameGLType   = false;
3709            break;
3710
3711        case angle::FormatID::R32G32B32_SNORM:
3712            this->metalFormat        = MTLVertexFormatFloat3;
3713            this->actualFormatId     = angle::FormatID::R32G32B32_FLOAT;
3714            this->vertexLoadFunction = CopyToFloatVertexData<GLint, 3, 3, true, false>;
3715            this->defaultAlpha       = 0;
3716            this->actualSameGLType   = false;
3717            break;
3718
3719        case angle::FormatID::R32G32B32_SSCALED:
3720            this->metalFormat        = MTLVertexFormatFloat3;
3721            this->actualFormatId     = angle::FormatID::R32G32B32_FLOAT;
3722            this->vertexLoadFunction = CopyToFloatVertexData<GLint, 3, 3, false, false>;
3723            this->defaultAlpha       = 0;
3724            this->actualSameGLType   = false;
3725            break;
3726
3727        case angle::FormatID::R32G32B32_UNORM:
3728            this->metalFormat        = MTLVertexFormatFloat3;
3729            this->actualFormatId     = angle::FormatID::R32G32B32_FLOAT;
3730            this->vertexLoadFunction = CopyToFloatVertexData<GLuint, 3, 3, true, false>;
3731            this->defaultAlpha       = 0;
3732            this->actualSameGLType   = false;
3733            break;
3734
3735        case angle::FormatID::R32G32B32_USCALED:
3736            this->metalFormat        = MTLVertexFormatFloat3;
3737            this->actualFormatId     = angle::FormatID::R32G32B32_FLOAT;
3738            this->vertexLoadFunction = CopyToFloatVertexData<GLuint, 3, 3, false, false>;
3739            this->defaultAlpha       = 0;
3740            this->actualSameGLType   = false;
3741            break;
3742
3743        case angle::FormatID::R32G32_FIXED:
3744            this->metalFormat        = MTLVertexFormatFloat2;
3745            this->actualFormatId     = angle::FormatID::R32G32_FLOAT;
3746            this->vertexLoadFunction = Copy32FixedTo32FVertexData<2, 2>;
3747            this->defaultAlpha       = 0;
3748            this->actualSameGLType   = false;
3749            break;
3750
3751        case angle::FormatID::R32G32_SNORM:
3752            this->metalFormat        = MTLVertexFormatFloat2;
3753            this->actualFormatId     = angle::FormatID::R32G32_FLOAT;
3754            this->vertexLoadFunction = CopyToFloatVertexData<GLint, 2, 2, true, false>;
3755            this->defaultAlpha       = 0;
3756            this->actualSameGLType   = false;
3757            break;
3758
3759        case angle::FormatID::R32G32_SSCALED:
3760            this->metalFormat        = MTLVertexFormatFloat2;
3761            this->actualFormatId     = angle::FormatID::R32G32_FLOAT;
3762            this->vertexLoadFunction = CopyToFloatVertexData<GLint, 2, 2, false, false>;
3763            this->defaultAlpha       = 0;
3764            this->actualSameGLType   = false;
3765            break;
3766
3767        case angle::FormatID::R32G32_UNORM:
3768            this->metalFormat        = MTLVertexFormatFloat2;
3769            this->actualFormatId     = angle::FormatID::R32G32_FLOAT;
3770            this->vertexLoadFunction = CopyToFloatVertexData<GLuint, 2, 2, true, false>;
3771            this->defaultAlpha       = 0;
3772            this->actualSameGLType   = false;
3773            break;
3774
3775        case angle::FormatID::R32G32_USCALED:
3776            this->metalFormat        = MTLVertexFormatFloat2;
3777            this->actualFormatId     = angle::FormatID::R32G32_FLOAT;
3778            this->vertexLoadFunction = CopyToFloatVertexData<GLuint, 2, 2, false, false>;
3779            this->defaultAlpha       = 0;
3780            this->actualSameGLType   = false;
3781            break;
3782
3783        case angle::FormatID::R32_FIXED:
3784            this->metalFormat        = MTLVertexFormatFloat;
3785            this->actualFormatId     = angle::FormatID::R32_FLOAT;
3786            this->vertexLoadFunction = Copy32FixedTo32FVertexData<1, 1>;
3787            this->defaultAlpha       = 0;
3788            this->actualSameGLType   = false;
3789            break;
3790
3791        case angle::FormatID::R32_SNORM:
3792            this->metalFormat        = MTLVertexFormatFloat;
3793            this->actualFormatId     = angle::FormatID::R32_FLOAT;
3794            this->vertexLoadFunction = CopyToFloatVertexData<GLint, 1, 1, true, false>;
3795            this->defaultAlpha       = 0;
3796            this->actualSameGLType   = false;
3797            break;
3798
3799        case angle::FormatID::R32_SSCALED:
3800            this->metalFormat        = MTLVertexFormatFloat;
3801            this->actualFormatId     = angle::FormatID::R32_FLOAT;
3802            this->vertexLoadFunction = CopyToFloatVertexData<GLint, 1, 1, false, false>;
3803            this->defaultAlpha       = 0;
3804            this->actualSameGLType   = false;
3805            break;
3806
3807        case angle::FormatID::R32_UNORM:
3808            this->metalFormat        = MTLVertexFormatFloat;
3809            this->actualFormatId     = angle::FormatID::R32_FLOAT;
3810            this->vertexLoadFunction = CopyToFloatVertexData<GLuint, 1, 1, true, false>;
3811            this->defaultAlpha       = 0;
3812            this->actualSameGLType   = false;
3813            break;
3814
3815        case angle::FormatID::R32_USCALED:
3816            this->metalFormat        = MTLVertexFormatFloat;
3817            this->actualFormatId     = angle::FormatID::R32_FLOAT;
3818            this->vertexLoadFunction = CopyToFloatVertexData<GLuint, 1, 1, false, false>;
3819            this->defaultAlpha       = 0;
3820            this->actualSameGLType   = false;
3821            break;
3822
3823        default:
3824            this->metalFormat        = MTLVertexFormatInvalid;
3825            this->actualFormatId     = angle::FormatID::NONE;
3826            this->vertexLoadFunction = nullptr;
3827            this->defaultAlpha       = 0;
3828            this->actualSameGLType   = false;
3829    }
3830}
3831
3832void FormatTable::initNativeFormatCapsAutogen(const DisplayMtl *display)
3833{
3834    const angle::FeaturesMtl &featuresMtl = display->getFeatures();
3835    // Skip auto resolve if either hasDepth/StencilAutoResolve or allowMultisampleStoreAndResolve
3836    // feature are disabled.
3837    bool supportDepthAutoResolve = featuresMtl.hasDepthAutoResolve.enabled &&
3838                                   featuresMtl.allowMultisampleStoreAndResolve.enabled;
3839    bool supportStencilAutoResolve = featuresMtl.hasStencilAutoResolve.enabled &&
3840                                     featuresMtl.allowMultisampleStoreAndResolve.enabled;
3841    bool supportDepthStencilAutoResolve = supportDepthAutoResolve && supportStencilAutoResolve;
3842
3843    // Source: https://developer.apple.com/metal/Metal-Feature-Set-Tables.pdf
3844    setFormatCaps(MTLPixelFormatA8Unorm, /** filterable*/ true, /** writable*/ false,
3845                  /** blendable*/ false, /** multisample*/ false, /** resolve*/ false,
3846                  /** colorRenderable*/ false, /** depthRenderable*/ false);
3847
3848    setFormatCaps(MTLPixelFormatBGR10A2Unorm, /** filterable*/ true,
3849                  /** writable*/ display->supportsEitherGPUFamily(3, 1), /** blendable*/ true,
3850                  /** multisample*/ true, /** resolve*/ true, /** colorRenderable*/ true,
3851                  /** depthRenderable*/ false);
3852
3853    setFormatCaps(MTLPixelFormatBGRA8Unorm, /** filterable*/ true, /** writable*/ true,
3854                  /** blendable*/ true, /** multisample*/ true, /** resolve*/ true,
3855                  /** colorRenderable*/ true, /** depthRenderable*/ false);
3856
3857    setFormatCaps(MTLPixelFormatBGRA8Unorm_sRGB, /** filterable*/ true,
3858                  /** writable*/ display->supportsAppleGPUFamily(2) && !display->isSimulator(),
3859                  /** blendable*/ true, /** multisample*/ true, /** resolve*/ true,
3860                  /** colorRenderable*/ true, /** depthRenderable*/ false);
3861
3862    setFormatCaps(MTLPixelFormatDepth32Float,
3863                  /** filterable*/ display->supports32BitFloatFiltering(), /** writable*/ false,
3864                  /** blendable*/ false, /** multisample*/ true,
3865                  /** resolve*/ supportDepthAutoResolve, /** colorRenderable*/ false,
3866                  /** depthRenderable*/ true);
3867
3868    setFormatCaps(MTLPixelFormatDepth32Float_Stencil8,
3869                  /** filterable*/ display->supports32BitFloatFiltering(), /** writable*/ false,
3870                  /** blendable*/ false, /** multisample*/ true,
3871                  /** resolve*/ supportDepthStencilAutoResolve, /** colorRenderable*/ false,
3872                  /** depthRenderable*/ true);
3873
3874    setFormatCaps(MTLPixelFormatR16Float, /** filterable*/ true, /** writable*/ true,
3875                  /** blendable*/ true, /** multisample*/ true, /** resolve*/ true,
3876                  /** colorRenderable*/ true, /** depthRenderable*/ false);
3877
3878    setFormatCaps(MTLPixelFormatR16Sint, /** filterable*/ false, /** writable*/ true,
3879                  /** blendable*/ false, /** multisample*/ true, /** resolve*/ false,
3880                  /** colorRenderable*/ true, /** depthRenderable*/ false);
3881
3882    setFormatCaps(MTLPixelFormatR16Snorm, /** filterable*/ true, /** writable*/ true,
3883                  /** blendable*/ true, /** multisample*/ true,
3884                  /** resolve*/ display->supportsMacGPUFamily(1), /** colorRenderable*/ true,
3885                  /** depthRenderable*/ false);
3886
3887    setFormatCaps(MTLPixelFormatR16Uint, /** filterable*/ false, /** writable*/ true,
3888                  /** blendable*/ false, /** multisample*/ true, /** resolve*/ false,
3889                  /** colorRenderable*/ true, /** depthRenderable*/ false);
3890
3891    setFormatCaps(MTLPixelFormatR16Unorm, /** filterable*/ true, /** writable*/ true,
3892                  /** blendable*/ true, /** multisample*/ true,
3893                  /** resolve*/ display->supportsMacGPUFamily(1), /** colorRenderable*/ true,
3894                  /** depthRenderable*/ false);
3895
3896    setFormatCaps(
3897        MTLPixelFormatR32Float,
3898        /** filterable*/ display->supportsMacGPUFamily(1) ||
3899            (display->supportsAppleGPUFamily(7) && display->supports32BitFloatFiltering()),
3900        /** writable*/ true, /** blendable*/ true, /** multisample*/ true,
3901        /** resolve*/ display->supportsMacGPUFamily(1) ||
3902            (display->supportsAppleGPUFamily(7) && display->supports32BitFloatFiltering()),
3903        /** colorRenderable*/ true, /** depthRenderable*/ false);
3904
3905    setFormatCaps(MTLPixelFormatR32Sint, /** filterable*/ false, /** writable*/ true,
3906                  /** blendable*/ false, /** multisample*/ display->supportsMacGPUFamily(1),
3907                  /** resolve*/ false, /** colorRenderable*/ true, /** depthRenderable*/ false);
3908
3909    setFormatCaps(MTLPixelFormatR32Uint, /** filterable*/ false, /** writable*/ true,
3910                  /** blendable*/ false, /** multisample*/ display->supportsMacGPUFamily(1),
3911                  /** resolve*/ false, /** colorRenderable*/ true, /** depthRenderable*/ false);
3912
3913    setFormatCaps(MTLPixelFormatR8Sint, /** filterable*/ false, /** writable*/ true,
3914                  /** blendable*/ false, /** multisample*/ true, /** resolve*/ false,
3915                  /** colorRenderable*/ true, /** depthRenderable*/ false);
3916
3917    setFormatCaps(MTLPixelFormatR8Snorm, /** filterable*/ true, /** writable*/ true,
3918                  /** blendable*/ true, /** multisample*/ true,
3919                  /** resolve*/ display->supportsEitherGPUFamily(2, 1), /** colorRenderable*/ true,
3920                  /** depthRenderable*/ false);
3921
3922    setFormatCaps(MTLPixelFormatR8Uint, /** filterable*/ false, /** writable*/ true,
3923                  /** blendable*/ false, /** multisample*/ true, /** resolve*/ false,
3924                  /** colorRenderable*/ true, /** depthRenderable*/ false);
3925
3926    setFormatCaps(MTLPixelFormatR8Unorm, /** filterable*/ true, /** writable*/ true,
3927                  /** blendable*/ true, /** multisample*/ true, /** resolve*/ true,
3928                  /** colorRenderable*/ true, /** depthRenderable*/ false);
3929
3930    setFormatCaps(MTLPixelFormatRG11B10Float, /** filterable*/ true,
3931                  /** writable*/ display->supportsEitherGPUFamily(3, 1), /** blendable*/ true,
3932                  /** multisample*/ true, /** resolve*/ true, /** colorRenderable*/ true,
3933                  /** depthRenderable*/ false);
3934
3935    setFormatCaps(MTLPixelFormatRG16Float, /** filterable*/ true, /** writable*/ true,
3936                  /** blendable*/ true, /** multisample*/ true, /** resolve*/ true,
3937                  /** colorRenderable*/ true, /** depthRenderable*/ false);
3938
3939    setFormatCaps(MTLPixelFormatRG16Sint, /** filterable*/ false, /** writable*/ true,
3940                  /** blendable*/ false, /** multisample*/ true, /** resolve*/ false,
3941                  /** colorRenderable*/ true, /** depthRenderable*/ false);
3942
3943    setFormatCaps(MTLPixelFormatRG16Snorm, /** filterable*/ true, /** writable*/ true,
3944                  /** blendable*/ true, /** multisample*/ true,
3945                  /** resolve*/ display->supportsMacGPUFamily(1), /** colorRenderable*/ true,
3946                  /** depthRenderable*/ false);
3947
3948    setFormatCaps(MTLPixelFormatRG16Uint, /** filterable*/ false, /** writable*/ true,
3949                  /** blendable*/ false, /** multisample*/ true, /** resolve*/ false,
3950                  /** colorRenderable*/ true, /** depthRenderable*/ false);
3951
3952    setFormatCaps(MTLPixelFormatRG16Unorm, /** filterable*/ true, /** writable*/ true,
3953                  /** blendable*/ true, /** multisample*/ true,
3954                  /** resolve*/ display->supportsMacGPUFamily(1), /** colorRenderable*/ true,
3955                  /** depthRenderable*/ false);
3956
3957    setFormatCaps(
3958        MTLPixelFormatRG32Float,
3959        /** filterable*/ display->supportsMacGPUFamily(1) ||
3960            (display->supportsAppleGPUFamily(7) && display->supports32BitFloatFiltering()),
3961        /** writable*/ true, /** blendable*/ true,
3962        /** multisample*/ display->supportsEitherGPUFamily(7, 1),
3963        /** resolve*/ display->supportsMacGPUFamily(1) ||
3964            (display->supportsAppleGPUFamily(7) && display->supports32BitFloatFiltering()),
3965        /** colorRenderable*/ true, /** depthRenderable*/ false);
3966
3967    setFormatCaps(MTLPixelFormatRG32Sint, /** filterable*/ false, /** writable*/ true,
3968                  /** blendable*/ false, /** multisample*/ display->supportsEitherGPUFamily(7, 1),
3969                  /** resolve*/ false, /** colorRenderable*/ true, /** depthRenderable*/ false);
3970
3971    setFormatCaps(MTLPixelFormatRG32Uint, /** filterable*/ false, /** writable*/ true,
3972                  /** blendable*/ false, /** multisample*/ display->supportsEitherGPUFamily(7, 1),
3973                  /** resolve*/ false, /** colorRenderable*/ true, /** depthRenderable*/ false);
3974
3975    setFormatCaps(MTLPixelFormatRG8Sint, /** filterable*/ false, /** writable*/ true,
3976                  /** blendable*/ false, /** multisample*/ true, /** resolve*/ false,
3977                  /** colorRenderable*/ true, /** depthRenderable*/ false);
3978
3979    setFormatCaps(MTLPixelFormatRG8Snorm, /** filterable*/ true, /** writable*/ true,
3980                  /** blendable*/ true, /** multisample*/ true,
3981                  /** resolve*/ display->supportsEitherGPUFamily(2, 1), /** colorRenderable*/ true,
3982                  /** depthRenderable*/ false);
3983
3984    setFormatCaps(MTLPixelFormatRG8Uint, /** filterable*/ false, /** writable*/ true,
3985                  /** blendable*/ false, /** multisample*/ true, /** resolve*/ false,
3986                  /** colorRenderable*/ true, /** depthRenderable*/ false);
3987
3988    setFormatCaps(MTLPixelFormatRG8Unorm, /** filterable*/ true, /** writable*/ true,
3989                  /** blendable*/ true, /** multisample*/ true, /** resolve*/ true,
3990                  /** colorRenderable*/ true, /** depthRenderable*/ false);
3991
3992    setFormatCaps(MTLPixelFormatRGB10A2Uint, /** filterable*/ false,
3993                  /** writable*/ display->supportsEitherGPUFamily(3, 1), /** blendable*/ false,
3994                  /** multisample*/ true, /** resolve*/ false, /** colorRenderable*/ true,
3995                  /** depthRenderable*/ false);
3996
3997    setFormatCaps(MTLPixelFormatRGB10A2Unorm, /** filterable*/ true,
3998                  /** writable*/ display->supportsEitherGPUFamily(3, 1), /** blendable*/ true,
3999                  /** multisample*/ true, /** resolve*/ true, /** colorRenderable*/ true,
4000                  /** depthRenderable*/ false);
4001
4002    setFormatCaps(
4003        MTLPixelFormatRGB9E5Float, /** filterable*/ true,
4004        /** writable*/ display->supportsAppleGPUFamily(3),
4005        /** blendable*/ display->supportsAppleGPUFamily(1),
4006        /** multisample*/ display->supportsAppleGPUFamily(1),
4007        /** resolve*/ display->supportsAppleGPUFamily(1),
4008        /** colorRenderable*/ display->supportsAppleGPUFamily(1) && !display->isSimulator(),
4009        /** depthRenderable*/ false);
4010
4011    setFormatCaps(MTLPixelFormatRGBA16Float, /** filterable*/ true, /** writable*/ true,
4012                  /** blendable*/ true, /** multisample*/ true, /** resolve*/ true,
4013                  /** colorRenderable*/ true, /** depthRenderable*/ false);
4014
4015    setFormatCaps(MTLPixelFormatRGBA16Sint, /** filterable*/ false, /** writable*/ true,
4016                  /** blendable*/ false, /** multisample*/ true, /** resolve*/ false,
4017                  /** colorRenderable*/ true, /** depthRenderable*/ false);
4018
4019    setFormatCaps(MTLPixelFormatRGBA16Snorm, /** filterable*/ true, /** writable*/ true,
4020                  /** blendable*/ true, /** multisample*/ true,
4021                  /** resolve*/ display->supportsMacGPUFamily(1), /** colorRenderable*/ true,
4022                  /** depthRenderable*/ false);
4023
4024    setFormatCaps(MTLPixelFormatRGBA16Uint, /** filterable*/ false, /** writable*/ true,
4025                  /** blendable*/ false, /** multisample*/ true, /** resolve*/ false,
4026                  /** colorRenderable*/ true, /** depthRenderable*/ false);
4027
4028    setFormatCaps(MTLPixelFormatRGBA16Unorm, /** filterable*/ true, /** writable*/ true,
4029                  /** blendable*/ true, /** multisample*/ true,
4030                  /** resolve*/ display->supportsMacGPUFamily(1), /** colorRenderable*/ true,
4031                  /** depthRenderable*/ false);
4032
4033    setFormatCaps(
4034        MTLPixelFormatRGBA32Float,
4035        /** filterable*/ display->supportsMacGPUFamily(1) ||
4036            (display->supportsAppleGPUFamily(7) && display->supports32BitFloatFiltering()),
4037        /** writable*/ true,
4038        /** blendable*/ display->supportsMacGPUFamily(1) ||
4039            (display->supportsAppleGPUFamily(7) && display->supports32BitFloatFiltering()),
4040        /** multisample*/ display->supportsEitherGPUFamily(7, 1),
4041        /** resolve*/ display->supportsMacGPUFamily(1) ||
4042            (display->supportsAppleGPUFamily(7) && display->supports32BitFloatFiltering()),
4043        /** colorRenderable*/ true, /** depthRenderable*/ false);
4044
4045    setFormatCaps(MTLPixelFormatRGBA32Sint, /** filterable*/ false, /** writable*/ true,
4046                  /** blendable*/ false, /** multisample*/ display->supportsMacGPUFamily(1),
4047                  /** resolve*/ false, /** colorRenderable*/ true, /** depthRenderable*/ false);
4048
4049    setFormatCaps(MTLPixelFormatRGBA32Uint, /** filterable*/ false, /** writable*/ true,
4050                  /** blendable*/ false, /** multisample*/ display->supportsMacGPUFamily(1),
4051                  /** resolve*/ false, /** colorRenderable*/ true, /** depthRenderable*/ false);
4052
4053    setFormatCaps(MTLPixelFormatRGBA8Sint, /** filterable*/ false, /** writable*/ true,
4054                  /** blendable*/ false, /** multisample*/ true, /** resolve*/ false,
4055                  /** colorRenderable*/ true, /** depthRenderable*/ false);
4056
4057    setFormatCaps(MTLPixelFormatRGBA8Snorm, /** filterable*/ true, /** writable*/ true,
4058                  /** blendable*/ true, /** multisample*/ true,
4059                  /** resolve*/ display->supportsEitherGPUFamily(2, 1), /** colorRenderable*/ true,
4060                  /** depthRenderable*/ false);
4061
4062    setFormatCaps(MTLPixelFormatRGBA8Uint, /** filterable*/ false, /** writable*/ true,
4063                  /** blendable*/ false, /** multisample*/ true, /** resolve*/ false,
4064                  /** colorRenderable*/ true, /** depthRenderable*/ false);
4065
4066    setFormatCaps(MTLPixelFormatRGBA8Unorm, /** filterable*/ true, /** writable*/ true,
4067                  /** blendable*/ true, /** multisample*/ true, /** resolve*/ true,
4068                  /** colorRenderable*/ true, /** depthRenderable*/ false);
4069
4070    setFormatCaps(MTLPixelFormatRGBA8Unorm_sRGB, /** filterable*/ true,
4071                  /** writable*/ display->supportsAppleGPUFamily(2) && !display->isSimulator(),
4072                  /** blendable*/ true, /** multisample*/ true, /** resolve*/ true,
4073                  /** colorRenderable*/ true, /** depthRenderable*/ false);
4074
4075    setFormatCaps(MTLPixelFormatStencil8, /** filterable*/ false, /** writable*/ false,
4076                  /** blendable*/ false, /** multisample*/ true,
4077                  /** resolve*/ supportStencilAutoResolve, /** colorRenderable*/ false,
4078                  /** depthRenderable*/ true);
4079
4080#if TARGET_OS_OSX || TARGET_OS_MACCATALYST ||                       \
4081    (TARGET_OS_IOS && __IPHONE_OS_VERSION_MAX_ALLOWED >= 160400) || \
4082    (TARGET_OS_TV && __TV_OS_VERSION_MAX_ALLOWED >= 160400) || TARGET_OS_VISION
4083    setFormatCaps(MTLPixelFormatBC1_RGBA, /** filterable*/ display->supportsBCTextureCompression(),
4084                  /** writable*/ false, /** blendable*/ false, /** multisample*/ false,
4085                  /** resolve*/ false, /** colorRenderable*/ false, /** depthRenderable*/ false);
4086
4087    setFormatCaps(MTLPixelFormatBC1_RGBA_sRGB,
4088                  /** filterable*/ display->supportsBCTextureCompression(), /** writable*/ false,
4089                  /** blendable*/ false, /** multisample*/ false, /** resolve*/ false,
4090                  /** colorRenderable*/ false, /** depthRenderable*/ false);
4091
4092    setFormatCaps(MTLPixelFormatBC2_RGBA, /** filterable*/ display->supportsBCTextureCompression(),
4093                  /** writable*/ false, /** blendable*/ false, /** multisample*/ false,
4094                  /** resolve*/ false, /** colorRenderable*/ false, /** depthRenderable*/ false);
4095
4096    setFormatCaps(MTLPixelFormatBC2_RGBA_sRGB,
4097                  /** filterable*/ display->supportsBCTextureCompression(), /** writable*/ false,
4098                  /** blendable*/ false, /** multisample*/ false, /** resolve*/ false,
4099                  /** colorRenderable*/ false, /** depthRenderable*/ false);
4100
4101    setFormatCaps(MTLPixelFormatBC3_RGBA, /** filterable*/ display->supportsBCTextureCompression(),
4102                  /** writable*/ false, /** blendable*/ false, /** multisample*/ false,
4103                  /** resolve*/ false, /** colorRenderable*/ false, /** depthRenderable*/ false);
4104
4105    setFormatCaps(MTLPixelFormatBC3_RGBA_sRGB,
4106                  /** filterable*/ display->supportsBCTextureCompression(), /** writable*/ false,
4107                  /** blendable*/ false, /** multisample*/ false, /** resolve*/ false,
4108                  /** colorRenderable*/ false, /** depthRenderable*/ false);
4109
4110    setFormatCaps(MTLPixelFormatBC4_RSnorm,
4111                  /** filterable*/ display->supportsBCTextureCompression(), /** writable*/ false,
4112                  /** blendable*/ false, /** multisample*/ false, /** resolve*/ false,
4113                  /** colorRenderable*/ false, /** depthRenderable*/ false);
4114
4115    setFormatCaps(MTLPixelFormatBC4_RUnorm,
4116                  /** filterable*/ display->supportsBCTextureCompression(), /** writable*/ false,
4117                  /** blendable*/ false, /** multisample*/ false, /** resolve*/ false,
4118                  /** colorRenderable*/ false, /** depthRenderable*/ false);
4119
4120    setFormatCaps(MTLPixelFormatBC5_RGSnorm,
4121                  /** filterable*/ display->supportsBCTextureCompression(), /** writable*/ false,
4122                  /** blendable*/ false, /** multisample*/ false, /** resolve*/ false,
4123                  /** colorRenderable*/ false, /** depthRenderable*/ false);
4124
4125    setFormatCaps(MTLPixelFormatBC5_RGUnorm,
4126                  /** filterable*/ display->supportsBCTextureCompression(), /** writable*/ false,
4127                  /** blendable*/ false, /** multisample*/ false, /** resolve*/ false,
4128                  /** colorRenderable*/ false, /** depthRenderable*/ false);
4129
4130    setFormatCaps(MTLPixelFormatBC6H_RGBFloat,
4131                  /** filterable*/ display->supportsBCTextureCompression(), /** writable*/ false,
4132                  /** blendable*/ false, /** multisample*/ false, /** resolve*/ false,
4133                  /** colorRenderable*/ false, /** depthRenderable*/ false);
4134
4135    setFormatCaps(MTLPixelFormatBC6H_RGBUfloat,
4136                  /** filterable*/ display->supportsBCTextureCompression(), /** writable*/ false,
4137                  /** blendable*/ false, /** multisample*/ false, /** resolve*/ false,
4138                  /** colorRenderable*/ false, /** depthRenderable*/ false);
4139
4140    setFormatCaps(MTLPixelFormatBC7_RGBAUnorm,
4141                  /** filterable*/ display->supportsBCTextureCompression(), /** writable*/ false,
4142                  /** blendable*/ false, /** multisample*/ false, /** resolve*/ false,
4143                  /** colorRenderable*/ false, /** depthRenderable*/ false);
4144
4145    setFormatCaps(MTLPixelFormatBC7_RGBAUnorm_sRGB,
4146                  /** filterable*/ display->supportsBCTextureCompression(), /** writable*/ false,
4147                  /** blendable*/ false, /** multisample*/ false, /** resolve*/ false,
4148                  /** colorRenderable*/ false, /** depthRenderable*/ false);
4149
4150#endif  // BC formats
4151#if TARGET_OS_OSX || TARGET_OS_MACCATALYST
4152    setFormatCaps(MTLPixelFormatDepth16Unorm, /** filterable*/ true, /** writable*/ false,
4153                  /** blendable*/ false, /** multisample*/ true,
4154                  /** resolve*/ supportDepthAutoResolve, /** colorRenderable*/ false,
4155                  /** depthRenderable*/ true);
4156
4157    setFormatCaps(MTLPixelFormatDepth24Unorm_Stencil8,
4158                  /** filterable*/ display->supportsMacGPUFamily(1) &&
4159                      display->supportsDepth24Stencil8PixelFormat(),
4160                  /** writable*/ false, /** blendable*/ false, /** multisample*/ true,
4161                  /** resolve*/ supportDepthStencilAutoResolve, /** colorRenderable*/ false,
4162                  /** depthRenderable*/ display->supportsMacGPUFamily(1) &&
4163                      display->supportsDepth24Stencil8PixelFormat());
4164
4165#endif  // TARGET_OS_OSX || TARGET_OS_MACCATALYST
4166#if (TARGET_OS_IPHONE && !TARGET_OS_MACCATALYST) || \
4167    (TARGET_OS_OSX && (__MAC_OS_X_VERSION_MAX_ALLOWED >= 110000))
4168    setFormatCaps(MTLPixelFormatA1BGR5Unorm, /** filterable*/ display->supportsAppleGPUFamily(1),
4169                  /** writable*/ false, /** blendable*/ display->supportsAppleGPUFamily(1),
4170                  /** multisample*/ display->supportsAppleGPUFamily(1),
4171                  /** resolve*/ display->supportsAppleGPUFamily(1),
4172                  /** colorRenderable*/ display->supportsAppleGPUFamily(1),
4173                  /** depthRenderable*/ false);
4174
4175    setFormatCaps(MTLPixelFormatABGR4Unorm, /** filterable*/ display->supportsAppleGPUFamily(1),
4176                  /** writable*/ false, /** blendable*/ display->supportsAppleGPUFamily(1),
4177                  /** multisample*/ display->supportsAppleGPUFamily(1),
4178                  /** resolve*/ display->supportsAppleGPUFamily(1),
4179                  /** colorRenderable*/ display->supportsAppleGPUFamily(1),
4180                  /** depthRenderable*/ false);
4181
4182    setFormatCaps(MTLPixelFormatASTC_10x10_LDR, /** filterable*/ display->supportsAppleGPUFamily(2),
4183                  /** writable*/ false, /** blendable*/ false, /** multisample*/ false,
4184                  /** resolve*/ false, /** colorRenderable*/ false, /** depthRenderable*/ false);
4185
4186    setFormatCaps(MTLPixelFormatASTC_10x10_sRGB,
4187                  /** filterable*/ display->supportsAppleGPUFamily(2), /** writable*/ false,
4188                  /** blendable*/ false, /** multisample*/ false, /** resolve*/ false,
4189                  /** colorRenderable*/ false, /** depthRenderable*/ false);
4190
4191    setFormatCaps(MTLPixelFormatASTC_10x5_LDR, /** filterable*/ display->supportsAppleGPUFamily(2),
4192                  /** writable*/ false, /** blendable*/ false, /** multisample*/ false,
4193                  /** resolve*/ false, /** colorRenderable*/ false, /** depthRenderable*/ false);
4194
4195    setFormatCaps(MTLPixelFormatASTC_10x5_sRGB, /** filterable*/ display->supportsAppleGPUFamily(2),
4196                  /** writable*/ false, /** blendable*/ false, /** multisample*/ false,
4197                  /** resolve*/ false, /** colorRenderable*/ false, /** depthRenderable*/ false);
4198
4199    setFormatCaps(MTLPixelFormatASTC_10x6_LDR, /** filterable*/ display->supportsAppleGPUFamily(2),
4200                  /** writable*/ false, /** blendable*/ false, /** multisample*/ false,
4201                  /** resolve*/ false, /** colorRenderable*/ false, /** depthRenderable*/ false);
4202
4203    setFormatCaps(MTLPixelFormatASTC_10x6_sRGB, /** filterable*/ display->supportsAppleGPUFamily(2),
4204                  /** writable*/ false, /** blendable*/ false, /** multisample*/ false,
4205                  /** resolve*/ false, /** colorRenderable*/ false, /** depthRenderable*/ false);
4206
4207    setFormatCaps(MTLPixelFormatASTC_10x8_LDR, /** filterable*/ display->supportsAppleGPUFamily(2),
4208                  /** writable*/ false, /** blendable*/ false, /** multisample*/ false,
4209                  /** resolve*/ false, /** colorRenderable*/ false, /** depthRenderable*/ false);
4210
4211    setFormatCaps(MTLPixelFormatASTC_10x8_sRGB, /** filterable*/ display->supportsAppleGPUFamily(2),
4212                  /** writable*/ false, /** blendable*/ false, /** multisample*/ false,
4213                  /** resolve*/ false, /** colorRenderable*/ false, /** depthRenderable*/ false);
4214
4215    setFormatCaps(MTLPixelFormatASTC_12x10_LDR, /** filterable*/ display->supportsAppleGPUFamily(2),
4216                  /** writable*/ false, /** blendable*/ false, /** multisample*/ false,
4217                  /** resolve*/ false, /** colorRenderable*/ false, /** depthRenderable*/ false);
4218
4219    setFormatCaps(MTLPixelFormatASTC_12x10_sRGB,
4220                  /** filterable*/ display->supportsAppleGPUFamily(2), /** writable*/ false,
4221                  /** blendable*/ false, /** multisample*/ false, /** resolve*/ false,
4222                  /** colorRenderable*/ false, /** depthRenderable*/ false);
4223
4224    setFormatCaps(MTLPixelFormatASTC_12x12_LDR, /** filterable*/ display->supportsAppleGPUFamily(2),
4225                  /** writable*/ false, /** blendable*/ false, /** multisample*/ false,
4226                  /** resolve*/ false, /** colorRenderable*/ false, /** depthRenderable*/ false);
4227
4228    setFormatCaps(MTLPixelFormatASTC_12x12_sRGB,
4229                  /** filterable*/ display->supportsAppleGPUFamily(2), /** writable*/ false,
4230                  /** blendable*/ false, /** multisample*/ false, /** resolve*/ false,
4231                  /** colorRenderable*/ false, /** depthRenderable*/ false);
4232
4233    setFormatCaps(MTLPixelFormatASTC_4x4_LDR, /** filterable*/ display->supportsAppleGPUFamily(2),
4234                  /** writable*/ false, /** blendable*/ false, /** multisample*/ false,
4235                  /** resolve*/ false, /** colorRenderable*/ false, /** depthRenderable*/ false);
4236
4237    setFormatCaps(MTLPixelFormatASTC_4x4_sRGB, /** filterable*/ display->supportsAppleGPUFamily(2),
4238                  /** writable*/ false, /** blendable*/ false, /** multisample*/ false,
4239                  /** resolve*/ false, /** colorRenderable*/ false, /** depthRenderable*/ false);
4240
4241    setFormatCaps(MTLPixelFormatASTC_5x4_LDR, /** filterable*/ display->supportsAppleGPUFamily(2),
4242                  /** writable*/ false, /** blendable*/ false, /** multisample*/ false,
4243                  /** resolve*/ false, /** colorRenderable*/ false, /** depthRenderable*/ false);
4244
4245    setFormatCaps(MTLPixelFormatASTC_5x4_sRGB, /** filterable*/ display->supportsAppleGPUFamily(2),
4246                  /** writable*/ false, /** blendable*/ false, /** multisample*/ false,
4247                  /** resolve*/ false, /** colorRenderable*/ false, /** depthRenderable*/ false);
4248
4249    setFormatCaps(MTLPixelFormatASTC_5x5_LDR, /** filterable*/ display->supportsAppleGPUFamily(2),
4250                  /** writable*/ false, /** blendable*/ false, /** multisample*/ false,
4251                  /** resolve*/ false, /** colorRenderable*/ false, /** depthRenderable*/ false);
4252
4253    setFormatCaps(MTLPixelFormatASTC_5x5_sRGB, /** filterable*/ display->supportsAppleGPUFamily(2),
4254                  /** writable*/ false, /** blendable*/ false, /** multisample*/ false,
4255                  /** resolve*/ false, /** colorRenderable*/ false, /** depthRenderable*/ false);
4256
4257    setFormatCaps(MTLPixelFormatASTC_6x5_LDR, /** filterable*/ display->supportsAppleGPUFamily(2),
4258                  /** writable*/ false, /** blendable*/ false, /** multisample*/ false,
4259                  /** resolve*/ false, /** colorRenderable*/ false, /** depthRenderable*/ false);
4260
4261    setFormatCaps(MTLPixelFormatASTC_6x5_sRGB, /** filterable*/ display->supportsAppleGPUFamily(2),
4262                  /** writable*/ false, /** blendable*/ false, /** multisample*/ false,
4263                  /** resolve*/ false, /** colorRenderable*/ false, /** depthRenderable*/ false);
4264
4265    setFormatCaps(MTLPixelFormatASTC_6x6_LDR, /** filterable*/ display->supportsAppleGPUFamily(2),
4266                  /** writable*/ false, /** blendable*/ false, /** multisample*/ false,
4267                  /** resolve*/ false, /** colorRenderable*/ false, /** depthRenderable*/ false);
4268
4269    setFormatCaps(MTLPixelFormatASTC_6x6_sRGB, /** filterable*/ display->supportsAppleGPUFamily(2),
4270                  /** writable*/ false, /** blendable*/ false, /** multisample*/ false,
4271                  /** resolve*/ false, /** colorRenderable*/ false, /** depthRenderable*/ false);
4272
4273    setFormatCaps(MTLPixelFormatASTC_8x5_LDR, /** filterable*/ display->supportsAppleGPUFamily(2),
4274                  /** writable*/ false, /** blendable*/ false, /** multisample*/ false,
4275                  /** resolve*/ false, /** colorRenderable*/ false, /** depthRenderable*/ false);
4276
4277    setFormatCaps(MTLPixelFormatASTC_8x5_sRGB, /** filterable*/ display->supportsAppleGPUFamily(2),
4278                  /** writable*/ false, /** blendable*/ false, /** multisample*/ false,
4279                  /** resolve*/ false, /** colorRenderable*/ false, /** depthRenderable*/ false);
4280
4281    setFormatCaps(MTLPixelFormatASTC_8x6_LDR, /** filterable*/ display->supportsAppleGPUFamily(2),
4282                  /** writable*/ false, /** blendable*/ false, /** multisample*/ false,
4283                  /** resolve*/ false, /** colorRenderable*/ false, /** depthRenderable*/ false);
4284
4285    setFormatCaps(MTLPixelFormatASTC_8x6_sRGB, /** filterable*/ display->supportsAppleGPUFamily(2),
4286                  /** writable*/ false, /** blendable*/ false, /** multisample*/ false,
4287                  /** resolve*/ false, /** colorRenderable*/ false, /** depthRenderable*/ false);
4288
4289    setFormatCaps(MTLPixelFormatASTC_8x8_LDR, /** filterable*/ display->supportsAppleGPUFamily(2),
4290                  /** writable*/ false, /** blendable*/ false, /** multisample*/ false,
4291                  /** resolve*/ false, /** colorRenderable*/ false, /** depthRenderable*/ false);
4292
4293    setFormatCaps(MTLPixelFormatASTC_8x8_sRGB, /** filterable*/ display->supportsAppleGPUFamily(2),
4294                  /** writable*/ false, /** blendable*/ false, /** multisample*/ false,
4295                  /** resolve*/ false, /** colorRenderable*/ false, /** depthRenderable*/ false);
4296
4297    setFormatCaps(MTLPixelFormatB5G6R5Unorm, /** filterable*/ display->supportsAppleGPUFamily(1),
4298                  /** writable*/ false, /** blendable*/ display->supportsAppleGPUFamily(1),
4299                  /** multisample*/ display->supportsAppleGPUFamily(1),
4300                  /** resolve*/ display->supportsAppleGPUFamily(1),
4301                  /** colorRenderable*/ display->supportsAppleGPUFamily(1),
4302                  /** depthRenderable*/ false);
4303
4304    setFormatCaps(MTLPixelFormatBGR5A1Unorm, /** filterable*/ display->supportsAppleGPUFamily(1),
4305                  /** writable*/ false, /** blendable*/ display->supportsAppleGPUFamily(1),
4306                  /** multisample*/ display->supportsAppleGPUFamily(1),
4307                  /** resolve*/ display->supportsAppleGPUFamily(1),
4308                  /** colorRenderable*/ display->supportsAppleGPUFamily(1),
4309                  /** depthRenderable*/ false);
4310
4311    setFormatCaps(MTLPixelFormatDepth16Unorm, /** filterable*/ true, /** writable*/ false,
4312                  /** blendable*/ false, /** multisample*/ true,
4313                  /** resolve*/ supportDepthAutoResolve, /** colorRenderable*/ false,
4314                  /** depthRenderable*/ true);
4315
4316    setFormatCaps(MTLPixelFormatEAC_R11Snorm, /** filterable*/ display->supportsAppleGPUFamily(1),
4317                  /** writable*/ false, /** blendable*/ false, /** multisample*/ false,
4318                  /** resolve*/ false, /** colorRenderable*/ false, /** depthRenderable*/ false);
4319
4320    setFormatCaps(MTLPixelFormatEAC_R11Unorm, /** filterable*/ display->supportsAppleGPUFamily(1),
4321                  /** writable*/ false, /** blendable*/ false, /** multisample*/ false,
4322                  /** resolve*/ false, /** colorRenderable*/ false, /** depthRenderable*/ false);
4323
4324    setFormatCaps(MTLPixelFormatEAC_RG11Snorm, /** filterable*/ display->supportsAppleGPUFamily(1),
4325                  /** writable*/ false, /** blendable*/ false, /** multisample*/ false,
4326                  /** resolve*/ false, /** colorRenderable*/ false, /** depthRenderable*/ false);
4327
4328    setFormatCaps(MTLPixelFormatEAC_RG11Unorm, /** filterable*/ display->supportsAppleGPUFamily(1),
4329                  /** writable*/ false, /** blendable*/ false, /** multisample*/ false,
4330                  /** resolve*/ false, /** colorRenderable*/ false, /** depthRenderable*/ false);
4331
4332    setFormatCaps(MTLPixelFormatEAC_RGBA8, /** filterable*/ display->supportsAppleGPUFamily(1),
4333                  /** writable*/ false, /** blendable*/ false, /** multisample*/ false,
4334                  /** resolve*/ false, /** colorRenderable*/ false, /** depthRenderable*/ false);
4335
4336    setFormatCaps(MTLPixelFormatEAC_RGBA8_sRGB, /** filterable*/ display->supportsAppleGPUFamily(1),
4337                  /** writable*/ false, /** blendable*/ false, /** multisample*/ false,
4338                  /** resolve*/ false, /** colorRenderable*/ false, /** depthRenderable*/ false);
4339
4340    setFormatCaps(MTLPixelFormatETC2_RGB8, /** filterable*/ display->supportsAppleGPUFamily(1),
4341                  /** writable*/ false, /** blendable*/ false, /** multisample*/ false,
4342                  /** resolve*/ false, /** colorRenderable*/ false, /** depthRenderable*/ false);
4343
4344    setFormatCaps(MTLPixelFormatETC2_RGB8A1, /** filterable*/ display->supportsAppleGPUFamily(1),
4345                  /** writable*/ false, /** blendable*/ false, /** multisample*/ false,
4346                  /** resolve*/ false, /** colorRenderable*/ false, /** depthRenderable*/ false);
4347
4348    setFormatCaps(MTLPixelFormatETC2_RGB8A1_sRGB,
4349                  /** filterable*/ display->supportsAppleGPUFamily(1), /** writable*/ false,
4350                  /** blendable*/ false, /** multisample*/ false, /** resolve*/ false,
4351                  /** colorRenderable*/ false, /** depthRenderable*/ false);
4352
4353    setFormatCaps(MTLPixelFormatETC2_RGB8_sRGB, /** filterable*/ display->supportsAppleGPUFamily(1),
4354                  /** writable*/ false, /** blendable*/ false, /** multisample*/ false,
4355                  /** resolve*/ false, /** colorRenderable*/ false, /** depthRenderable*/ false);
4356
4357    setFormatCaps(MTLPixelFormatPVRTC_RGBA_2BPP,
4358                  /** filterable*/ display->supportsAppleGPUFamily(1), /** writable*/ false,
4359                  /** blendable*/ false, /** multisample*/ false, /** resolve*/ false,
4360                  /** colorRenderable*/ false, /** depthRenderable*/ false);
4361
4362    setFormatCaps(MTLPixelFormatPVRTC_RGBA_2BPP_sRGB,
4363                  /** filterable*/ display->supportsAppleGPUFamily(1), /** writable*/ false,
4364                  /** blendable*/ false, /** multisample*/ false, /** resolve*/ false,
4365                  /** colorRenderable*/ false, /** depthRenderable*/ false);
4366
4367    setFormatCaps(MTLPixelFormatPVRTC_RGBA_4BPP,
4368                  /** filterable*/ display->supportsAppleGPUFamily(1), /** writable*/ false,
4369                  /** blendable*/ false, /** multisample*/ false, /** resolve*/ false,
4370                  /** colorRenderable*/ false, /** depthRenderable*/ false);
4371
4372    setFormatCaps(MTLPixelFormatPVRTC_RGBA_4BPP_sRGB,
4373                  /** filterable*/ display->supportsAppleGPUFamily(1), /** writable*/ false,
4374                  /** blendable*/ false, /** multisample*/ false, /** resolve*/ false,
4375                  /** colorRenderable*/ false, /** depthRenderable*/ false);
4376
4377    setFormatCaps(MTLPixelFormatPVRTC_RGB_2BPP, /** filterable*/ display->supportsAppleGPUFamily(1),
4378                  /** writable*/ false, /** blendable*/ false, /** multisample*/ false,
4379                  /** resolve*/ false, /** colorRenderable*/ false, /** depthRenderable*/ false);
4380
4381    setFormatCaps(MTLPixelFormatPVRTC_RGB_2BPP_sRGB,
4382                  /** filterable*/ display->supportsAppleGPUFamily(1), /** writable*/ false,
4383                  /** blendable*/ false, /** multisample*/ false, /** resolve*/ false,
4384                  /** colorRenderable*/ false, /** depthRenderable*/ false);
4385
4386    setFormatCaps(MTLPixelFormatPVRTC_RGB_4BPP, /** filterable*/ display->supportsAppleGPUFamily(1),
4387                  /** writable*/ false, /** blendable*/ false, /** multisample*/ false,
4388                  /** resolve*/ false, /** colorRenderable*/ false, /** depthRenderable*/ false);
4389
4390    setFormatCaps(MTLPixelFormatPVRTC_RGB_4BPP_sRGB,
4391                  /** filterable*/ display->supportsAppleGPUFamily(1), /** writable*/ false,
4392                  /** blendable*/ false, /** multisample*/ false, /** resolve*/ false,
4393                  /** colorRenderable*/ false, /** depthRenderable*/ false);
4394
4395    setFormatCaps(MTLPixelFormatR8Unorm_sRGB, /** filterable*/ display->supportsAppleGPUFamily(1),
4396                  /** writable*/ display->supportsAppleGPUFamily(2),
4397                  /** blendable*/ display->supportsAppleGPUFamily(1),
4398                  /** multisample*/ display->supportsAppleGPUFamily(1),
4399                  /** resolve*/ display->supportsAppleGPUFamily(1),
4400                  /** colorRenderable*/ display->supportsAppleGPUFamily(1),
4401                  /** depthRenderable*/ false);
4402
4403    setFormatCaps(MTLPixelFormatRG8Unorm_sRGB, /** filterable*/ display->supportsAppleGPUFamily(1),
4404                  /** writable*/ display->supportsAppleGPUFamily(2),
4405                  /** blendable*/ display->supportsAppleGPUFamily(1),
4406                  /** multisample*/ display->supportsAppleGPUFamily(1),
4407                  /** resolve*/ display->supportsAppleGPUFamily(1),
4408                  /** colorRenderable*/ display->supportsAppleGPUFamily(1),
4409                  /** depthRenderable*/ false);
4410
4411#    if TARGET_OS_IOS || TARGET_OS_OSX || TARGET_OS_VISION
4412    setFormatCaps(MTLPixelFormatASTC_10x10_HDR, /** filterable*/ display->supportsAppleGPUFamily(6),
4413                  /** writable*/ false, /** blendable*/ false, /** multisample*/ false,
4414                  /** resolve*/ false, /** colorRenderable*/ false, /** depthRenderable*/ false);
4415
4416    setFormatCaps(MTLPixelFormatASTC_10x5_HDR, /** filterable*/ display->supportsAppleGPUFamily(6),
4417                  /** writable*/ false, /** blendable*/ false, /** multisample*/ false,
4418                  /** resolve*/ false, /** colorRenderable*/ false, /** depthRenderable*/ false);
4419
4420    setFormatCaps(MTLPixelFormatASTC_10x6_HDR, /** filterable*/ display->supportsAppleGPUFamily(6),
4421                  /** writable*/ false, /** blendable*/ false, /** multisample*/ false,
4422                  /** resolve*/ false, /** colorRenderable*/ false, /** depthRenderable*/ false);
4423
4424    setFormatCaps(MTLPixelFormatASTC_10x8_HDR, /** filterable*/ display->supportsAppleGPUFamily(6),
4425                  /** writable*/ false, /** blendable*/ false, /** multisample*/ false,
4426                  /** resolve*/ false, /** colorRenderable*/ false, /** depthRenderable*/ false);
4427
4428    setFormatCaps(MTLPixelFormatASTC_12x10_HDR, /** filterable*/ display->supportsAppleGPUFamily(6),
4429                  /** writable*/ false, /** blendable*/ false, /** multisample*/ false,
4430                  /** resolve*/ false, /** colorRenderable*/ false, /** depthRenderable*/ false);
4431
4432    setFormatCaps(MTLPixelFormatASTC_12x12_HDR, /** filterable*/ display->supportsAppleGPUFamily(6),
4433                  /** writable*/ false, /** blendable*/ false, /** multisample*/ false,
4434                  /** resolve*/ false, /** colorRenderable*/ false, /** depthRenderable*/ false);
4435
4436    setFormatCaps(MTLPixelFormatASTC_4x4_HDR, /** filterable*/ display->supportsAppleGPUFamily(6),
4437                  /** writable*/ false, /** blendable*/ false, /** multisample*/ false,
4438                  /** resolve*/ false, /** colorRenderable*/ false, /** depthRenderable*/ false);
4439
4440    setFormatCaps(MTLPixelFormatASTC_5x4_HDR, /** filterable*/ display->supportsAppleGPUFamily(6),
4441                  /** writable*/ false, /** blendable*/ false, /** multisample*/ false,
4442                  /** resolve*/ false, /** colorRenderable*/ false, /** depthRenderable*/ false);
4443
4444    setFormatCaps(MTLPixelFormatASTC_5x5_HDR, /** filterable*/ display->supportsAppleGPUFamily(6),
4445                  /** writable*/ false, /** blendable*/ false, /** multisample*/ false,
4446                  /** resolve*/ false, /** colorRenderable*/ false, /** depthRenderable*/ false);
4447
4448    setFormatCaps(MTLPixelFormatASTC_6x5_HDR, /** filterable*/ display->supportsAppleGPUFamily(6),
4449                  /** writable*/ false, /** blendable*/ false, /** multisample*/ false,
4450                  /** resolve*/ false, /** colorRenderable*/ false, /** depthRenderable*/ false);
4451
4452    setFormatCaps(MTLPixelFormatASTC_6x6_HDR, /** filterable*/ display->supportsAppleGPUFamily(6),
4453                  /** writable*/ false, /** blendable*/ false, /** multisample*/ false,
4454                  /** resolve*/ false, /** colorRenderable*/ false, /** depthRenderable*/ false);
4455
4456    setFormatCaps(MTLPixelFormatASTC_8x5_HDR, /** filterable*/ display->supportsAppleGPUFamily(6),
4457                  /** writable*/ false, /** blendable*/ false, /** multisample*/ false,
4458                  /** resolve*/ false, /** colorRenderable*/ false, /** depthRenderable*/ false);
4459
4460    setFormatCaps(MTLPixelFormatASTC_8x6_HDR, /** filterable*/ display->supportsAppleGPUFamily(6),
4461                  /** writable*/ false, /** blendable*/ false, /** multisample*/ false,
4462                  /** resolve*/ false, /** colorRenderable*/ false, /** depthRenderable*/ false);
4463
4464    setFormatCaps(MTLPixelFormatASTC_8x8_HDR, /** filterable*/ display->supportsAppleGPUFamily(6),
4465                  /** writable*/ false, /** blendable*/ false, /** multisample*/ false,
4466                  /** resolve*/ false, /** colorRenderable*/ false, /** depthRenderable*/ false);
4467
4468#    endif  // TARGET_OS_IOS || mac 11.0+ || TARGET_OS_VISION
4469#endif      // TARGET_OS_IPHONE && !TARGET_OS_MACCATALYST || mac 11.0+
4470}
4471
4472}  // namespace mtl
4473}  // namespace rx
4474