apprt/gtk: use proper env var for vulkan disable on <= 4.14

This commit is contained in:
Mitchell Hashimoto
2024-11-26 13:17:35 -08:00
parent 39fbd7db4b
commit e3621e81b7

View File

@ -100,9 +100,11 @@ pub fn init(core_app: *CoreApp, opts: Options) !App {
}); });
// Disabling Vulkan can improve startup times by hundreds of // Disabling Vulkan can improve startup times by hundreds of
// milliseconds on some systems // 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.
// For the remainder of "why" see the 4.14 comment below.
_ = internal_os.setenv("GDK_DISABLE", "gles-api,vulkan"); _ = 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)) {
@ -112,14 +114,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_DISABLE", "vulkan"); _ = internal_os.setenv("GDK_DEBUG", "opengl,gl-disable-gles,vulkan-disable");
_ = internal_os.setenv("GDK_DEBUG", "opengl,gl-disable-gles");
} else { } else {
_ = internal_os.setenv("GDK_DISABLE", "vulkan"); _ = 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");
} }