From ae180f85ca90a2da5cbaf7f09beb51bd64b7d5c8 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 12 Nov 2024 15:40:32 -0500 Subject: [PATCH] gsk: Move the platform check up In some cases, we can know that we're not going to use Vulkan without initializing it. Handle those before calling gdk_display_prepare_vulkan. --- gsk/gskrenderer.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/gsk/gskrenderer.c b/gsk/gskrenderer.c index 272f8e0760..0fa57e4ed4 100644 --- a/gsk/gskrenderer.c +++ b/gsk/gskrenderer.c @@ -653,6 +653,15 @@ vulkan_supported_platform (GdkSurface *surface, VkPhysicalDeviceProperties props; GError *error = NULL; +#ifdef GDK_WINDOWING_WAYLAND + if (!GDK_IS_WAYLAND_DISPLAY (gdk_surface_get_display (surface)) && !as_fallback) + { + GSK_DEBUG (RENDERER, "Not using '%s': platform is not Wayland", + g_type_name (renderer_type)); + return FALSE; + } +#endif + if (!gdk_display_prepare_vulkan (display, &error)) { GSK_DEBUG (RENDERER, "Not using Vulkan%s: %s", @@ -685,15 +694,7 @@ vulkan_supported_platform (GdkSurface *surface, } #endif -#ifdef GDK_WINDOWING_WAYLAND - if (GDK_IS_WAYLAND_DISPLAY (gdk_surface_get_display (surface))) - return TRUE; -#endif - - GSK_DEBUG (RENDERER, "Not using '%s': platform is not Wayland", - g_type_name (renderer_type)); - - return FALSE; + return TRUE; } static GType