From 53b89b833b916db27f50ab894f886b4c2ac5ebfe Mon Sep 17 00:00:00 2001 From: Alexey Knyazev Date: Sat, 24 Apr 2021 13:26:02 +0400 Subject: [PATCH] Metal: Add ASTC HDR support ASTC HDR is a superset of ASTC LDR, so always use HDR enums on supported platforms because there is no such difference in OpenGL ES. Bug: angleproject:2634, angleproject:5672 Change-Id: I19a3212bcb949aa9cdeb682ab000aa03125f04a9 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2848509 Reviewed-by: Jamie Madill Reviewed-by: Le Hoang Quyen Commit-Queue: Alexey Knyazev --- .../Metal_format_table.json | 6 +- src/libANGLE/renderer/metal/DisplayMtl.mm | 6 + .../renderer/metal/gen_mtl_format_table.py | 50 +- .../renderer/metal/mtl_format_map.json | 30 +- .../metal/mtl_format_table_autogen.mm | 840 ++++++++++++------ 5 files changed, 627 insertions(+), 305 deletions(-) diff --git a/scripts/code_generation_hashes/Metal_format_table.json b/scripts/code_generation_hashes/Metal_format_table.json index cff79407b..a10111ede 100644 --- a/scripts/code_generation_hashes/Metal_format_table.json +++ b/scripts/code_generation_hashes/Metal_format_table.json @@ -4,9 +4,9 @@ "src/libANGLE/renderer/angle_format_map.json": "5cfbdcad0391a5d70dca1466c5361ee4", "src/libANGLE/renderer/metal/gen_mtl_format_table.py": - "aabe2ff87c8d03cae69125535089e392", + "4b9bc5e4c59175d30de4a42fd110c3b5", "src/libANGLE/renderer/metal/mtl_format_map.json": - "1177b4929d1effd50be45b4347dce2a0", + "811f4f892ea3f1d3036709be0760cba5", "src/libANGLE/renderer/metal/mtl_format_table_autogen.mm": - "3a2466058c38a51a03f9c783188f4987" + "f5fffccd14f237868d299def82765486" } \ No newline at end of file diff --git a/src/libANGLE/renderer/metal/DisplayMtl.mm b/src/libANGLE/renderer/metal/DisplayMtl.mm index e078fefc1..e3a932155 100644 --- a/src/libANGLE/renderer/metal/DisplayMtl.mm +++ b/src/libANGLE/renderer/metal/DisplayMtl.mm @@ -770,6 +770,12 @@ void DisplayMtl::initializeTextureCaps() const mNativeExtensions.textureCompressionSliced3dASTCKHR = true; } + // Enable ASTC HDR, requires MTLGPUFamilyApple6 + if (supportsAppleGPUFamily(6) && mNativeExtensions.textureCompressionASTCLDRKHR) + { + mNativeExtensions.textureCompressionASTCHDRKHR = true; + } + // Disable all depth buffer and stencil buffer readback extensions until we need them mNativeExtensions.readDepthNV = false; mNativeExtensions.readStencilNV = false; diff --git a/src/libANGLE/renderer/metal/gen_mtl_format_table.py b/src/libANGLE/renderer/metal/gen_mtl_format_table.py index deccbe095..c1adf793e 100644 --- a/src/libANGLE/renderer/metal/gen_mtl_format_table.py +++ b/src/libANGLE/renderer/metal/gen_mtl_format_table.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python3 # Copyright 2019 The ANGLE Project Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. @@ -338,15 +338,36 @@ def gen_image_map_switch_es3_case(angle_format, actual_angle_format_info, angle_ gen_format_assign_code) +# Generate format conversion switch case (ASTC LDR/HDR case) +def gen_image_map_switch_astc_case(angle_format, angle_to_gl, angle_to_mtl_map): + gl_format = angle_to_gl[angle_format] + + def gen_format_assign_code(actual_angle_format, angle_to_mtl_map): + return image_format_assign_template2.format( + actual_angle_format=actual_angle_format, + mtl_format=angle_to_mtl_map[actual_angle_format] + "HDR", + init_function=angle_format_utils.get_internal_format_initializer( + gl_format, actual_angle_format), + actual_angle_format_fallback=actual_angle_format, + mtl_format_fallback=angle_to_mtl_map[actual_angle_format] + "LDR", + init_function_fallback=angle_format_utils.get_internal_format_initializer( + gl_format, actual_angle_format), + fallback_condition="display->supportsAppleGPUFamily(6)") + + return gen_image_map_switch_case(angle_format, angle_format, angle_to_mtl_map, + gen_format_assign_code) + + def gen_image_map_switch_string(image_table, angle_to_gl): angle_override = image_table["override"] mac_override_es3 = image_table["override_mac_es3"] mac_override_bc1 = image_table["override_mac_bc1"] ios_override = image_table["override_ios"] - mac_fallbacks = image_table["d24s8_fallbacks_mac"] + mac_d24s8_fallbacks = image_table["d24s8_fallbacks_mac"] angle_to_mtl = image_table["map"] mac_specific_map = image_table["map_mac"] ios_specific_map = image_table["map_ios"] + astc_tpl_map = image_table["map_astc_tpl"] # mac_specific_map + angle_to_mtl: mac_angle_to_mtl = mac_specific_map.copy() @@ -371,18 +392,20 @@ def gen_image_map_switch_string(image_table, angle_to_gl): switch_data += "#if TARGET_OS_OSX || TARGET_OS_MACCATALYST\n" for angle_format in sorted(mac_specific_map.keys()): switch_data += gen_image_map_switch_mac_case(angle_format, angle_format, angle_to_gl, - mac_angle_to_mtl, mac_fallbacks) + mac_angle_to_mtl, mac_d24s8_fallbacks) for angle_format in sorted(mac_override_bc1.keys()): - switch_data += gen_image_map_switch_mac_case(angle_format, mac_override_bc1[angle_format], - angle_to_gl, mac_angle_to_mtl, mac_fallbacks) + switch_data += gen_image_map_switch_simple_case(angle_format, + mac_override_bc1[angle_format], + angle_to_gl, mac_angle_to_mtl) switch_data += "#endif\n" # Override missing ES 3.0 formats for older macOS SDK or Catalyst switch_data += "#if (TARGET_OS_OSX && (__MAC_OS_X_VERSION_MAX_ALLOWED < 101600)) || \\\n" switch_data += "TARGET_OS_MACCATALYST\n" for angle_format in sorted(mac_override_es3.keys()): - switch_data += gen_image_map_switch_mac_case(angle_format, mac_override_es3[angle_format], - angle_to_gl, mac_angle_to_mtl, mac_fallbacks) + switch_data += gen_image_map_switch_simple_case(angle_format, + mac_override_es3[angle_format], + angle_to_gl, mac_angle_to_mtl) switch_data += "#endif\n" # iOS specific @@ -393,6 +416,8 @@ def gen_image_map_switch_string(image_table, angle_to_gl): for angle_format in sorted(ios_override.keys()): switch_data += gen_image_map_switch_simple_case(angle_format, ios_override[angle_format], angle_to_gl, ios_angle_to_mtl) + for angle_format in sorted(astc_tpl_map.keys()): + switch_data += gen_image_map_switch_astc_case(angle_format, angle_to_gl, astc_tpl_map) switch_data += "#endif\n" # Try to support all iOS formats on newer macOS with Apple GPU. @@ -403,9 +428,12 @@ def gen_image_map_switch_string(image_table, angle_to_gl): switch_data += gen_image_map_switch_es3_case(angle_format, angle_format, angle_to_gl, ios_angle_to_mtl, mac_override_es3) else: - # ASTC or PVRTC1 + # ASTC sRGB or PVRTC1 switch_data += gen_image_map_switch_simple_case(angle_format, angle_format, angle_to_gl, ios_specific_map) + # ASTC LDR or HDR + for angle_format in sorted(astc_tpl_map.keys()): + switch_data += gen_image_map_switch_astc_case(angle_format, angle_to_gl, astc_tpl_map) switch_data += "#endif\n" switch_data += " default:\n" @@ -418,6 +446,7 @@ def gen_image_mtl_to_angle_switch_string(image_table): angle_to_mtl = image_table["map"] mac_specific_map = image_table["map_mac"] ios_specific_map = image_table["map_ios"] + astc_tpl_map = image_table["map_astc_tpl"] switch_data = '' @@ -441,6 +470,11 @@ def gen_image_mtl_to_angle_switch_string(image_table): continue switch_data += case_image_mtl_to_angle_template.format( mtl_format=ios_specific_map[angle_format], angle_format=angle_format) + for angle_format in sorted(astc_tpl_map.keys()): + switch_data += case_image_mtl_to_angle_template.format( + mtl_format=astc_tpl_map[angle_format] + "LDR", angle_format=angle_format) + switch_data += case_image_mtl_to_angle_template.format( + mtl_format=astc_tpl_map[angle_format] + "HDR", angle_format=angle_format) switch_data += "#endif // TARGET_OS_IOS || TARGET_OS_TV || mac 11.0+\n" switch_data += " default:\n" diff --git a/src/libANGLE/renderer/metal/mtl_format_map.json b/src/libANGLE/renderer/metal/mtl_format_map.json index b662e04bf..5b60ac739 100644 --- a/src/libANGLE/renderer/metal/mtl_format_map.json +++ b/src/libANGLE/renderer/metal/mtl_format_map.json @@ -103,35 +103,37 @@ "EAC_R11_SNORM_BLOCK": "MTLPixelFormatEAC_R11Snorm", "EAC_R11G11_UNORM_BLOCK": "MTLPixelFormatEAC_RG11Unorm", "EAC_R11G11_SNORM_BLOCK": "MTLPixelFormatEAC_RG11Snorm", - "ASTC_4x4_UNORM_BLOCK": "MTLPixelFormatASTC_4x4_LDR", "ASTC_4x4_SRGB_BLOCK": "MTLPixelFormatASTC_4x4_sRGB", - "ASTC_5x4_UNORM_BLOCK": "MTLPixelFormatASTC_5x4_LDR", "ASTC_5x4_SRGB_BLOCK": "MTLPixelFormatASTC_5x4_sRGB", - "ASTC_5x5_UNORM_BLOCK": "MTLPixelFormatASTC_5x5_LDR", "ASTC_5x5_SRGB_BLOCK": "MTLPixelFormatASTC_5x5_sRGB", - "ASTC_6x5_UNORM_BLOCK": "MTLPixelFormatASTC_6x5_LDR", "ASTC_6x5_SRGB_BLOCK": "MTLPixelFormatASTC_6x5_sRGB", - "ASTC_6x6_UNORM_BLOCK": "MTLPixelFormatASTC_6x6_LDR", "ASTC_6x6_SRGB_BLOCK": "MTLPixelFormatASTC_6x6_sRGB", - "ASTC_8x5_UNORM_BLOCK": "MTLPixelFormatASTC_8x5_LDR", "ASTC_8x5_SRGB_BLOCK": "MTLPixelFormatASTC_8x5_sRGB", - "ASTC_8x6_UNORM_BLOCK": "MTLPixelFormatASTC_8x6_LDR", "ASTC_8x6_SRGB_BLOCK": "MTLPixelFormatASTC_8x6_sRGB", - "ASTC_8x8_UNORM_BLOCK": "MTLPixelFormatASTC_8x8_LDR", "ASTC_8x8_SRGB_BLOCK": "MTLPixelFormatASTC_8x8_sRGB", - "ASTC_10x5_UNORM_BLOCK": "MTLPixelFormatASTC_10x5_LDR", "ASTC_10x5_SRGB_BLOCK": "MTLPixelFormatASTC_10x5_sRGB", - "ASTC_10x6_UNORM_BLOCK": "MTLPixelFormatASTC_10x6_LDR", "ASTC_10x6_SRGB_BLOCK": "MTLPixelFormatASTC_10x6_sRGB", - "ASTC_10x8_UNORM_BLOCK": "MTLPixelFormatASTC_10x8_LDR", "ASTC_10x8_SRGB_BLOCK": "MTLPixelFormatASTC_10x8_sRGB", - "ASTC_10x10_UNORM_BLOCK": "MTLPixelFormatASTC_10x10_LDR", "ASTC_10x10_SRGB_BLOCK": "MTLPixelFormatASTC_10x10_sRGB", - "ASTC_12x10_UNORM_BLOCK": "MTLPixelFormatASTC_12x10_LDR", "ASTC_12x10_SRGB_BLOCK": "MTLPixelFormatASTC_12x10_sRGB", - "ASTC_12x12_UNORM_BLOCK": "MTLPixelFormatASTC_12x12_LDR", "ASTC_12x12_SRGB_BLOCK": "MTLPixelFormatASTC_12x12_sRGB" }, + "map_astc_tpl": { + "ASTC_4x4_UNORM_BLOCK": "MTLPixelFormatASTC_4x4_", + "ASTC_5x4_UNORM_BLOCK": "MTLPixelFormatASTC_5x4_", + "ASTC_5x5_UNORM_BLOCK": "MTLPixelFormatASTC_5x5_", + "ASTC_6x5_UNORM_BLOCK": "MTLPixelFormatASTC_6x5_", + "ASTC_6x6_UNORM_BLOCK": "MTLPixelFormatASTC_6x6_", + "ASTC_8x5_UNORM_BLOCK": "MTLPixelFormatASTC_8x5_", + "ASTC_8x6_UNORM_BLOCK": "MTLPixelFormatASTC_8x6_", + "ASTC_8x8_UNORM_BLOCK": "MTLPixelFormatASTC_8x8_", + "ASTC_10x5_UNORM_BLOCK": "MTLPixelFormatASTC_10x5_", + "ASTC_10x6_UNORM_BLOCK": "MTLPixelFormatASTC_10x6_", + "ASTC_10x8_UNORM_BLOCK": "MTLPixelFormatASTC_10x8_", + "ASTC_10x10_UNORM_BLOCK": "MTLPixelFormatASTC_10x10_", + "ASTC_12x10_UNORM_BLOCK": "MTLPixelFormatASTC_12x10_", + "ASTC_12x12_UNORM_BLOCK": "MTLPixelFormatASTC_12x12_" + }, "map_mac": { "D16_UNORM": "MTLPixelFormatDepth16Unorm", "D24_UNORM_S8_UINT": "MTLPixelFormatDepth24Unorm_Stencil8", diff --git a/src/libANGLE/renderer/metal/mtl_format_table_autogen.mm b/src/libANGLE/renderer/metal/mtl_format_table_autogen.mm index 8656f307f..db350ccac 100644 --- a/src/libANGLE/renderer/metal/mtl_format_table_autogen.mm +++ b/src/libANGLE/renderer/metal/mtl_format_table_autogen.mm @@ -165,60 +165,32 @@ angle::FormatID Format::MetalToAngleFormatID(MTLPixelFormat formatMtl) #if TARGET_OS_IOS || TARGET_OS_TV || (TARGET_OS_OSX && (__MAC_OS_X_VERSION_MAX_ALLOWED >= 101600)) case MTLPixelFormatASTC_10x10_sRGB: return angle::FormatID::ASTC_10x10_SRGB_BLOCK; - case MTLPixelFormatASTC_10x10_LDR: - return angle::FormatID::ASTC_10x10_UNORM_BLOCK; case MTLPixelFormatASTC_10x5_sRGB: return angle::FormatID::ASTC_10x5_SRGB_BLOCK; - case MTLPixelFormatASTC_10x5_LDR: - return angle::FormatID::ASTC_10x5_UNORM_BLOCK; case MTLPixelFormatASTC_10x6_sRGB: return angle::FormatID::ASTC_10x6_SRGB_BLOCK; - case MTLPixelFormatASTC_10x6_LDR: - return angle::FormatID::ASTC_10x6_UNORM_BLOCK; case MTLPixelFormatASTC_10x8_sRGB: return angle::FormatID::ASTC_10x8_SRGB_BLOCK; - case MTLPixelFormatASTC_10x8_LDR: - return angle::FormatID::ASTC_10x8_UNORM_BLOCK; case MTLPixelFormatASTC_12x10_sRGB: return angle::FormatID::ASTC_12x10_SRGB_BLOCK; - case MTLPixelFormatASTC_12x10_LDR: - return angle::FormatID::ASTC_12x10_UNORM_BLOCK; case MTLPixelFormatASTC_12x12_sRGB: return angle::FormatID::ASTC_12x12_SRGB_BLOCK; - case MTLPixelFormatASTC_12x12_LDR: - return angle::FormatID::ASTC_12x12_UNORM_BLOCK; case MTLPixelFormatASTC_4x4_sRGB: return angle::FormatID::ASTC_4x4_SRGB_BLOCK; - case MTLPixelFormatASTC_4x4_LDR: - return angle::FormatID::ASTC_4x4_UNORM_BLOCK; case MTLPixelFormatASTC_5x4_sRGB: return angle::FormatID::ASTC_5x4_SRGB_BLOCK; - case MTLPixelFormatASTC_5x4_LDR: - return angle::FormatID::ASTC_5x4_UNORM_BLOCK; case MTLPixelFormatASTC_5x5_sRGB: return angle::FormatID::ASTC_5x5_SRGB_BLOCK; - case MTLPixelFormatASTC_5x5_LDR: - return angle::FormatID::ASTC_5x5_UNORM_BLOCK; case MTLPixelFormatASTC_6x5_sRGB: return angle::FormatID::ASTC_6x5_SRGB_BLOCK; - case MTLPixelFormatASTC_6x5_LDR: - return angle::FormatID::ASTC_6x5_UNORM_BLOCK; case MTLPixelFormatASTC_6x6_sRGB: return angle::FormatID::ASTC_6x6_SRGB_BLOCK; - case MTLPixelFormatASTC_6x6_LDR: - return angle::FormatID::ASTC_6x6_UNORM_BLOCK; case MTLPixelFormatASTC_8x5_sRGB: return angle::FormatID::ASTC_8x5_SRGB_BLOCK; - case MTLPixelFormatASTC_8x5_LDR: - return angle::FormatID::ASTC_8x5_UNORM_BLOCK; case MTLPixelFormatASTC_8x6_sRGB: return angle::FormatID::ASTC_8x6_SRGB_BLOCK; - case MTLPixelFormatASTC_8x6_LDR: - return angle::FormatID::ASTC_8x6_UNORM_BLOCK; case MTLPixelFormatASTC_8x8_sRGB: return angle::FormatID::ASTC_8x8_SRGB_BLOCK; - case MTLPixelFormatASTC_8x8_LDR: - return angle::FormatID::ASTC_8x8_UNORM_BLOCK; case MTLPixelFormatEAC_RG11Snorm: return angle::FormatID::EAC_R11G11_SNORM_BLOCK; case MTLPixelFormatEAC_RG11Unorm: @@ -261,6 +233,62 @@ angle::FormatID Format::MetalToAngleFormatID(MTLPixelFormat formatMtl) return angle::FormatID::R5G5B5A1_UNORM; case MTLPixelFormatB5G6R5Unorm: return angle::FormatID::R5G6B5_UNORM; + case MTLPixelFormatASTC_10x10_LDR: + return angle::FormatID::ASTC_10x10_UNORM_BLOCK; + case MTLPixelFormatASTC_10x10_HDR: + return angle::FormatID::ASTC_10x10_UNORM_BLOCK; + case MTLPixelFormatASTC_10x5_LDR: + return angle::FormatID::ASTC_10x5_UNORM_BLOCK; + case MTLPixelFormatASTC_10x5_HDR: + return angle::FormatID::ASTC_10x5_UNORM_BLOCK; + case MTLPixelFormatASTC_10x6_LDR: + return angle::FormatID::ASTC_10x6_UNORM_BLOCK; + case MTLPixelFormatASTC_10x6_HDR: + return angle::FormatID::ASTC_10x6_UNORM_BLOCK; + case MTLPixelFormatASTC_10x8_LDR: + return angle::FormatID::ASTC_10x8_UNORM_BLOCK; + case MTLPixelFormatASTC_10x8_HDR: + return angle::FormatID::ASTC_10x8_UNORM_BLOCK; + case MTLPixelFormatASTC_12x10_LDR: + return angle::FormatID::ASTC_12x10_UNORM_BLOCK; + case MTLPixelFormatASTC_12x10_HDR: + return angle::FormatID::ASTC_12x10_UNORM_BLOCK; + case MTLPixelFormatASTC_12x12_LDR: + return angle::FormatID::ASTC_12x12_UNORM_BLOCK; + case MTLPixelFormatASTC_12x12_HDR: + return angle::FormatID::ASTC_12x12_UNORM_BLOCK; + case MTLPixelFormatASTC_4x4_LDR: + return angle::FormatID::ASTC_4x4_UNORM_BLOCK; + case MTLPixelFormatASTC_4x4_HDR: + return angle::FormatID::ASTC_4x4_UNORM_BLOCK; + case MTLPixelFormatASTC_5x4_LDR: + return angle::FormatID::ASTC_5x4_UNORM_BLOCK; + case MTLPixelFormatASTC_5x4_HDR: + return angle::FormatID::ASTC_5x4_UNORM_BLOCK; + case MTLPixelFormatASTC_5x5_LDR: + return angle::FormatID::ASTC_5x5_UNORM_BLOCK; + case MTLPixelFormatASTC_5x5_HDR: + return angle::FormatID::ASTC_5x5_UNORM_BLOCK; + case MTLPixelFormatASTC_6x5_LDR: + return angle::FormatID::ASTC_6x5_UNORM_BLOCK; + case MTLPixelFormatASTC_6x5_HDR: + return angle::FormatID::ASTC_6x5_UNORM_BLOCK; + case MTLPixelFormatASTC_6x6_LDR: + return angle::FormatID::ASTC_6x6_UNORM_BLOCK; + case MTLPixelFormatASTC_6x6_HDR: + return angle::FormatID::ASTC_6x6_UNORM_BLOCK; + case MTLPixelFormatASTC_8x5_LDR: + return angle::FormatID::ASTC_8x5_UNORM_BLOCK; + case MTLPixelFormatASTC_8x5_HDR: + return angle::FormatID::ASTC_8x5_UNORM_BLOCK; + case MTLPixelFormatASTC_8x6_LDR: + return angle::FormatID::ASTC_8x6_UNORM_BLOCK; + case MTLPixelFormatASTC_8x6_HDR: + return angle::FormatID::ASTC_8x6_UNORM_BLOCK; + case MTLPixelFormatASTC_8x8_LDR: + return angle::FormatID::ASTC_8x8_UNORM_BLOCK; + case MTLPixelFormatASTC_8x8_HDR: + return angle::FormatID::ASTC_8x8_UNORM_BLOCK; #endif // TARGET_OS_IOS || TARGET_OS_TV || mac 11.0+ default: return angle::FormatID::NONE; @@ -1272,15 +1300,6 @@ void Format::init(const DisplayMtl *display, angle::FormatID intendedFormatId_) this->swizzled = false; break; - case angle::FormatID::ASTC_10x10_UNORM_BLOCK: - - this->metalFormat = MTLPixelFormatASTC_10x10_LDR; - this->actualFormatId = angle::FormatID::ASTC_10x10_UNORM_BLOCK; - this->initFunction = nullptr; - - this->swizzled = false; - break; - case angle::FormatID::ASTC_10x5_SRGB_BLOCK: this->metalFormat = MTLPixelFormatASTC_10x5_sRGB; @@ -1290,15 +1309,6 @@ void Format::init(const DisplayMtl *display, angle::FormatID intendedFormatId_) this->swizzled = false; break; - case angle::FormatID::ASTC_10x5_UNORM_BLOCK: - - this->metalFormat = MTLPixelFormatASTC_10x5_LDR; - this->actualFormatId = angle::FormatID::ASTC_10x5_UNORM_BLOCK; - this->initFunction = nullptr; - - this->swizzled = false; - break; - case angle::FormatID::ASTC_10x6_SRGB_BLOCK: this->metalFormat = MTLPixelFormatASTC_10x6_sRGB; @@ -1308,15 +1318,6 @@ void Format::init(const DisplayMtl *display, angle::FormatID intendedFormatId_) this->swizzled = false; break; - case angle::FormatID::ASTC_10x6_UNORM_BLOCK: - - this->metalFormat = MTLPixelFormatASTC_10x6_LDR; - this->actualFormatId = angle::FormatID::ASTC_10x6_UNORM_BLOCK; - this->initFunction = nullptr; - - this->swizzled = false; - break; - case angle::FormatID::ASTC_10x8_SRGB_BLOCK: this->metalFormat = MTLPixelFormatASTC_10x8_sRGB; @@ -1326,15 +1327,6 @@ void Format::init(const DisplayMtl *display, angle::FormatID intendedFormatId_) this->swizzled = false; break; - case angle::FormatID::ASTC_10x8_UNORM_BLOCK: - - this->metalFormat = MTLPixelFormatASTC_10x8_LDR; - this->actualFormatId = angle::FormatID::ASTC_10x8_UNORM_BLOCK; - this->initFunction = nullptr; - - this->swizzled = false; - break; - case angle::FormatID::ASTC_12x10_SRGB_BLOCK: this->metalFormat = MTLPixelFormatASTC_12x10_sRGB; @@ -1344,15 +1336,6 @@ void Format::init(const DisplayMtl *display, angle::FormatID intendedFormatId_) this->swizzled = false; break; - case angle::FormatID::ASTC_12x10_UNORM_BLOCK: - - this->metalFormat = MTLPixelFormatASTC_12x10_LDR; - this->actualFormatId = angle::FormatID::ASTC_12x10_UNORM_BLOCK; - this->initFunction = nullptr; - - this->swizzled = false; - break; - case angle::FormatID::ASTC_12x12_SRGB_BLOCK: this->metalFormat = MTLPixelFormatASTC_12x12_sRGB; @@ -1362,15 +1345,6 @@ void Format::init(const DisplayMtl *display, angle::FormatID intendedFormatId_) this->swizzled = false; break; - case angle::FormatID::ASTC_12x12_UNORM_BLOCK: - - this->metalFormat = MTLPixelFormatASTC_12x12_LDR; - this->actualFormatId = angle::FormatID::ASTC_12x12_UNORM_BLOCK; - this->initFunction = nullptr; - - this->swizzled = false; - break; - case angle::FormatID::ASTC_4x4_SRGB_BLOCK: this->metalFormat = MTLPixelFormatASTC_4x4_sRGB; @@ -1380,15 +1354,6 @@ void Format::init(const DisplayMtl *display, angle::FormatID intendedFormatId_) this->swizzled = false; break; - case angle::FormatID::ASTC_4x4_UNORM_BLOCK: - - this->metalFormat = MTLPixelFormatASTC_4x4_LDR; - this->actualFormatId = angle::FormatID::ASTC_4x4_UNORM_BLOCK; - this->initFunction = nullptr; - - this->swizzled = false; - break; - case angle::FormatID::ASTC_5x4_SRGB_BLOCK: this->metalFormat = MTLPixelFormatASTC_5x4_sRGB; @@ -1398,15 +1363,6 @@ void Format::init(const DisplayMtl *display, angle::FormatID intendedFormatId_) this->swizzled = false; break; - case angle::FormatID::ASTC_5x4_UNORM_BLOCK: - - this->metalFormat = MTLPixelFormatASTC_5x4_LDR; - this->actualFormatId = angle::FormatID::ASTC_5x4_UNORM_BLOCK; - this->initFunction = nullptr; - - this->swizzled = false; - break; - case angle::FormatID::ASTC_5x5_SRGB_BLOCK: this->metalFormat = MTLPixelFormatASTC_5x5_sRGB; @@ -1416,15 +1372,6 @@ void Format::init(const DisplayMtl *display, angle::FormatID intendedFormatId_) this->swizzled = false; break; - case angle::FormatID::ASTC_5x5_UNORM_BLOCK: - - this->metalFormat = MTLPixelFormatASTC_5x5_LDR; - this->actualFormatId = angle::FormatID::ASTC_5x5_UNORM_BLOCK; - this->initFunction = nullptr; - - this->swizzled = false; - break; - case angle::FormatID::ASTC_6x5_SRGB_BLOCK: this->metalFormat = MTLPixelFormatASTC_6x5_sRGB; @@ -1434,15 +1381,6 @@ void Format::init(const DisplayMtl *display, angle::FormatID intendedFormatId_) this->swizzled = false; break; - case angle::FormatID::ASTC_6x5_UNORM_BLOCK: - - this->metalFormat = MTLPixelFormatASTC_6x5_LDR; - this->actualFormatId = angle::FormatID::ASTC_6x5_UNORM_BLOCK; - this->initFunction = nullptr; - - this->swizzled = false; - break; - case angle::FormatID::ASTC_6x6_SRGB_BLOCK: this->metalFormat = MTLPixelFormatASTC_6x6_sRGB; @@ -1452,15 +1390,6 @@ void Format::init(const DisplayMtl *display, angle::FormatID intendedFormatId_) this->swizzled = false; break; - case angle::FormatID::ASTC_6x6_UNORM_BLOCK: - - this->metalFormat = MTLPixelFormatASTC_6x6_LDR; - this->actualFormatId = angle::FormatID::ASTC_6x6_UNORM_BLOCK; - this->initFunction = nullptr; - - this->swizzled = false; - break; - case angle::FormatID::ASTC_8x5_SRGB_BLOCK: this->metalFormat = MTLPixelFormatASTC_8x5_sRGB; @@ -1470,15 +1399,6 @@ void Format::init(const DisplayMtl *display, angle::FormatID intendedFormatId_) this->swizzled = false; break; - case angle::FormatID::ASTC_8x5_UNORM_BLOCK: - - this->metalFormat = MTLPixelFormatASTC_8x5_LDR; - this->actualFormatId = angle::FormatID::ASTC_8x5_UNORM_BLOCK; - this->initFunction = nullptr; - - this->swizzled = false; - break; - case angle::FormatID::ASTC_8x6_SRGB_BLOCK: this->metalFormat = MTLPixelFormatASTC_8x6_sRGB; @@ -1488,15 +1408,6 @@ void Format::init(const DisplayMtl *display, angle::FormatID intendedFormatId_) this->swizzled = false; break; - case angle::FormatID::ASTC_8x6_UNORM_BLOCK: - - this->metalFormat = MTLPixelFormatASTC_8x6_LDR; - this->actualFormatId = angle::FormatID::ASTC_8x6_UNORM_BLOCK; - this->initFunction = nullptr; - - this->swizzled = false; - break; - case angle::FormatID::ASTC_8x8_SRGB_BLOCK: this->metalFormat = MTLPixelFormatASTC_8x8_sRGB; @@ -1506,15 +1417,6 @@ void Format::init(const DisplayMtl *display, angle::FormatID intendedFormatId_) this->swizzled = false; break; - case angle::FormatID::ASTC_8x8_UNORM_BLOCK: - - this->metalFormat = MTLPixelFormatASTC_8x8_LDR; - this->actualFormatId = angle::FormatID::ASTC_8x8_UNORM_BLOCK; - this->initFunction = nullptr; - - this->swizzled = false; - break; - case angle::FormatID::EAC_R11G11_SNORM_BLOCK: this->metalFormat = MTLPixelFormatEAC_RG11Snorm; @@ -1731,6 +1633,258 @@ void Format::init(const DisplayMtl *display, angle::FormatID intendedFormatId_) this->swizzled = false; break; + case angle::FormatID::ASTC_10x10_UNORM_BLOCK: + + if (display->supportsAppleGPUFamily(6)) + { + this->metalFormat = MTLPixelFormatASTC_10x10_HDR; + this->actualFormatId = angle::FormatID::ASTC_10x10_UNORM_BLOCK; + this->initFunction = nullptr; + } + else + { + this->metalFormat = MTLPixelFormatASTC_10x10_LDR; + this->actualFormatId = angle::FormatID::ASTC_10x10_UNORM_BLOCK; + this->initFunction = nullptr; + } + + this->swizzled = false; + break; + + case angle::FormatID::ASTC_10x5_UNORM_BLOCK: + + if (display->supportsAppleGPUFamily(6)) + { + this->metalFormat = MTLPixelFormatASTC_10x5_HDR; + this->actualFormatId = angle::FormatID::ASTC_10x5_UNORM_BLOCK; + this->initFunction = nullptr; + } + else + { + this->metalFormat = MTLPixelFormatASTC_10x5_LDR; + this->actualFormatId = angle::FormatID::ASTC_10x5_UNORM_BLOCK; + this->initFunction = nullptr; + } + + this->swizzled = false; + break; + + case angle::FormatID::ASTC_10x6_UNORM_BLOCK: + + if (display->supportsAppleGPUFamily(6)) + { + this->metalFormat = MTLPixelFormatASTC_10x6_HDR; + this->actualFormatId = angle::FormatID::ASTC_10x6_UNORM_BLOCK; + this->initFunction = nullptr; + } + else + { + this->metalFormat = MTLPixelFormatASTC_10x6_LDR; + this->actualFormatId = angle::FormatID::ASTC_10x6_UNORM_BLOCK; + this->initFunction = nullptr; + } + + this->swizzled = false; + break; + + case angle::FormatID::ASTC_10x8_UNORM_BLOCK: + + if (display->supportsAppleGPUFamily(6)) + { + this->metalFormat = MTLPixelFormatASTC_10x8_HDR; + this->actualFormatId = angle::FormatID::ASTC_10x8_UNORM_BLOCK; + this->initFunction = nullptr; + } + else + { + this->metalFormat = MTLPixelFormatASTC_10x8_LDR; + this->actualFormatId = angle::FormatID::ASTC_10x8_UNORM_BLOCK; + this->initFunction = nullptr; + } + + this->swizzled = false; + break; + + case angle::FormatID::ASTC_12x10_UNORM_BLOCK: + + if (display->supportsAppleGPUFamily(6)) + { + this->metalFormat = MTLPixelFormatASTC_12x10_HDR; + this->actualFormatId = angle::FormatID::ASTC_12x10_UNORM_BLOCK; + this->initFunction = nullptr; + } + else + { + this->metalFormat = MTLPixelFormatASTC_12x10_LDR; + this->actualFormatId = angle::FormatID::ASTC_12x10_UNORM_BLOCK; + this->initFunction = nullptr; + } + + this->swizzled = false; + break; + + case angle::FormatID::ASTC_12x12_UNORM_BLOCK: + + if (display->supportsAppleGPUFamily(6)) + { + this->metalFormat = MTLPixelFormatASTC_12x12_HDR; + this->actualFormatId = angle::FormatID::ASTC_12x12_UNORM_BLOCK; + this->initFunction = nullptr; + } + else + { + this->metalFormat = MTLPixelFormatASTC_12x12_LDR; + this->actualFormatId = angle::FormatID::ASTC_12x12_UNORM_BLOCK; + this->initFunction = nullptr; + } + + this->swizzled = false; + break; + + case angle::FormatID::ASTC_4x4_UNORM_BLOCK: + + if (display->supportsAppleGPUFamily(6)) + { + this->metalFormat = MTLPixelFormatASTC_4x4_HDR; + this->actualFormatId = angle::FormatID::ASTC_4x4_UNORM_BLOCK; + this->initFunction = nullptr; + } + else + { + this->metalFormat = MTLPixelFormatASTC_4x4_LDR; + this->actualFormatId = angle::FormatID::ASTC_4x4_UNORM_BLOCK; + this->initFunction = nullptr; + } + + this->swizzled = false; + break; + + case angle::FormatID::ASTC_5x4_UNORM_BLOCK: + + if (display->supportsAppleGPUFamily(6)) + { + this->metalFormat = MTLPixelFormatASTC_5x4_HDR; + this->actualFormatId = angle::FormatID::ASTC_5x4_UNORM_BLOCK; + this->initFunction = nullptr; + } + else + { + this->metalFormat = MTLPixelFormatASTC_5x4_LDR; + this->actualFormatId = angle::FormatID::ASTC_5x4_UNORM_BLOCK; + this->initFunction = nullptr; + } + + this->swizzled = false; + break; + + case angle::FormatID::ASTC_5x5_UNORM_BLOCK: + + if (display->supportsAppleGPUFamily(6)) + { + this->metalFormat = MTLPixelFormatASTC_5x5_HDR; + this->actualFormatId = angle::FormatID::ASTC_5x5_UNORM_BLOCK; + this->initFunction = nullptr; + } + else + { + this->metalFormat = MTLPixelFormatASTC_5x5_LDR; + this->actualFormatId = angle::FormatID::ASTC_5x5_UNORM_BLOCK; + this->initFunction = nullptr; + } + + this->swizzled = false; + break; + + case angle::FormatID::ASTC_6x5_UNORM_BLOCK: + + if (display->supportsAppleGPUFamily(6)) + { + this->metalFormat = MTLPixelFormatASTC_6x5_HDR; + this->actualFormatId = angle::FormatID::ASTC_6x5_UNORM_BLOCK; + this->initFunction = nullptr; + } + else + { + this->metalFormat = MTLPixelFormatASTC_6x5_LDR; + this->actualFormatId = angle::FormatID::ASTC_6x5_UNORM_BLOCK; + this->initFunction = nullptr; + } + + this->swizzled = false; + break; + + case angle::FormatID::ASTC_6x6_UNORM_BLOCK: + + if (display->supportsAppleGPUFamily(6)) + { + this->metalFormat = MTLPixelFormatASTC_6x6_HDR; + this->actualFormatId = angle::FormatID::ASTC_6x6_UNORM_BLOCK; + this->initFunction = nullptr; + } + else + { + this->metalFormat = MTLPixelFormatASTC_6x6_LDR; + this->actualFormatId = angle::FormatID::ASTC_6x6_UNORM_BLOCK; + this->initFunction = nullptr; + } + + this->swizzled = false; + break; + + case angle::FormatID::ASTC_8x5_UNORM_BLOCK: + + if (display->supportsAppleGPUFamily(6)) + { + this->metalFormat = MTLPixelFormatASTC_8x5_HDR; + this->actualFormatId = angle::FormatID::ASTC_8x5_UNORM_BLOCK; + this->initFunction = nullptr; + } + else + { + this->metalFormat = MTLPixelFormatASTC_8x5_LDR; + this->actualFormatId = angle::FormatID::ASTC_8x5_UNORM_BLOCK; + this->initFunction = nullptr; + } + + this->swizzled = false; + break; + + case angle::FormatID::ASTC_8x6_UNORM_BLOCK: + + if (display->supportsAppleGPUFamily(6)) + { + this->metalFormat = MTLPixelFormatASTC_8x6_HDR; + this->actualFormatId = angle::FormatID::ASTC_8x6_UNORM_BLOCK; + this->initFunction = nullptr; + } + else + { + this->metalFormat = MTLPixelFormatASTC_8x6_LDR; + this->actualFormatId = angle::FormatID::ASTC_8x6_UNORM_BLOCK; + this->initFunction = nullptr; + } + + this->swizzled = false; + break; + + case angle::FormatID::ASTC_8x8_UNORM_BLOCK: + + if (display->supportsAppleGPUFamily(6)) + { + this->metalFormat = MTLPixelFormatASTC_8x8_HDR; + this->actualFormatId = angle::FormatID::ASTC_8x8_UNORM_BLOCK; + this->initFunction = nullptr; + } + else + { + this->metalFormat = MTLPixelFormatASTC_8x8_LDR; + this->actualFormatId = angle::FormatID::ASTC_8x8_UNORM_BLOCK; + this->initFunction = nullptr; + } + + this->swizzled = false; + break; + #endif #if (TARGET_OS_OSX && (__MAC_OS_X_VERSION_MAX_ALLOWED >= 101600)) case angle::FormatID::ASTC_10x10_SRGB_BLOCK: @@ -1742,15 +1896,6 @@ void Format::init(const DisplayMtl *display, angle::FormatID intendedFormatId_) this->swizzled = false; break; - case angle::FormatID::ASTC_10x10_UNORM_BLOCK: - - this->metalFormat = MTLPixelFormatASTC_10x10_LDR; - this->actualFormatId = angle::FormatID::ASTC_10x10_UNORM_BLOCK; - this->initFunction = nullptr; - - this->swizzled = false; - break; - case angle::FormatID::ASTC_10x5_SRGB_BLOCK: this->metalFormat = MTLPixelFormatASTC_10x5_sRGB; @@ -1760,15 +1905,6 @@ void Format::init(const DisplayMtl *display, angle::FormatID intendedFormatId_) this->swizzled = false; break; - case angle::FormatID::ASTC_10x5_UNORM_BLOCK: - - this->metalFormat = MTLPixelFormatASTC_10x5_LDR; - this->actualFormatId = angle::FormatID::ASTC_10x5_UNORM_BLOCK; - this->initFunction = nullptr; - - this->swizzled = false; - break; - case angle::FormatID::ASTC_10x6_SRGB_BLOCK: this->metalFormat = MTLPixelFormatASTC_10x6_sRGB; @@ -1778,15 +1914,6 @@ void Format::init(const DisplayMtl *display, angle::FormatID intendedFormatId_) this->swizzled = false; break; - case angle::FormatID::ASTC_10x6_UNORM_BLOCK: - - this->metalFormat = MTLPixelFormatASTC_10x6_LDR; - this->actualFormatId = angle::FormatID::ASTC_10x6_UNORM_BLOCK; - this->initFunction = nullptr; - - this->swizzled = false; - break; - case angle::FormatID::ASTC_10x8_SRGB_BLOCK: this->metalFormat = MTLPixelFormatASTC_10x8_sRGB; @@ -1796,15 +1923,6 @@ void Format::init(const DisplayMtl *display, angle::FormatID intendedFormatId_) this->swizzled = false; break; - case angle::FormatID::ASTC_10x8_UNORM_BLOCK: - - this->metalFormat = MTLPixelFormatASTC_10x8_LDR; - this->actualFormatId = angle::FormatID::ASTC_10x8_UNORM_BLOCK; - this->initFunction = nullptr; - - this->swizzled = false; - break; - case angle::FormatID::ASTC_12x10_SRGB_BLOCK: this->metalFormat = MTLPixelFormatASTC_12x10_sRGB; @@ -1814,15 +1932,6 @@ void Format::init(const DisplayMtl *display, angle::FormatID intendedFormatId_) this->swizzled = false; break; - case angle::FormatID::ASTC_12x10_UNORM_BLOCK: - - this->metalFormat = MTLPixelFormatASTC_12x10_LDR; - this->actualFormatId = angle::FormatID::ASTC_12x10_UNORM_BLOCK; - this->initFunction = nullptr; - - this->swizzled = false; - break; - case angle::FormatID::ASTC_12x12_SRGB_BLOCK: this->metalFormat = MTLPixelFormatASTC_12x12_sRGB; @@ -1832,15 +1941,6 @@ void Format::init(const DisplayMtl *display, angle::FormatID intendedFormatId_) this->swizzled = false; break; - case angle::FormatID::ASTC_12x12_UNORM_BLOCK: - - this->metalFormat = MTLPixelFormatASTC_12x12_LDR; - this->actualFormatId = angle::FormatID::ASTC_12x12_UNORM_BLOCK; - this->initFunction = nullptr; - - this->swizzled = false; - break; - case angle::FormatID::ASTC_4x4_SRGB_BLOCK: this->metalFormat = MTLPixelFormatASTC_4x4_sRGB; @@ -1850,15 +1950,6 @@ void Format::init(const DisplayMtl *display, angle::FormatID intendedFormatId_) this->swizzled = false; break; - case angle::FormatID::ASTC_4x4_UNORM_BLOCK: - - this->metalFormat = MTLPixelFormatASTC_4x4_LDR; - this->actualFormatId = angle::FormatID::ASTC_4x4_UNORM_BLOCK; - this->initFunction = nullptr; - - this->swizzled = false; - break; - case angle::FormatID::ASTC_5x4_SRGB_BLOCK: this->metalFormat = MTLPixelFormatASTC_5x4_sRGB; @@ -1868,15 +1959,6 @@ void Format::init(const DisplayMtl *display, angle::FormatID intendedFormatId_) this->swizzled = false; break; - case angle::FormatID::ASTC_5x4_UNORM_BLOCK: - - this->metalFormat = MTLPixelFormatASTC_5x4_LDR; - this->actualFormatId = angle::FormatID::ASTC_5x4_UNORM_BLOCK; - this->initFunction = nullptr; - - this->swizzled = false; - break; - case angle::FormatID::ASTC_5x5_SRGB_BLOCK: this->metalFormat = MTLPixelFormatASTC_5x5_sRGB; @@ -1886,15 +1968,6 @@ void Format::init(const DisplayMtl *display, angle::FormatID intendedFormatId_) this->swizzled = false; break; - case angle::FormatID::ASTC_5x5_UNORM_BLOCK: - - this->metalFormat = MTLPixelFormatASTC_5x5_LDR; - this->actualFormatId = angle::FormatID::ASTC_5x5_UNORM_BLOCK; - this->initFunction = nullptr; - - this->swizzled = false; - break; - case angle::FormatID::ASTC_6x5_SRGB_BLOCK: this->metalFormat = MTLPixelFormatASTC_6x5_sRGB; @@ -1904,15 +1977,6 @@ void Format::init(const DisplayMtl *display, angle::FormatID intendedFormatId_) this->swizzled = false; break; - case angle::FormatID::ASTC_6x5_UNORM_BLOCK: - - this->metalFormat = MTLPixelFormatASTC_6x5_LDR; - this->actualFormatId = angle::FormatID::ASTC_6x5_UNORM_BLOCK; - this->initFunction = nullptr; - - this->swizzled = false; - break; - case angle::FormatID::ASTC_6x6_SRGB_BLOCK: this->metalFormat = MTLPixelFormatASTC_6x6_sRGB; @@ -1922,15 +1986,6 @@ void Format::init(const DisplayMtl *display, angle::FormatID intendedFormatId_) this->swizzled = false; break; - case angle::FormatID::ASTC_6x6_UNORM_BLOCK: - - this->metalFormat = MTLPixelFormatASTC_6x6_LDR; - this->actualFormatId = angle::FormatID::ASTC_6x6_UNORM_BLOCK; - this->initFunction = nullptr; - - this->swizzled = false; - break; - case angle::FormatID::ASTC_8x5_SRGB_BLOCK: this->metalFormat = MTLPixelFormatASTC_8x5_sRGB; @@ -1940,15 +1995,6 @@ void Format::init(const DisplayMtl *display, angle::FormatID intendedFormatId_) this->swizzled = false; break; - case angle::FormatID::ASTC_8x5_UNORM_BLOCK: - - this->metalFormat = MTLPixelFormatASTC_8x5_LDR; - this->actualFormatId = angle::FormatID::ASTC_8x5_UNORM_BLOCK; - this->initFunction = nullptr; - - this->swizzled = false; - break; - case angle::FormatID::ASTC_8x6_SRGB_BLOCK: this->metalFormat = MTLPixelFormatASTC_8x6_sRGB; @@ -1958,15 +2004,6 @@ void Format::init(const DisplayMtl *display, angle::FormatID intendedFormatId_) this->swizzled = false; break; - case angle::FormatID::ASTC_8x6_UNORM_BLOCK: - - this->metalFormat = MTLPixelFormatASTC_8x6_LDR; - this->actualFormatId = angle::FormatID::ASTC_8x6_UNORM_BLOCK; - this->initFunction = nullptr; - - this->swizzled = false; - break; - case angle::FormatID::ASTC_8x8_SRGB_BLOCK: this->metalFormat = MTLPixelFormatASTC_8x8_sRGB; @@ -1976,15 +2013,6 @@ void Format::init(const DisplayMtl *display, angle::FormatID intendedFormatId_) this->swizzled = false; break; - case angle::FormatID::ASTC_8x8_UNORM_BLOCK: - - this->metalFormat = MTLPixelFormatASTC_8x8_LDR; - this->actualFormatId = angle::FormatID::ASTC_8x8_UNORM_BLOCK; - this->initFunction = nullptr; - - this->swizzled = false; - break; - case angle::FormatID::EAC_R11G11_SNORM_BLOCK: if (display->supportsAppleGPUFamily(1)) @@ -2309,6 +2337,258 @@ void Format::init(const DisplayMtl *display, angle::FormatID intendedFormatId_) this->swizzled = false; break; + case angle::FormatID::ASTC_10x10_UNORM_BLOCK: + + if (display->supportsAppleGPUFamily(6)) + { + this->metalFormat = MTLPixelFormatASTC_10x10_HDR; + this->actualFormatId = angle::FormatID::ASTC_10x10_UNORM_BLOCK; + this->initFunction = nullptr; + } + else + { + this->metalFormat = MTLPixelFormatASTC_10x10_LDR; + this->actualFormatId = angle::FormatID::ASTC_10x10_UNORM_BLOCK; + this->initFunction = nullptr; + } + + this->swizzled = false; + break; + + case angle::FormatID::ASTC_10x5_UNORM_BLOCK: + + if (display->supportsAppleGPUFamily(6)) + { + this->metalFormat = MTLPixelFormatASTC_10x5_HDR; + this->actualFormatId = angle::FormatID::ASTC_10x5_UNORM_BLOCK; + this->initFunction = nullptr; + } + else + { + this->metalFormat = MTLPixelFormatASTC_10x5_LDR; + this->actualFormatId = angle::FormatID::ASTC_10x5_UNORM_BLOCK; + this->initFunction = nullptr; + } + + this->swizzled = false; + break; + + case angle::FormatID::ASTC_10x6_UNORM_BLOCK: + + if (display->supportsAppleGPUFamily(6)) + { + this->metalFormat = MTLPixelFormatASTC_10x6_HDR; + this->actualFormatId = angle::FormatID::ASTC_10x6_UNORM_BLOCK; + this->initFunction = nullptr; + } + else + { + this->metalFormat = MTLPixelFormatASTC_10x6_LDR; + this->actualFormatId = angle::FormatID::ASTC_10x6_UNORM_BLOCK; + this->initFunction = nullptr; + } + + this->swizzled = false; + break; + + case angle::FormatID::ASTC_10x8_UNORM_BLOCK: + + if (display->supportsAppleGPUFamily(6)) + { + this->metalFormat = MTLPixelFormatASTC_10x8_HDR; + this->actualFormatId = angle::FormatID::ASTC_10x8_UNORM_BLOCK; + this->initFunction = nullptr; + } + else + { + this->metalFormat = MTLPixelFormatASTC_10x8_LDR; + this->actualFormatId = angle::FormatID::ASTC_10x8_UNORM_BLOCK; + this->initFunction = nullptr; + } + + this->swizzled = false; + break; + + case angle::FormatID::ASTC_12x10_UNORM_BLOCK: + + if (display->supportsAppleGPUFamily(6)) + { + this->metalFormat = MTLPixelFormatASTC_12x10_HDR; + this->actualFormatId = angle::FormatID::ASTC_12x10_UNORM_BLOCK; + this->initFunction = nullptr; + } + else + { + this->metalFormat = MTLPixelFormatASTC_12x10_LDR; + this->actualFormatId = angle::FormatID::ASTC_12x10_UNORM_BLOCK; + this->initFunction = nullptr; + } + + this->swizzled = false; + break; + + case angle::FormatID::ASTC_12x12_UNORM_BLOCK: + + if (display->supportsAppleGPUFamily(6)) + { + this->metalFormat = MTLPixelFormatASTC_12x12_HDR; + this->actualFormatId = angle::FormatID::ASTC_12x12_UNORM_BLOCK; + this->initFunction = nullptr; + } + else + { + this->metalFormat = MTLPixelFormatASTC_12x12_LDR; + this->actualFormatId = angle::FormatID::ASTC_12x12_UNORM_BLOCK; + this->initFunction = nullptr; + } + + this->swizzled = false; + break; + + case angle::FormatID::ASTC_4x4_UNORM_BLOCK: + + if (display->supportsAppleGPUFamily(6)) + { + this->metalFormat = MTLPixelFormatASTC_4x4_HDR; + this->actualFormatId = angle::FormatID::ASTC_4x4_UNORM_BLOCK; + this->initFunction = nullptr; + } + else + { + this->metalFormat = MTLPixelFormatASTC_4x4_LDR; + this->actualFormatId = angle::FormatID::ASTC_4x4_UNORM_BLOCK; + this->initFunction = nullptr; + } + + this->swizzled = false; + break; + + case angle::FormatID::ASTC_5x4_UNORM_BLOCK: + + if (display->supportsAppleGPUFamily(6)) + { + this->metalFormat = MTLPixelFormatASTC_5x4_HDR; + this->actualFormatId = angle::FormatID::ASTC_5x4_UNORM_BLOCK; + this->initFunction = nullptr; + } + else + { + this->metalFormat = MTLPixelFormatASTC_5x4_LDR; + this->actualFormatId = angle::FormatID::ASTC_5x4_UNORM_BLOCK; + this->initFunction = nullptr; + } + + this->swizzled = false; + break; + + case angle::FormatID::ASTC_5x5_UNORM_BLOCK: + + if (display->supportsAppleGPUFamily(6)) + { + this->metalFormat = MTLPixelFormatASTC_5x5_HDR; + this->actualFormatId = angle::FormatID::ASTC_5x5_UNORM_BLOCK; + this->initFunction = nullptr; + } + else + { + this->metalFormat = MTLPixelFormatASTC_5x5_LDR; + this->actualFormatId = angle::FormatID::ASTC_5x5_UNORM_BLOCK; + this->initFunction = nullptr; + } + + this->swizzled = false; + break; + + case angle::FormatID::ASTC_6x5_UNORM_BLOCK: + + if (display->supportsAppleGPUFamily(6)) + { + this->metalFormat = MTLPixelFormatASTC_6x5_HDR; + this->actualFormatId = angle::FormatID::ASTC_6x5_UNORM_BLOCK; + this->initFunction = nullptr; + } + else + { + this->metalFormat = MTLPixelFormatASTC_6x5_LDR; + this->actualFormatId = angle::FormatID::ASTC_6x5_UNORM_BLOCK; + this->initFunction = nullptr; + } + + this->swizzled = false; + break; + + case angle::FormatID::ASTC_6x6_UNORM_BLOCK: + + if (display->supportsAppleGPUFamily(6)) + { + this->metalFormat = MTLPixelFormatASTC_6x6_HDR; + this->actualFormatId = angle::FormatID::ASTC_6x6_UNORM_BLOCK; + this->initFunction = nullptr; + } + else + { + this->metalFormat = MTLPixelFormatASTC_6x6_LDR; + this->actualFormatId = angle::FormatID::ASTC_6x6_UNORM_BLOCK; + this->initFunction = nullptr; + } + + this->swizzled = false; + break; + + case angle::FormatID::ASTC_8x5_UNORM_BLOCK: + + if (display->supportsAppleGPUFamily(6)) + { + this->metalFormat = MTLPixelFormatASTC_8x5_HDR; + this->actualFormatId = angle::FormatID::ASTC_8x5_UNORM_BLOCK; + this->initFunction = nullptr; + } + else + { + this->metalFormat = MTLPixelFormatASTC_8x5_LDR; + this->actualFormatId = angle::FormatID::ASTC_8x5_UNORM_BLOCK; + this->initFunction = nullptr; + } + + this->swizzled = false; + break; + + case angle::FormatID::ASTC_8x6_UNORM_BLOCK: + + if (display->supportsAppleGPUFamily(6)) + { + this->metalFormat = MTLPixelFormatASTC_8x6_HDR; + this->actualFormatId = angle::FormatID::ASTC_8x6_UNORM_BLOCK; + this->initFunction = nullptr; + } + else + { + this->metalFormat = MTLPixelFormatASTC_8x6_LDR; + this->actualFormatId = angle::FormatID::ASTC_8x6_UNORM_BLOCK; + this->initFunction = nullptr; + } + + this->swizzled = false; + break; + + case angle::FormatID::ASTC_8x8_UNORM_BLOCK: + + if (display->supportsAppleGPUFamily(6)) + { + this->metalFormat = MTLPixelFormatASTC_8x8_HDR; + this->actualFormatId = angle::FormatID::ASTC_8x8_UNORM_BLOCK; + this->initFunction = nullptr; + } + else + { + this->metalFormat = MTLPixelFormatASTC_8x8_LDR; + this->actualFormatId = angle::FormatID::ASTC_8x8_UNORM_BLOCK; + this->initFunction = nullptr; + } + + this->swizzled = false; + break; + #endif default: this->metalFormat = MTLPixelFormatInvalid;