зеркало из https://github.com/AvaloniaUI/angle.git
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 <jmadill@chromium.org> Reviewed-by: Le Hoang Quyen <le.hoang.q@gmail.com> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com>
This commit is contained in:
Родитель
3b2ef1cdbe
Коммит
53b89b833b
|
@ -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"
|
||||
}
|
|
@ -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;
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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",
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Загрузка…
Ссылка в новой задаче