diff --git a/crates/gpui/src/platform.rs b/crates/gpui/src/platform.rs index 00bf278b40..61d78f7023 100644 --- a/crates/gpui/src/platform.rs +++ b/crates/gpui/src/platform.rs @@ -254,7 +254,7 @@ pub enum Decorations { /// A type to describe which GPU to prefer. #[derive(Debug, Copy, Clone, Eq, PartialEq, Hash, Default)] -pub enum GPU { +pub enum Gpu { /// The window is rendered using the integrated (lower-power) GPU #[default] Integrated, @@ -692,7 +692,7 @@ pub struct WindowOptions { /// Whether to prefer one GPU over another. macOS only /// Note that this may be ignored. - pub gpu: Option, + pub gpu: Option, } /// The variables that can be configured when creating a new window @@ -725,7 +725,7 @@ pub(crate) struct WindowParams { /// Whether to prefer one GPU over another. macOS only /// Note that this may be ignored. #[cfg_attr(target_os = "linux", allow(dead_code))] - pub gpu: Option, + pub gpu: Option, } /// Represents the status of how a window should be opened. diff --git a/crates/gpui/src/platform/blade/blade_renderer.rs b/crates/gpui/src/platform/blade/blade_renderer.rs index 821488abbe..bb3d020ec5 100644 --- a/crates/gpui/src/platform/blade/blade_renderer.rs +++ b/crates/gpui/src/platform/blade/blade_renderer.rs @@ -32,7 +32,7 @@ pub unsafe fn new_renderer( native_view: *mut c_void, bounds: crate::Size, transparent: bool, - _gpu: Option, + _gpu: Option, ) -> Renderer { use raw_window_handle as rwh; struct RawWindow { diff --git a/crates/gpui/src/platform/mac/metal_renderer.rs b/crates/gpui/src/platform/mac/metal_renderer.rs index 47404a4d5f..492f688d8b 100644 --- a/crates/gpui/src/platform/mac/metal_renderer.rs +++ b/crates/gpui/src/platform/mac/metal_renderer.rs @@ -1,8 +1,8 @@ use super::metal_atlas::MetalAtlas; use crate::{ point, size, AtlasTextureId, AtlasTextureKind, AtlasTile, Bounds, ContentMask, DevicePixels, - Hsla, MonochromeSprite, Path, PathId, PathVertex, PolychromeSprite, PrimitiveBatch, Quad, - ScaledPixels, Scene, Shadow, Size, Surface, Underline, GPU, + Gpu, Hsla, MonochromeSprite, Path, PathId, PathVertex, PolychromeSprite, PrimitiveBatch, Quad, + ScaledPixels, Scene, Shadow, Size, Surface, Underline, }; use anyhow::{anyhow, Result}; use block::ConcreteBlock; @@ -38,7 +38,7 @@ pub unsafe fn new_renderer( _native_view: *mut c_void, _bounds: crate::Size, _transparent: bool, - gpu: Option, + gpu: Option, ) -> Renderer { MetalRenderer::new(context, gpu) } @@ -109,9 +109,9 @@ pub(crate) struct MetalRenderer { } impl MetalRenderer { - pub fn new(instance_buffer_pool: Arc>, gpu: Option) -> Self { + pub fn new(instance_buffer_pool: Arc>, gpu: Option) -> Self { let device = match gpu { - Some(GPU::Discrete) => metal::Device::system_default(), + Some(Gpu::Discrete) => metal::Device::system_default(), _ => { // By default, prefer low‐power integrated GPUs on Intel Mac. On Apple // Silicon, there is only ever one GPU, so this is equivalent to diff --git a/crates/zed/src/zed.rs b/crates/zed/src/zed.rs index 345c431f13..506c293192 100644 --- a/crates/zed/src/zed.rs +++ b/crates/zed/src/zed.rs @@ -12,7 +12,7 @@ use breadcrumbs::Breadcrumbs; use client::ZED_URL_SCHEME; use collections::VecDeque; use editor::{scroll::Autoscroll, Editor, MultiBuffer}; -use gpu::GPUSettings; +use gpu::GpuSettings; use gpui::{ actions, point, px, AppContext, AsyncAppContext, Context, FocusableView, MenuItem, PromptLevel, ReadGlobal, TitlebarOptions, View, ViewContext, VisualContext, WindowKind, WindowOptions, @@ -80,7 +80,7 @@ pub fn init(cx: &mut AppContext) { cx.on_action(|_: &ShowAll, cx| cx.unhide_other_apps()); cx.on_action(quit); - GPUSettings::register(cx); + GpuSettings::register(cx); if ReleaseChannel::global(cx) == ReleaseChannel::Dev { cx.on_action(test_panic); } @@ -118,7 +118,7 @@ pub fn build_window_options(display_uuid: Option, cx: &mut AppContext) -> width: px(360.0), height: px(240.0), }), - gpu: GPUSettings::get_global(cx).gpu.map(Into::into), + gpu: GpuSettings::get_global(cx).gpu.map(Into::into), } } diff --git a/crates/zed/src/zed/gpu.rs b/crates/zed/src/zed/gpu.rs index 70d8ebe357..4d431c68ce 100644 --- a/crates/zed/src/zed/gpu.rs +++ b/crates/zed/src/zed/gpu.rs @@ -4,32 +4,32 @@ use settings::{Settings, SettingsSources}; #[derive(Copy, Clone, Debug, Default, Serialize, PartialEq, Eq, Deserialize, JsonSchema)] #[serde(rename_all = "lowercase")] -pub enum GPU { +pub enum Gpu { Discrete, #[default] Integrated, } -impl Into for GPU { - fn into(self) -> gpui::GPU { +impl Into for Gpu { + fn into(self) -> gpui::Gpu { match self { - GPU::Discrete => gpui::GPU::Discrete, - GPU::Integrated => gpui::GPU::Integrated, + Gpu::Discrete => gpui::Gpu::Discrete, + Gpu::Integrated => gpui::Gpu::Integrated, } } } /// Settings related to the machine's GPU and how Zed uses it. #[derive(Copy, Clone, Debug, Serialize, Deserialize, JsonSchema, PartialEq, Eq, Default)] -pub struct GPUSettings { +pub struct GpuSettings { /// Which GPU to prefer: discrete or integrated. /// Integrated are often lower-power and thus more battery-efficient. /// /// Default: 0.2 - pub gpu: Option, + pub gpu: Option, } -impl Settings for GPUSettings { +impl Settings for GpuSettings { const KEY: Option<&'static str> = None; type FileContent = Option;