mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-04-22 03:02:01 -04:00
Identify Apple M1 GPU as integrated (#2429)
* Identify Apple M1 GPU as integrated * metal: Call has_unified_memory conditional on OS version Fall back to current low_power implies integrated GPU for older OSes.
This commit is contained in:
@@ -118,6 +118,7 @@ impl super::Adapter {
|
||||
"mali",
|
||||
"intel",
|
||||
"v3d",
|
||||
"apple m1",
|
||||
];
|
||||
let strings_that_imply_cpu = ["mesa offscreen", "swiftshader", "llvmpipe"];
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -114,11 +114,7 @@ impl crate::Instance<Api> 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<bool>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
|
||||
Reference in New Issue
Block a user