From cefdbb902eaff41ae9ddea2f4df9b3b3fbd1584a Mon Sep 17 00:00:00 2001 From: Robert Swain Date: Thu, 3 Feb 2022 22:59:20 +0100 Subject: [PATCH 1/3] Metal: Correctly identify ASTC and EAC/ETC2 support --- wgpu-hal/src/metal/adapter.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/wgpu-hal/src/metal/adapter.rs b/wgpu-hal/src/metal/adapter.rs index 9ce28eef19..1f73350867 100644 --- a/wgpu-hal/src/metal/adapter.rs +++ b/wgpu-hal/src/metal/adapter.rs @@ -718,8 +718,12 @@ impl super::PrivateCapabilities { format_min_srgb_channels: if os_is_mac { 4 } else { 1 }, format_b5: !os_is_mac, format_bc: os_is_mac, - format_eac_etc: !os_is_mac, - format_astc: Self::supports_any(device, ASTC_PIXEL_FORMAT_FEATURES), + format_eac_etc: !os_is_mac + // M1 in macOS supports EAC/ETC2 + || device.supports_family(MTLGPUFamily::Apple7), + format_astc: Self::supports_any(device, ASTC_PIXEL_FORMAT_FEATURES) + // A14/M1 always support ASTC + || device.supports_family(MTLGPUFamily::Apple7), format_any8_unorm_srgb_all: Self::supports_any(device, ANY8_UNORM_SRGB_ALL), format_any8_unorm_srgb_no_write: !Self::supports_any(device, ANY8_UNORM_SRGB_ALL) && !os_is_mac, From bf0fbf829b0bc749ea9b2e3f007cc4d97ba4a76e Mon Sep 17 00:00:00 2001 From: Robert Swain Date: Thu, 3 Feb 2022 23:00:02 +0100 Subject: [PATCH 2/3] Metal: Correctly expose ASTC / BC / EAC/ETC2 compressed texture support --- wgpu-hal/src/metal/adapter.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/wgpu-hal/src/metal/adapter.rs b/wgpu-hal/src/metal/adapter.rs index 1f73350867..c8fdba2bfe 100644 --- a/wgpu-hal/src/metal/adapter.rs +++ b/wgpu-hal/src/metal/adapter.rs @@ -1014,7 +1014,6 @@ impl super::PrivateCapabilities { use wgt::Features as F; let mut features = F::empty() - | F::TEXTURE_COMPRESSION_BC | F::INDIRECT_FIRST_INSTANCE | F::MAPPABLE_PRIMARY_BUFFERS | F::VERTEX_WRITABLE_STORAGE @@ -1024,6 +1023,10 @@ impl super::PrivateCapabilities { | F::CLEAR_TEXTURE | F::TEXTURE_FORMAT_16BIT_NORM; + features.set(F::TEXTURE_COMPRESSION_ASTC_LDR, self.format_astc); + features.set(F::TEXTURE_COMPRESSION_BC, self.format_bc); + features.set(F::TEXTURE_COMPRESSION_ETC2, self.format_eac_etc); + features.set(F::DEPTH_CLIP_CONTROL, self.supports_depth_clip_control); features.set( From 974b5d37bcf46715eae95a17b401ce1727662c63 Mon Sep 17 00:00:00 2001 From: Robert Swain Date: Thu, 3 Feb 2022 23:52:07 +0100 Subject: [PATCH 3/3] Metal: Only call supports_family when supported, and use Apple6 for ASTC check --- wgpu-hal/src/metal/adapter.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/wgpu-hal/src/metal/adapter.rs b/wgpu-hal/src/metal/adapter.rs index c8fdba2bfe..7e4a0119b5 100644 --- a/wgpu-hal/src/metal/adapter.rs +++ b/wgpu-hal/src/metal/adapter.rs @@ -720,10 +720,10 @@ impl super::PrivateCapabilities { format_bc: os_is_mac, format_eac_etc: !os_is_mac // M1 in macOS supports EAC/ETC2 - || device.supports_family(MTLGPUFamily::Apple7), + || (family_check && device.supports_family(MTLGPUFamily::Apple7)), format_astc: Self::supports_any(device, ASTC_PIXEL_FORMAT_FEATURES) - // A14/M1 always support ASTC - || device.supports_family(MTLGPUFamily::Apple7), + // A13/A14/M1 and later always support ASTC + || (family_check && device.supports_family(MTLGPUFamily::Apple6)), format_any8_unorm_srgb_all: Self::supports_any(device, ANY8_UNORM_SRGB_ALL), format_any8_unorm_srgb_no_write: !Self::supports_any(device, ANY8_UNORM_SRGB_ALL) && !os_is_mac,