diff --git a/wgpu-hal/src/gles/adapter.rs b/wgpu-hal/src/gles/adapter.rs index bcac8bf318..87307ac27f 100644 --- a/wgpu-hal/src/gles/adapter.rs +++ b/wgpu-hal/src/gles/adapter.rs @@ -118,6 +118,7 @@ impl super::Adapter { "mali", "intel", "v3d", + "apple m1", ]; let strings_that_imply_cpu = ["mesa offscreen", "swiftshader", "llvmpipe"]; diff --git a/wgpu-hal/src/metal/adapter.rs b/wgpu-hal/src/metal/adapter.rs index 1a05240ccd..9ce28eef19 100644 --- a/wgpu-hal/src/metal/adapter.rs +++ b/wgpu-hal/src/metal/adapter.rs @@ -988,6 +988,21 @@ impl super::PrivateCapabilities { } else { Self::version_at_least(major, minor, 13, 0) }, + has_unified_memory: if (os_is_mac && Self::version_at_least(major, minor, 10, 15)) + || (!os_is_mac && Self::version_at_least(major, minor, 13, 0)) + { + Some(device.has_unified_memory()) + } else { + None + }, + } + } + + pub fn device_type(&self) -> wgt::DeviceType { + if self.has_unified_memory.unwrap_or(self.low_power) { + wgt::DeviceType::IntegratedGpu + } else { + wgt::DeviceType::DiscreteGpu } } diff --git a/wgpu-hal/src/metal/mod.rs b/wgpu-hal/src/metal/mod.rs index dd8fee1840..1dd3e252c2 100644 --- a/wgpu-hal/src/metal/mod.rs +++ b/wgpu-hal/src/metal/mod.rs @@ -114,11 +114,7 @@ impl crate::Instance for Instance { name, vendor: 0, device: 0, - device_type: if shared.private_caps.low_power { - wgt::DeviceType::IntegratedGpu - } else { - wgt::DeviceType::DiscreteGpu - }, + device_type: shared.private_caps.device_type(), backend: wgt::Backend::Metal, }, features: shared.private_caps.features(), @@ -230,6 +226,7 @@ struct PrivateCapabilities { supports_mutability: bool, supports_depth_clip_control: bool, supports_preserve_invariance: bool, + has_unified_memory: Option, } #[derive(Clone, Debug)]