diff --git a/crates/gpui/src/gpui.rs b/crates/gpui/src/gpui.rs index 51e2c3f17329bd2961972992639c512f436dfef3..265491c6f5b6ce5bc84baa9dba54ca4b4fd3064a 100644 --- a/crates/gpui/src/gpui.rs +++ b/crates/gpui/src/gpui.rs @@ -344,15 +344,15 @@ impl Flatten for Result { } } +/// Information about the GPU GPUI is running on. #[derive(Default, Debug)] -/// Information about the GPU GPUI is running on -pub struct GPUSpecs { - /// true if the GPU is really a fake (like llvmpipe) running on the CPU +pub struct GpuSpecs { + /// Whether the GPU is really a fake (like `llvmpipe`) running on the CPU. pub is_software_emulated: bool, - /// Name of the device as reported by vulkan + /// The name of the device, as reported by Vulkan. pub device_name: String, - /// Name of the driver as reported by vulkan + /// The name of the driver, as reported by Vulkan. pub driver_name: String, - /// Further driver info as reported by vulkan + /// Further information about the driver, as reported by Vulkan. pub driver_info: String, } diff --git a/crates/gpui/src/platform.rs b/crates/gpui/src/platform.rs index f3ffa323d89812221190879f6fd4fab59bf67db3..18c6199c7687ea2ecdd07a38c0514d68f72e56f7 100644 --- a/crates/gpui/src/platform.rs +++ b/crates/gpui/src/platform.rs @@ -28,7 +28,7 @@ mod windows; use crate::{ point, Action, AnyWindowHandle, AsyncWindowContext, BackgroundExecutor, Bounds, DevicePixels, - DispatchEventResult, Font, FontId, FontMetrics, FontRun, ForegroundExecutor, GPUSpecs, GlyphId, + DispatchEventResult, Font, FontId, FontMetrics, FontRun, ForegroundExecutor, GlyphId, GpuSpecs, ImageSource, Keymap, LineLayout, Pixels, PlatformInput, Point, RenderGlyphParams, RenderImage, RenderImageParams, RenderSvgParams, ScaledPixels, Scene, SharedString, Size, SvgRenderer, SvgSize, Task, TaskLabel, WindowContext, DEFAULT_WINDOW_SIZE, @@ -432,7 +432,7 @@ pub(crate) trait PlatformWindow: HasWindowHandle + HasDisplayHandle { WindowControls::default() } fn set_client_inset(&self, _inset: Pixels) {} - fn gpu_specs(&self) -> Option; + fn gpu_specs(&self) -> Option; fn update_ime_position(&self, _bounds: Bounds); diff --git a/crates/gpui/src/platform/blade/blade_renderer.rs b/crates/gpui/src/platform/blade/blade_renderer.rs index 6781d46ed4224a51efbeca7a549f708cdbb7ccfe..92becf2342446f6b406129624f2f10c589d21535 100644 --- a/crates/gpui/src/platform/blade/blade_renderer.rs +++ b/crates/gpui/src/platform/blade/blade_renderer.rs @@ -3,7 +3,7 @@ use super::{BladeAtlas, PATH_TEXTURE_FORMAT}; use crate::{ - AtlasTextureKind, AtlasTile, Background, Bounds, ContentMask, DevicePixels, GPUSpecs, + AtlasTextureKind, AtlasTile, Background, Bounds, ContentMask, DevicePixels, GpuSpecs, MonochromeSprite, Path, PathId, PathVertex, PolychromeSprite, PrimitiveBatch, Quad, ScaledPixels, Scene, Shadow, Size, Underline, }; @@ -477,10 +477,10 @@ impl BladeRenderer { } #[cfg_attr(target_os = "macos", allow(dead_code))] - pub fn gpu_specs(&self) -> GPUSpecs { + pub fn gpu_specs(&self) -> GpuSpecs { let info = self.gpu.device_information(); - GPUSpecs { + GpuSpecs { is_software_emulated: info.is_software_emulated, device_name: info.device_name.clone(), driver_name: info.driver_name.clone(), diff --git a/crates/gpui/src/platform/linux/wayland/window.rs b/crates/gpui/src/platform/linux/wayland/window.rs index 4cdf88e26268e43dea8175905c5fceaec4a4e20a..bb0485272b70da84f51d976b9eeb14ee8f3b376b 100644 --- a/crates/gpui/src/platform/linux/wayland/window.rs +++ b/crates/gpui/src/platform/linux/wayland/window.rs @@ -25,7 +25,7 @@ use crate::platform::linux::wayland::serial::SerialKind; use crate::platform::{PlatformAtlas, PlatformInputHandler, PlatformWindow}; use crate::scene::Scene; use crate::{ - px, size, AnyWindowHandle, Bounds, Decorations, GPUSpecs, Globals, Modifiers, Output, Pixels, + px, size, AnyWindowHandle, Bounds, Decorations, Globals, GpuSpecs, Modifiers, Output, Pixels, PlatformDisplay, PlatformInput, Point, PromptLevel, RequestFrameOptions, ResizeEdge, ScaledPixels, Size, Tiling, WaylandClientStatePtr, WindowAppearance, WindowBackgroundAppearance, WindowBounds, WindowControls, WindowDecorations, WindowParams, @@ -1019,7 +1019,7 @@ impl PlatformWindow for WaylandWindow { state.client.update_ime_position(bounds); } - fn gpu_specs(&self) -> Option { + fn gpu_specs(&self) -> Option { self.borrow().renderer.gpu_specs().into() } } diff --git a/crates/gpui/src/platform/linux/x11/window.rs b/crates/gpui/src/platform/linux/x11/window.rs index ae9abe714691f8a97fd1ce9d7d878015f1140caa..2cce0f065d7bcca3202ad169c70b7e6506c48f29 100644 --- a/crates/gpui/src/platform/linux/x11/window.rs +++ b/crates/gpui/src/platform/linux/x11/window.rs @@ -2,7 +2,7 @@ use anyhow::{anyhow, Context}; use crate::{ platform::blade::{BladeRenderer, BladeSurfaceConfig}, - px, size, AnyWindowHandle, Bounds, Decorations, DevicePixels, ForegroundExecutor, GPUSpecs, + px, size, AnyWindowHandle, Bounds, Decorations, DevicePixels, ForegroundExecutor, GpuSpecs, Modifiers, Pixels, PlatformAtlas, PlatformDisplay, PlatformInput, PlatformInputHandler, PlatformWindow, Point, PromptLevel, RequestFrameOptions, ResizeEdge, ScaledPixels, Scene, Size, Tiling, WindowAppearance, WindowBackgroundAppearance, WindowBounds, WindowDecorations, @@ -1536,7 +1536,7 @@ impl PlatformWindow for X11Window { client.update_ime_position(bounds); } - fn gpu_specs(&self) -> Option { + fn gpu_specs(&self) -> Option { self.0.state.borrow().renderer.gpu_specs().into() } } diff --git a/crates/gpui/src/platform/mac/window.rs b/crates/gpui/src/platform/mac/window.rs index 1779767dca4391a26e9d85d3008be193966869a7..04fda6294a0ae1d905270222e2730413229a4f98 100644 --- a/crates/gpui/src/platform/mac/window.rs +++ b/crates/gpui/src/platform/mac/window.rs @@ -1102,7 +1102,7 @@ impl PlatformWindow for MacWindow { self.0.lock().renderer.sprite_atlas().clone() } - fn gpu_specs(&self) -> Option { + fn gpu_specs(&self) -> Option { None } diff --git a/crates/gpui/src/platform/test/window.rs b/crates/gpui/src/platform/test/window.rs index 9c94aeaf2f26ca8ffcbe3e574df48082dfc352c0..89aab79c1d6c0c00437ddc3140282e0cd88e4a60 100644 --- a/crates/gpui/src/platform/test/window.rs +++ b/crates/gpui/src/platform/test/window.rs @@ -1,5 +1,5 @@ use crate::{ - AnyWindowHandle, AtlasKey, AtlasTextureId, AtlasTile, Bounds, DispatchEventResult, GPUSpecs, + AnyWindowHandle, AtlasKey, AtlasTextureId, AtlasTile, Bounds, DispatchEventResult, GpuSpecs, Pixels, PlatformAtlas, PlatformDisplay, PlatformInput, PlatformInputHandler, PlatformWindow, Point, RequestFrameOptions, ScaledPixels, Size, TestPlatform, TileId, WindowAppearance, WindowBackgroundAppearance, WindowBounds, WindowParams, @@ -276,7 +276,7 @@ impl PlatformWindow for TestWindow { fn update_ime_position(&self, _bounds: Bounds) {} - fn gpu_specs(&self) -> Option { + fn gpu_specs(&self) -> Option { None } } diff --git a/crates/gpui/src/platform/windows/window.rs b/crates/gpui/src/platform/windows/window.rs index 16e2a3e7ac19fae1084e5ec01a01c9f00c2bea4e..be3deab6310324229dc18d679db7b7553cf9b880 100644 --- a/crates/gpui/src/platform/windows/window.rs +++ b/crates/gpui/src/platform/windows/window.rs @@ -770,7 +770,7 @@ impl PlatformWindow for WindowsWindow { self.0.hwnd } - fn gpu_specs(&self) -> Option { + fn gpu_specs(&self) -> Option { Some(self.0.state.borrow().renderer.gpu_specs()) } diff --git a/crates/gpui/src/window.rs b/crates/gpui/src/window.rs index 4775022431111b10dad5b8cb20e016b87ce0d172..437de7dcb31c38d27c8533e057d7777cb7004896 100644 --- a/crates/gpui/src/window.rs +++ b/crates/gpui/src/window.rs @@ -3,7 +3,7 @@ use crate::{ AnyView, AppContext, Arena, Asset, AsyncWindowContext, AvailableSpace, Background, Bounds, BoxShadow, Context, Corners, CursorStyle, Decorations, DevicePixels, DispatchActionListener, DispatchNodeId, DispatchTree, DisplayId, Edges, Effect, Entity, EntityId, EventEmitter, - FileDropEvent, Flatten, FontId, GPUSpecs, Global, GlobalElementId, GlyphId, Hsla, InputHandler, + FileDropEvent, Flatten, FontId, Global, GlobalElementId, GlyphId, GpuSpecs, Hsla, InputHandler, IsZero, KeyBinding, KeyContext, KeyDownEvent, KeyEvent, Keystroke, KeystrokeEvent, KeystrokeObserver, LayoutId, LineLayoutIndex, Model, ModelContext, Modifiers, ModifiersChangedEvent, MonochromeSprite, MouseButton, MouseEvent, MouseMoveEvent, MouseUpEvent, @@ -3808,7 +3808,7 @@ impl<'a> WindowContext<'a> { /// Read information about the GPU backing this window. /// Currently returns None on Mac and Windows. - pub fn gpu_specs(&self) -> Option { + pub fn gpu_specs(&self) -> Option { self.window.platform_window.gpu_specs() } } diff --git a/crates/zed/src/zed.rs b/crates/zed/src/zed.rs index db685a6f79c2fb7c28478b7ebea5a29d7ac82606..5cff09de0f70f8cc0302f0f6fb2539f38ad9d364 100644 --- a/crates/zed/src/zed.rs +++ b/crates/zed/src/zed.rs @@ -264,7 +264,7 @@ fn initialize_linux_file_watcher(cx: &mut ViewContext) { } fn show_software_emulation_warning_if_needed( - specs: gpui::GPUSpecs, + specs: gpui::GpuSpecs, cx: &mut ViewContext, ) { if specs.is_software_emulated && std::env::var("ZED_ALLOW_EMULATED_GPU").is_err() {