From 5a3b0bb902c342b889fc724b9addf85cd4d1935b Mon Sep 17 00:00:00 2001 From: "Jeffrey C. Ollie" Date: Sat, 22 Mar 2025 14:47:27 -0500 Subject: [PATCH] gtk: switch to vulkan as the default renderer --- src/apprt/gtk/App.zig | 6 +++--- src/config/Config.zig | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/apprt/gtk/App.zig b/src/apprt/gtk/App.zig index 4b1ea9d30..3b23a0599 100644 --- a/src/apprt/gtk/App.zig +++ b/src/apprt/gtk/App.zig @@ -189,7 +189,7 @@ pub fn init(core_app: *CoreApp, opts: Options) !App { // From gtk 4.16, GDK_DEBUG is split into GDK_DEBUG and GDK_DISABLE. // For the remainder of "why" see the 4.14 comment below. gdk_disable.@"gles-api" = true; - gdk_disable.vulkan = true; + gdk_disable.vulkan = config.@"gtk-gsk-renderer" != .vulkan; gdk_debug.@"gl-no-fractional" = true; break :environment; } @@ -202,13 +202,13 @@ pub fn init(core_app: *CoreApp, opts: Options) !App { // Upstream issue: https://gitlab.gnome.org/GNOME/gtk/-/issues/6589 gdk_debug.@"gl-disable-gles" = true; gdk_debug.@"gl-no-fractional" = true; - gdk_debug.@"vulkan-disable" = true; + gdk_debug.@"vulkan-disable" = config.@"gtk-gsk-renderer" != .vulkan; break :environment; } // Versions prior to 4.14 are a bit of an unknown for Ghostty. It // is an environment that isn't tested well and we don't have a // good understanding of what we may need to do. - gdk_debug.@"vulkan-disable" = true; + gdk_debug.@"vulkan-disable" = config.@"gtk-gsk-renderer" != .vulkan; } { diff --git a/src/config/Config.zig b/src/config/Config.zig index 481e02a79..b5cb19a3a 100644 --- a/src/config/Config.zig +++ b/src/config/Config.zig @@ -2192,7 +2192,7 @@ keybind: Keybinds = .{}, /// default GSK renderer, or set the GSK_RENDERER environment variable to your /// renderer of choice before launching Ghostty. This setting has no effect when /// using versions of GTK earlier than 4.14.0. -@"gtk-gsk-renderer": GtkGskRenderer = .opengl, +@"gtk-gsk-renderer": GtkGskRenderer = .vulkan, /// If `true`, the Ghostty GTK application will run in single-instance mode: /// each new `ghostty` process launched will result in a new window if there is @@ -6503,6 +6503,7 @@ pub const WindowPadding = struct { pub const GtkGskRenderer = enum { default, opengl, + vulkan, }; test "parse duration" {