Revert "renderer/metal: free resources when occluded"

This reverts commit b5d543705de4ea42407db9e2d49ae03f3ae5cf14.
This commit is contained in:
Mitchell Hashimoto
2024-02-13 21:57:46 -08:00
parent b5d543705d
commit e10e45a935
2 changed files with 0 additions and 21 deletions

View File

@ -509,19 +509,6 @@ pub fn setFocus(self: *Metal, focus: bool) !void {
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.
///
/// 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
// create them. If we fail to create them, mark the renderer as unhealthy.
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| {
self.setHealth(.unhealthy);
return err;
@ -2240,10 +2226,6 @@ const VisibleResources = struct {
const texture_color = try initAtlasTexture(m.device, &m.font_group.atlas_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 .{
.shaders = shaders,
.buf_cells = buf_cells,

View File

@ -250,9 +250,6 @@ fn drainMailbox(self: *Thread) !void {
// Set our visible state
self.flags.visible = v;
// Set it on the renderer
try self.renderer.setVisible(v);
// If we became visible then we immediately trigger a draw.
// We don't need to update frame data because that should
// still be happening.