From 42c6e0249f0b38322d8ac3d707bed121db792eba Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sun, 9 Jun 2024 11:29:06 -0400 Subject: [PATCH] vulkan: Fix updating swap chains gdk_vulkan_context_check_swapchain uses priv->current_format, so we must update it first, and undo that if check_swapchain falls. This fixes handling of high-depth back buffers in gsk. --- gdk/gdkvulkancontext.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gdk/gdkvulkancontext.c b/gdk/gdkvulkancontext.c index 806090470e..6b55e64b78 100644 --- a/gdk/gdkvulkancontext.c +++ b/gdk/gdkvulkancontext.c @@ -648,15 +648,18 @@ gdk_vulkan_context_begin_frame (GdkDrawContext *draw_context, { if (priv->formats[depth].gdk_format != priv->formats[priv->current_format].gdk_format) { + GdkMemoryFormat old_format = priv->current_format; GError *error = NULL; + + priv->current_format = depth; if (!gdk_vulkan_context_check_swapchain (context, &error)) { g_warning ("%s", error->message); g_error_free (error); + priv->current_format = old_format; return; } } - priv->current_format = depth; } for (i = 0; i < priv->n_images; i++) {