From 0a75f68e8831a987a5125f7ffdb1c77c30b9b174 Mon Sep 17 00:00:00 2001 From: DrChat Date: Tue, 19 Dec 2017 23:04:43 -0600 Subject: [PATCH] [Vulkan] Fix freeing the swap chain surface twice during error shutdown. --- src/xenia/ui/vulkan/vulkan_context.cc | 2 -- src/xenia/ui/vulkan/vulkan_instance.cc | 3 +++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/xenia/ui/vulkan/vulkan_context.cc b/src/xenia/ui/vulkan/vulkan_context.cc index c627cbf3e..e91c892ec 100644 --- a/src/xenia/ui/vulkan/vulkan_context.cc +++ b/src/xenia/ui/vulkan/vulkan_context.cc @@ -102,7 +102,6 @@ bool VulkanContext::Initialize() { provider->device()); if (swap_chain_->Initialize(surface) != VK_SUCCESS) { XELOGE("Unable to initialize swap chain"); - vkDestroySurfaceKHR(*provider->instance(), surface, nullptr); return false; } @@ -111,7 +110,6 @@ bool VulkanContext::Initialize() { status = immediate_drawer_->Initialize(); if (status != VK_SUCCESS) { XELOGE("Failed to initialize the immediate mode drawer"); - vkDestroySurfaceKHR(*provider->instance(), surface, nullptr); immediate_drawer_.reset(); return false; } diff --git a/src/xenia/ui/vulkan/vulkan_instance.cc b/src/xenia/ui/vulkan/vulkan_instance.cc index f0de3df67..32b135413 100644 --- a/src/xenia/ui/vulkan/vulkan_instance.cc +++ b/src/xenia/ui/vulkan/vulkan_instance.cc @@ -245,6 +245,9 @@ bool VulkanInstance::CreateInstance() { instance_info.ppEnabledExtensionNames = enabled_extensions.data(); auto err = vkCreateInstance(&instance_info, nullptr, &handle); + if (err != VK_SUCCESS) { + XELOGE("vkCreateInstance returned %s", to_string(err)); + } switch (err) { case VK_SUCCESS: // Ok!