From 3a83fecea9f383460464107b1d44069e02091bc6 Mon Sep 17 00:00:00 2001 From: Thorsten Ball Date: Thu, 18 Jul 2024 16:52:38 +0200 Subject: [PATCH] gpui: Prefer removable over integrated Metal devices (#14744) For context, see: - https://github.com/zed-industries/zed/issues/5124#issuecomment-2227743811 - https://github.com/zed-industries/zed/pull/14738#issuecomment-2236613976 Short version: on Intel MacBooks it's better to prefer integrated (`is_low_poer()`) GPUs, except when a user has an eGPU plugged-in, in which case they very likely want to prefer that. Before this change, we'd always prefer the integrated GPU, even if an eGPU was available. Now, with this change, if a user has - eGPU - integrated GPU - discrete GPU We'd first prefer eGPU, then integrated, then discrete. Release Notes: - Changed preference for GPUs on macOS so that eGPUs are now preferred over integrated ones (and both of which are preferred over discrete GPUs) on Intel Macs. --- crates/gpui/src/platform/mac/metal_renderer.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/gpui/src/platform/mac/metal_renderer.rs b/crates/gpui/src/platform/mac/metal_renderer.rs index 97d788412f..e5d3babe6c 100644 --- a/crates/gpui/src/platform/mac/metal_renderer.rs +++ b/crates/gpui/src/platform/mac/metal_renderer.rs @@ -113,7 +113,7 @@ impl MetalRenderer { // Silicon, there is only ever one GPU, so this is equivalent to // `metal::Device::system_default()`. let mut devices = metal::Device::all(); - devices.sort_by_key(|device| (!device.is_removable(), device.is_low_power())); + devices.sort_by_key(|device| (device.is_removable(), device.is_low_power())); let Some(device) = devices.pop() else { log::error!("unable to access a compatible graphics device"); std::process::exit(1);