linux: Better GPU debugging (#14706)

Release Notes:

- linux: Added GPU information to `editor: Copy System Specs to
Clipboard`
- linux: Show a prominant warning before running under llvmpipe and
similar.
This commit is contained in:
Conrad Irwin
2024-07-23 09:56:45 -06:00
committed by GitHub
parent c262c81e52
commit bdf1d4edea
16 changed files with 136 additions and 48 deletions
@@ -3,9 +3,9 @@
use super::{BladeAtlas, PATH_TEXTURE_FORMAT};
use crate::{
AtlasTextureKind, AtlasTile, Bounds, ContentMask, DevicePixels, Hsla, MonochromeSprite, Path,
PathId, PathVertex, PolychromeSprite, PrimitiveBatch, Quad, ScaledPixels, Scene, Shadow, Size,
Underline,
AtlasTextureKind, AtlasTile, Bounds, ContentMask, DevicePixels, GPUSpecs, Hsla,
MonochromeSprite, Path, PathId, PathVertex, PolychromeSprite, PrimitiveBatch, Quad,
ScaledPixels, Scene, Shadow, Size, Underline,
};
use bytemuck::{Pod, Zeroable};
use collections::HashMap;
@@ -451,6 +451,18 @@ impl BladeRenderer {
&self.atlas
}
#[cfg_attr(target_os = "macos", allow(dead_code))]
pub fn gpu_specs(&self) -> GPUSpecs {
let info = self.gpu.device_information();
GPUSpecs {
is_software_emulated: info.is_software_emulated,
device_name: info.device_name.clone(),
driver_name: info.driver_name.clone(),
driver_info: info.driver_info.clone(),
}
}
#[cfg(target_os = "macos")]
pub fn layer(&self) -> metal::MetalLayer {
self.gpu.metal_layer().unwrap()
@@ -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, Globals, Modifiers, Output, Pixels,
px, size, AnyWindowHandle, Bounds, Decorations, GPUSpecs, Globals, Modifiers, Output, Pixels,
PlatformDisplay, PlatformInput, Point, PromptLevel, ResizeEdge, Size, Tiling,
WaylandClientStatePtr, WindowAppearance, WindowBackgroundAppearance, WindowBounds,
WindowControls, WindowDecorations, WindowParams,
@@ -1007,6 +1007,10 @@ impl PlatformWindow for WaylandWindow {
update_window(state);
}
}
fn gpu_specs(&self) -> Option<GPUSpecs> {
self.borrow().renderer.gpu_specs().into()
}
}
fn update_window(mut state: RefMut<WaylandWindowState>) {
+7 -3
View File
@@ -2,9 +2,9 @@ use anyhow::Context;
use crate::{
platform::blade::{BladeRenderer, BladeSurfaceConfig},
px, size, AnyWindowHandle, Bounds, Decorations, DevicePixels, ForegroundExecutor, Modifiers,
Pixels, PlatformAtlas, PlatformDisplay, PlatformInput, PlatformInputHandler, PlatformWindow,
Point, PromptLevel, ResizeEdge, Scene, Size, Tiling, WindowAppearance,
px, size, AnyWindowHandle, Bounds, Decorations, DevicePixels, ForegroundExecutor, GPUSpecs,
Modifiers, Pixels, PlatformAtlas, PlatformDisplay, PlatformInput, PlatformInputHandler,
PlatformWindow, Point, PromptLevel, ResizeEdge, Scene, Size, Tiling, WindowAppearance,
WindowBackgroundAppearance, WindowBounds, WindowDecorations, WindowKind, WindowParams,
X11ClientStatePtr,
};
@@ -1385,4 +1385,8 @@ impl PlatformWindow for X11Window {
appearance_changed();
}
}
fn gpu_specs(&self) -> Option<GPUSpecs> {
self.0.state.borrow().renderer.gpu_specs().into()
}
}
+4
View File
@@ -1096,6 +1096,10 @@ impl PlatformWindow for MacWindow {
fn sprite_atlas(&self) -> Arc<dyn PlatformAtlas> {
self.0.lock().renderer.sprite_atlas().clone()
}
fn gpu_specs(&self) -> Option<crate::GPUSpecs> {
None
}
}
impl rwh::HasWindowHandle for MacWindow {
+7 -3
View File
@@ -1,7 +1,7 @@
use crate::{
AnyWindowHandle, AtlasKey, AtlasTextureId, AtlasTile, Bounds, DispatchEventResult, Pixels,
PlatformAtlas, PlatformDisplay, PlatformInput, PlatformInputHandler, PlatformWindow, Point,
Size, TestPlatform, TileId, WindowAppearance, WindowBackgroundAppearance, WindowBounds,
AnyWindowHandle, AtlasKey, AtlasTextureId, AtlasTile, Bounds, DispatchEventResult, GPUSpecs,
Pixels, PlatformAtlas, PlatformDisplay, PlatformInput, PlatformInputHandler, PlatformWindow,
Point, Size, TestPlatform, TileId, WindowAppearance, WindowBackgroundAppearance, WindowBounds,
WindowParams,
};
use collections::HashMap;
@@ -273,6 +273,10 @@ impl PlatformWindow for TestWindow {
fn start_window_move(&self) {
unimplemented!()
}
fn gpu_specs(&self) -> Option<GPUSpecs> {
None
}
}
pub(crate) struct TestAtlasState {
@@ -654,6 +654,10 @@ impl PlatformWindow for WindowsWindow {
fn get_raw_handle(&self) -> HWND {
self.0.hwnd
}
fn gpu_specs(&self) -> Option<GPUSpecs> {
Some(self.0.state.borrow().renderer.gpu_specs())
}
}
#[implement(IDropTarget)]