gpui: Rename GPUSpecs to GpuSpecs (#22166)

This PR renames the `GPUSpecs` type to `GpuSpecs` to match Rust naming
conventions.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2024-12-17 17:22:53 -05:00 committed by GitHub
parent ce97e4ddc1
commit ba44db7f49
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 22 additions and 22 deletions

View file

@ -344,15 +344,15 @@ impl<T> Flatten<T> for Result<T> {
} }
} }
/// Information about the GPU GPUI is running on.
#[derive(Default, Debug)] #[derive(Default, Debug)]
/// Information about the GPU GPUI is running on pub struct GpuSpecs {
pub struct GPUSpecs { /// Whether the GPU is really a fake (like `llvmpipe`) running on the CPU.
/// true if the GPU is really a fake (like llvmpipe) running on the CPU
pub is_software_emulated: bool, 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, 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, pub driver_name: String,
/// Further driver info as reported by vulkan /// Further information about the driver, as reported by Vulkan.
pub driver_info: String, pub driver_info: String,
} }

View file

@ -28,7 +28,7 @@ mod windows;
use crate::{ use crate::{
point, Action, AnyWindowHandle, AsyncWindowContext, BackgroundExecutor, Bounds, DevicePixels, 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, ImageSource, Keymap, LineLayout, Pixels, PlatformInput, Point, RenderGlyphParams, RenderImage,
RenderImageParams, RenderSvgParams, ScaledPixels, Scene, SharedString, Size, SvgRenderer, RenderImageParams, RenderSvgParams, ScaledPixels, Scene, SharedString, Size, SvgRenderer,
SvgSize, Task, TaskLabel, WindowContext, DEFAULT_WINDOW_SIZE, SvgSize, Task, TaskLabel, WindowContext, DEFAULT_WINDOW_SIZE,
@ -432,7 +432,7 @@ pub(crate) trait PlatformWindow: HasWindowHandle + HasDisplayHandle {
WindowControls::default() WindowControls::default()
} }
fn set_client_inset(&self, _inset: Pixels) {} fn set_client_inset(&self, _inset: Pixels) {}
fn gpu_specs(&self) -> Option<GPUSpecs>; fn gpu_specs(&self) -> Option<GpuSpecs>;
fn update_ime_position(&self, _bounds: Bounds<ScaledPixels>); fn update_ime_position(&self, _bounds: Bounds<ScaledPixels>);

View file

@ -3,7 +3,7 @@
use super::{BladeAtlas, PATH_TEXTURE_FORMAT}; use super::{BladeAtlas, PATH_TEXTURE_FORMAT};
use crate::{ use crate::{
AtlasTextureKind, AtlasTile, Background, Bounds, ContentMask, DevicePixels, GPUSpecs, AtlasTextureKind, AtlasTile, Background, Bounds, ContentMask, DevicePixels, GpuSpecs,
MonochromeSprite, Path, PathId, PathVertex, PolychromeSprite, PrimitiveBatch, Quad, MonochromeSprite, Path, PathId, PathVertex, PolychromeSprite, PrimitiveBatch, Quad,
ScaledPixels, Scene, Shadow, Size, Underline, ScaledPixels, Scene, Shadow, Size, Underline,
}; };
@ -477,10 +477,10 @@ impl BladeRenderer {
} }
#[cfg_attr(target_os = "macos", allow(dead_code))] #[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(); let info = self.gpu.device_information();
GPUSpecs { GpuSpecs {
is_software_emulated: info.is_software_emulated, is_software_emulated: info.is_software_emulated,
device_name: info.device_name.clone(), device_name: info.device_name.clone(),
driver_name: info.driver_name.clone(), driver_name: info.driver_name.clone(),

View file

@ -25,7 +25,7 @@ use crate::platform::linux::wayland::serial::SerialKind;
use crate::platform::{PlatformAtlas, PlatformInputHandler, PlatformWindow}; use crate::platform::{PlatformAtlas, PlatformInputHandler, PlatformWindow};
use crate::scene::Scene; use crate::scene::Scene;
use crate::{ 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, PlatformDisplay, PlatformInput, Point, PromptLevel, RequestFrameOptions, ResizeEdge,
ScaledPixels, Size, Tiling, WaylandClientStatePtr, WindowAppearance, ScaledPixels, Size, Tiling, WaylandClientStatePtr, WindowAppearance,
WindowBackgroundAppearance, WindowBounds, WindowControls, WindowDecorations, WindowParams, WindowBackgroundAppearance, WindowBounds, WindowControls, WindowDecorations, WindowParams,
@ -1019,7 +1019,7 @@ impl PlatformWindow for WaylandWindow {
state.client.update_ime_position(bounds); state.client.update_ime_position(bounds);
} }
fn gpu_specs(&self) -> Option<GPUSpecs> { fn gpu_specs(&self) -> Option<GpuSpecs> {
self.borrow().renderer.gpu_specs().into() self.borrow().renderer.gpu_specs().into()
} }
} }

View file

@ -2,7 +2,7 @@ use anyhow::{anyhow, Context};
use crate::{ use crate::{
platform::blade::{BladeRenderer, BladeSurfaceConfig}, 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, Modifiers, Pixels, PlatformAtlas, PlatformDisplay, PlatformInput, PlatformInputHandler,
PlatformWindow, Point, PromptLevel, RequestFrameOptions, ResizeEdge, ScaledPixels, Scene, Size, PlatformWindow, Point, PromptLevel, RequestFrameOptions, ResizeEdge, ScaledPixels, Scene, Size,
Tiling, WindowAppearance, WindowBackgroundAppearance, WindowBounds, WindowDecorations, Tiling, WindowAppearance, WindowBackgroundAppearance, WindowBounds, WindowDecorations,
@ -1536,7 +1536,7 @@ impl PlatformWindow for X11Window {
client.update_ime_position(bounds); client.update_ime_position(bounds);
} }
fn gpu_specs(&self) -> Option<GPUSpecs> { fn gpu_specs(&self) -> Option<GpuSpecs> {
self.0.state.borrow().renderer.gpu_specs().into() self.0.state.borrow().renderer.gpu_specs().into()
} }
} }

View file

@ -1102,7 +1102,7 @@ impl PlatformWindow for MacWindow {
self.0.lock().renderer.sprite_atlas().clone() self.0.lock().renderer.sprite_atlas().clone()
} }
fn gpu_specs(&self) -> Option<crate::GPUSpecs> { fn gpu_specs(&self) -> Option<crate::GpuSpecs> {
None None
} }

View file

@ -1,5 +1,5 @@
use crate::{ use crate::{
AnyWindowHandle, AtlasKey, AtlasTextureId, AtlasTile, Bounds, DispatchEventResult, GPUSpecs, AnyWindowHandle, AtlasKey, AtlasTextureId, AtlasTile, Bounds, DispatchEventResult, GpuSpecs,
Pixels, PlatformAtlas, PlatformDisplay, PlatformInput, PlatformInputHandler, PlatformWindow, Pixels, PlatformAtlas, PlatformDisplay, PlatformInput, PlatformInputHandler, PlatformWindow,
Point, RequestFrameOptions, ScaledPixels, Size, TestPlatform, TileId, WindowAppearance, Point, RequestFrameOptions, ScaledPixels, Size, TestPlatform, TileId, WindowAppearance,
WindowBackgroundAppearance, WindowBounds, WindowParams, WindowBackgroundAppearance, WindowBounds, WindowParams,
@ -276,7 +276,7 @@ impl PlatformWindow for TestWindow {
fn update_ime_position(&self, _bounds: Bounds<ScaledPixels>) {} fn update_ime_position(&self, _bounds: Bounds<ScaledPixels>) {}
fn gpu_specs(&self) -> Option<GPUSpecs> { fn gpu_specs(&self) -> Option<GpuSpecs> {
None None
} }
} }

View file

@ -770,7 +770,7 @@ impl PlatformWindow for WindowsWindow {
self.0.hwnd self.0.hwnd
} }
fn gpu_specs(&self) -> Option<GPUSpecs> { fn gpu_specs(&self) -> Option<GpuSpecs> {
Some(self.0.state.borrow().renderer.gpu_specs()) Some(self.0.state.borrow().renderer.gpu_specs())
} }

View file

@ -3,7 +3,7 @@ use crate::{
AnyView, AppContext, Arena, Asset, AsyncWindowContext, AvailableSpace, Background, Bounds, AnyView, AppContext, Arena, Asset, AsyncWindowContext, AvailableSpace, Background, Bounds,
BoxShadow, Context, Corners, CursorStyle, Decorations, DevicePixels, DispatchActionListener, BoxShadow, Context, Corners, CursorStyle, Decorations, DevicePixels, DispatchActionListener,
DispatchNodeId, DispatchTree, DisplayId, Edges, Effect, Entity, EntityId, EventEmitter, 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, IsZero, KeyBinding, KeyContext, KeyDownEvent, KeyEvent, Keystroke, KeystrokeEvent,
KeystrokeObserver, LayoutId, LineLayoutIndex, Model, ModelContext, Modifiers, KeystrokeObserver, LayoutId, LineLayoutIndex, Model, ModelContext, Modifiers,
ModifiersChangedEvent, MonochromeSprite, MouseButton, MouseEvent, MouseMoveEvent, MouseUpEvent, ModifiersChangedEvent, MonochromeSprite, MouseButton, MouseEvent, MouseMoveEvent, MouseUpEvent,
@ -3808,7 +3808,7 @@ impl<'a> WindowContext<'a> {
/// Read information about the GPU backing this window. /// Read information about the GPU backing this window.
/// Currently returns None on Mac and Windows. /// Currently returns None on Mac and Windows.
pub fn gpu_specs(&self) -> Option<GPUSpecs> { pub fn gpu_specs(&self) -> Option<GpuSpecs> {
self.window.platform_window.gpu_specs() self.window.platform_window.gpu_specs()
} }
} }

View file

@ -264,7 +264,7 @@ fn initialize_linux_file_watcher(cx: &mut ViewContext<Workspace>) {
} }
fn show_software_emulation_warning_if_needed( fn show_software_emulation_warning_if_needed(
specs: gpui::GPUSpecs, specs: gpui::GpuSpecs,
cx: &mut ViewContext<Workspace>, cx: &mut ViewContext<Workspace>,
) { ) {
if specs.is_software_emulated && std::env::var("ZED_ALLOW_EMULATED_GPU").is_err() { if specs.is_software_emulated && std::env::var("ZED_ALLOW_EMULATED_GPU").is_err() {