mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-08-25 00:21:46 +00:00
comments
This commit is contained in:
17
src/App.zig
17
src/App.zig
@@ -79,21 +79,6 @@ pub fn create(alloc: Allocator) CreateError!*App {
|
||||
errdefer alloc.destroy(app);
|
||||
try app.init(alloc);
|
||||
|
||||
// Warm up system services on background threads. These are
|
||||
// multi-millisecond one-time costs that would otherwise be paid
|
||||
// during the first surface's initialization. Doing it here overlaps
|
||||
// them with the rest of app startup (config, app runtime, window
|
||||
// creation).
|
||||
threadedWarmup();
|
||||
|
||||
return app;
|
||||
}
|
||||
|
||||
/// Warm up system services whose first use in a process is slow. Each
|
||||
/// subsystem gets its own background thread so that one slow subsystem
|
||||
/// doesn't delay the others. Only operations that are safe to run on
|
||||
/// any thread belong here.
|
||||
fn threadedWarmup() void {
|
||||
// If font discovery supports warmup, then we call it. Some font
|
||||
// mechanisms (e.g. CoreText) have a multi-millisecond one-time cost
|
||||
// on startup.
|
||||
@@ -118,6 +103,8 @@ fn threadedWarmup() void {
|
||||
log.warn("renderer warmup thread spawn failed err={}", .{err});
|
||||
}
|
||||
}
|
||||
|
||||
return app;
|
||||
}
|
||||
|
||||
/// Initialize the main app instance. This creates the main window, sets
|
||||
|
||||
@@ -413,12 +413,6 @@ pub inline fn beginFrame(
|
||||
/// thread at app startup; Metal device queries are thread-safe) moves
|
||||
/// that one-time cost off the critical path of the first surface's
|
||||
/// renderer initialization.
|
||||
///
|
||||
/// We deliberately do NOT cache the chosen device: the device set can
|
||||
/// change at runtime (e.g. an eGPU being plugged in or removed) and
|
||||
/// chooseDevice prefers removable GPUs, so every renderer init must
|
||||
/// re-choose. Only the underlying framework initialization is a
|
||||
/// one-time cost.
|
||||
pub fn warmup() void {
|
||||
const device = chooseDevice() catch return;
|
||||
defer device.release();
|
||||
|
||||
Reference in New Issue
Block a user