mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-15 00:06:09 +03:00
Merge pull request #2825 from StratusFearMe21/gtk-startup
Prevent GTK from initializing Vulkan. This improves startup time
This commit is contained in:
@ -100,9 +100,13 @@ pub fn init(core_app: *CoreApp, opts: Options) !App {
|
|||||||
c.gtk_get_micro_version(),
|
c.gtk_get_micro_version(),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Disabling Vulkan can improve startup times by hundreds of
|
||||||
|
// milliseconds on some systems. We don't use Vulkan so we can just
|
||||||
|
// disable it.
|
||||||
if (version.atLeast(4, 16, 0)) {
|
if (version.atLeast(4, 16, 0)) {
|
||||||
// From gtk 4.16, GDK_DEBUG is split into GDK_DEBUG and GDK_DISABLE
|
// From gtk 4.16, GDK_DEBUG is split into GDK_DEBUG and GDK_DISABLE.
|
||||||
_ = internal_os.setenv("GDK_DISABLE", "gles-api");
|
// For the remainder of "why" see the 4.14 comment below.
|
||||||
|
_ = internal_os.setenv("GDK_DISABLE", "gles-api,vulkan");
|
||||||
_ = internal_os.setenv("GDK_DEBUG", "opengl");
|
_ = internal_os.setenv("GDK_DEBUG", "opengl");
|
||||||
} else if (version.atLeast(4, 14, 0)) {
|
} else if (version.atLeast(4, 14, 0)) {
|
||||||
// We need to export GDK_DEBUG to run on Wayland after GTK 4.14.
|
// We need to export GDK_DEBUG to run on Wayland after GTK 4.14.
|
||||||
@ -111,11 +115,14 @@ pub fn init(core_app: *CoreApp, opts: Options) !App {
|
|||||||
// reassess...
|
// reassess...
|
||||||
//
|
//
|
||||||
// Upstream issue: https://gitlab.gnome.org/GNOME/gtk/-/issues/6589
|
// Upstream issue: https://gitlab.gnome.org/GNOME/gtk/-/issues/6589
|
||||||
_ = internal_os.setenv("GDK_DEBUG", "opengl,gl-disable-gles");
|
_ = internal_os.setenv("GDK_DEBUG", "opengl,gl-disable-gles,vulkan-disable");
|
||||||
|
} else {
|
||||||
|
_ = internal_os.setenv("GDK_DEBUG", "vulkan-disable");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (version.atLeast(4, 14, 0)) {
|
if (version.atLeast(4, 14, 0)) {
|
||||||
// We need to export GSK_RENDERER to opengl because GTK uses ngl by default after 4.14
|
// We need to export GSK_RENDERER to opengl because GTK uses ngl by
|
||||||
|
// default after 4.14
|
||||||
_ = internal_os.setenv("GSK_RENDERER", "opengl");
|
_ = internal_os.setenv("GSK_RENDERER", "opengl");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -843,6 +843,7 @@ const Subprocess = struct {
|
|||||||
// Don't leak these environment variables to child processes.
|
// Don't leak these environment variables to child processes.
|
||||||
if (comptime build_config.app_runtime == .gtk) {
|
if (comptime build_config.app_runtime == .gtk) {
|
||||||
env.remove("GDK_DEBUG");
|
env.remove("GDK_DEBUG");
|
||||||
|
env.remove("GDK_DISABLE");
|
||||||
env.remove("GSK_RENDERER");
|
env.remove("GSK_RENDERER");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user