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