[Vulkan] Fix freeing the swap chain surface twice during error shutdown.

This commit is contained in:
DrChat 2017-12-19 23:04:43 -06:00
parent 4f7bfe8816
commit 0a75f68e88
2 changed files with 3 additions and 2 deletions

View File

@ -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;
}

View File

@ -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!