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.

Revert "Introduce a new `ToggleGraphicsProfiler` command (#7607)" (#8567)

Conrad Irwin9bd5ebb74bcf
diff --git a/crates/gpui/src/platform.rs b/crates/gpui/src/platform.rs
index 62383df57ca..b02d521a8c9 100644
--- a/crates/gpui/src/platform.rs
+++ b/crates/gpui/src/platform.rs
@@ -195,8 +195,8 @@ pub(crate) trait PlatformWindow: HasWindowHandle + HasDisplayHandle {
fn on_appearance_changed(&self, callback: Box<dyn FnMut()>);
fn is_topmost_for_position(&self, position: Point<Pixels>) -> bool;
fn draw(&self, scene: &Scene);
+
fn sprite_atlas(&self) -> Arc<dyn PlatformAtlas>;
- fn set_graphics_profiler_enabled(&self, enabled: bool);
#[cfg(any(test, feature = "test-support"))]
fn as_test(&mut self) -> Option<&mut TestWindow> {
diff --git a/crates/gpui/src/platform/linux/wayland/window.rs b/crates/gpui/src/platform/linux/wayland/window.rs
index d086222b614..8ad1b81cd64 100644
--- a/crates/gpui/src/platform/linux/wayland/window.rs
+++ b/crates/gpui/src/platform/linux/wayland/window.rs
@@ -394,10 +394,6 @@ impl PlatformWindow for WaylandWindow {
let inner = self.0.inner.borrow_mut();
inner.renderer.sprite_atlas().clone()
}
-
- fn set_graphics_profiler_enabled(&self, enabled: bool) {
- //todo!(linux)
- }
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)]
diff --git a/crates/gpui/src/platform/linux/x11/window.rs b/crates/gpui/src/platform/linux/x11/window.rs
index 7df4a8416d8..cfacca9d2bb 100644
--- a/crates/gpui/src/platform/linux/x11/window.rs
+++ b/crates/gpui/src/platform/linux/x11/window.rs
@@ -525,8 +525,4 @@ impl PlatformWindow for X11Window {
let inner = self.0.inner.borrow_mut();
inner.renderer.sprite_atlas().clone()
}
-
- fn set_graphics_profiler_enabled(&self, enabled: bool) {
- unimplemented!("linux")
- }
}
diff --git a/crates/gpui/src/platform/mac/window.rs b/crates/gpui/src/platform/mac/window.rs
index 0773b156bd4..bdfd41a46f7 100644
--- a/crates/gpui/src/platform/mac/window.rs
+++ b/crates/gpui/src/platform/mac/window.rs
@@ -1060,27 +1060,6 @@ impl PlatformWindow for MacWindow {
fn sprite_atlas(&self) -> Arc<dyn PlatformAtlas> {
self.0.lock().renderer.sprite_atlas().clone()
}
-
- /// Enables or disables the Metal HUD for debugging purposes. Note that this only works
- /// when the app is bundled and it has the `MetalHudEnabled` key set to true in Info.plist.
- fn set_graphics_profiler_enabled(&self, enabled: bool) {
- let this_lock = self.0.lock();
- let layer = this_lock.renderer.layer();
-
- unsafe {
- if enabled {
- let hud_properties = NSDictionary::dictionaryWithObject_forKey_(
- nil,
- ns_string("default"),
- ns_string("mode"),
- );
- let _: () = msg_send![layer, setDeveloperHUDProperties: hud_properties];
- } else {
- let _: () =
- msg_send![layer, setDeveloperHUDProperties: NSDictionary::dictionary(nil)];
- }
- }
- }
}
impl HasWindowHandle for MacWindow {
diff --git a/crates/gpui/src/platform/test/window.rs b/crates/gpui/src/platform/test/window.rs
index 49ce7bd771a..70dcce9033b 100644
--- a/crates/gpui/src/platform/test/window.rs
+++ b/crates/gpui/src/platform/test/window.rs
@@ -251,8 +251,6 @@ impl PlatformWindow for TestWindow {
self.0.lock().sprite_atlas.clone()
}
- fn set_graphics_profiler_enabled(&self, _enabled: bool) {}
-
fn as_test(&mut self) -> Option<&mut TestWindow> {
Some(self)
}
diff --git a/crates/gpui/src/window.rs b/crates/gpui/src/window.rs
index 846dcfd97f0..f615b192ee4 100644
--- a/crates/gpui/src/window.rs
+++ b/crates/gpui/src/window.rs
@@ -280,7 +280,6 @@ pub struct Window {
pub(crate) focus: Option<FocusId>,
focus_enabled: bool,
pending_input: Option<PendingInput>,
- graphics_profiler_enabled: bool,
}
#[derive(Default, Debug)]
@@ -474,7 +473,6 @@ impl Window {
focus: None,
focus_enabled: true,
pending_input: None,
- graphics_profiler_enabled: false,
}
}
fn new_focus_listener(
@@ -1519,14 +1517,6 @@ impl<'a> WindowContext<'a> {
}
}
- /// Toggle the graphics profiler to debug your application's rendering performance.
- pub fn toggle_graphics_profiler(&mut self) {
- self.window.graphics_profiler_enabled = !self.window.graphics_profiler_enabled;
- self.window
- .platform_window
- .set_graphics_profiler_enabled(self.window.graphics_profiler_enabled);
- }
-
/// Register the given handler to be invoked whenever the global of the given type
/// is updated.
pub fn observe_global<G: Global>(
diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rs
index 07f69c3495b..81642952cf5 100644
--- a/crates/workspace/src/workspace.rs
+++ b/crates/workspace/src/workspace.rs
@@ -121,7 +121,6 @@ actions!(
ToggleRightDock,
ToggleBottomDock,
CloseAllDocks,
- ToggleGraphicsProfiler,
]
);
@@ -3583,7 +3582,6 @@ impl Workspace {
workspace.reopen_closed_item(cx).detach();
}),
)
- .on_action(|_: &ToggleGraphicsProfiler, cx| cx.toggle_graphics_profiler())
}
#[cfg(any(test, feature = "test-support"))]
diff --git a/crates/zed/resources/info/Permissions.plist b/crates/zed/resources/info/Permissions.plist
index fd608afaa0c..bded5a82e2c 100644
--- a/crates/zed/resources/info/Permissions.plist
+++ b/crates/zed/resources/info/Permissions.plist
@@ -22,5 +22,3 @@
<string>An application in Zed wants to use speech recognition.</string>
<key>NSRemindersUsageDescription</key>
<string>An application in Zed wants to use your reminders.</string>
-<key>MetalHudEnabled</key>
-<true />
diff --git a/crates/zed/src/app_menus.rs b/crates/zed/src/app_menus.rs
index f48a721b5c2..0ea51801eae 100644
--- a/crates/zed/src/app_menus.rs
+++ b/crates/zed/src/app_menus.rs
@@ -156,10 +156,6 @@ pub fn app_menus() -> Vec<Menu<'static>> {
MenuItem::action("View Telemetry", crate::OpenTelemetryLog),
MenuItem::action("View Dependency Licenses", crate::OpenLicenses),
MenuItem::action("Show Welcome", workspace::Welcome),
- MenuItem::action(
- "Toggle Graphics Profiler",
- workspace::ToggleGraphicsProfiler,
- ),
MenuItem::separator(),
MenuItem::action(
"Documentation",