Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

gpui: Prefer integrated GPUs on Intel Mac (#13685)

Emilyc1e18059f891
diff --git a/crates/gpui/src/platform/mac/metal_renderer.rs b/crates/gpui/src/platform/mac/metal_renderer.rs
index f6818fe3de0..97d788412fe 100644
--- a/crates/gpui/src/platform/mac/metal_renderer.rs
+++ b/crates/gpui/src/platform/mac/metal_renderer.rs
@@ -109,9 +109,12 @@ pub(crate) struct MetalRenderer {
impl MetalRenderer {
pub fn new(instance_buffer_pool: Arc<Mutex<InstanceBufferPool>>) -> Self {
- let device: metal::Device = if let Some(device) = metal::Device::system_default() {
- device
- } else {
+ // Prefer low‐power integrated GPUs on Intel Mac. On Apple
+ // 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()));
+ let Some(device) = devices.pop() else {
log::error!("unable to access a compatible graphics device");
std::process::exit(1);
};