mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 00:36:07 +03:00
Revert "renderer/metal: free resources when occluded"
This reverts commit b5d543705de4ea42407db9e2d49ae03f3ae5cf14.
This commit is contained in:
@ -509,19 +509,6 @@ pub fn setFocus(self: *Metal, focus: bool) !void {
|
|||||||
self.focused = focus;
|
self.focused = focus;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Callback when the view visibility changes, i.e. if a window is on
|
|
||||||
/// another workspace, behind a window, etc.
|
|
||||||
pub fn setVisible(self: *Metal, visible: bool) !void {
|
|
||||||
//if (true) return;
|
|
||||||
if (!visible) {
|
|
||||||
if (self.visible_resources) |*v| {
|
|
||||||
log.debug("view occluded, deallocating GPU resources", .{});
|
|
||||||
v.deinit(self.alloc);
|
|
||||||
self.visible_resources = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Set the new font size.
|
/// Set the new font size.
|
||||||
///
|
///
|
||||||
/// Must be called on the render thread.
|
/// Must be called on the render thread.
|
||||||
@ -725,7 +712,6 @@ pub fn drawFrame(self: *Metal, surface: *apprt.Surface) !void {
|
|||||||
// Get our cached resources. If we don't have them, then we need to
|
// Get our cached resources. If we don't have them, then we need to
|
||||||
// create them. If we fail to create them, mark the renderer as unhealthy.
|
// create them. If we fail to create them, mark the renderer as unhealthy.
|
||||||
const resources: *VisibleResources = if (self.visible_resources) |*v| v else resources: {
|
const resources: *VisibleResources = if (self.visible_resources) |*v| v else resources: {
|
||||||
log.debug("view is visible, allocating GPU resources", .{});
|
|
||||||
const resources = VisibleResources.init(self) catch |err| {
|
const resources = VisibleResources.init(self) catch |err| {
|
||||||
self.setHealth(.unhealthy);
|
self.setHealth(.unhealthy);
|
||||||
return err;
|
return err;
|
||||||
@ -2240,10 +2226,6 @@ const VisibleResources = struct {
|
|||||||
const texture_color = try initAtlasTexture(m.device, &m.font_group.atlas_color);
|
const texture_color = try initAtlasTexture(m.device, &m.font_group.atlas_color);
|
||||||
errdefer deinitMTLResource(texture_color);
|
errdefer deinitMTLResource(texture_color);
|
||||||
|
|
||||||
// Mark our atlas as modified so the textures are synced
|
|
||||||
m.font_group.atlas_greyscale.modified = true;
|
|
||||||
m.font_group.atlas_color.modified = true;
|
|
||||||
|
|
||||||
return .{
|
return .{
|
||||||
.shaders = shaders,
|
.shaders = shaders,
|
||||||
.buf_cells = buf_cells,
|
.buf_cells = buf_cells,
|
||||||
|
@ -250,9 +250,6 @@ fn drainMailbox(self: *Thread) !void {
|
|||||||
// Set our visible state
|
// Set our visible state
|
||||||
self.flags.visible = v;
|
self.flags.visible = v;
|
||||||
|
|
||||||
// Set it on the renderer
|
|
||||||
try self.renderer.setVisible(v);
|
|
||||||
|
|
||||||
// If we became visible then we immediately trigger a draw.
|
// If we became visible then we immediately trigger a draw.
|
||||||
// We don't need to update frame data because that should
|
// We don't need to update frame data because that should
|
||||||
// still be happening.
|
// still be happening.
|
||||||
|
Reference in New Issue
Block a user