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++) {