[Vulkan] Fix freeing the swap chain surface twice during error shutdown.
This commit is contained in:
parent
4f7bfe8816
commit
0a75f68e88
|
@ -102,7 +102,6 @@ bool VulkanContext::Initialize() {
|
||||||
provider->device());
|
provider->device());
|
||||||
if (swap_chain_->Initialize(surface) != VK_SUCCESS) {
|
if (swap_chain_->Initialize(surface) != VK_SUCCESS) {
|
||||||
XELOGE("Unable to initialize swap chain");
|
XELOGE("Unable to initialize swap chain");
|
||||||
vkDestroySurfaceKHR(*provider->instance(), surface, nullptr);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,7 +110,6 @@ bool VulkanContext::Initialize() {
|
||||||
status = immediate_drawer_->Initialize();
|
status = immediate_drawer_->Initialize();
|
||||||
if (status != VK_SUCCESS) {
|
if (status != VK_SUCCESS) {
|
||||||
XELOGE("Failed to initialize the immediate mode drawer");
|
XELOGE("Failed to initialize the immediate mode drawer");
|
||||||
vkDestroySurfaceKHR(*provider->instance(), surface, nullptr);
|
|
||||||
immediate_drawer_.reset();
|
immediate_drawer_.reset();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -245,6 +245,9 @@ bool VulkanInstance::CreateInstance() {
|
||||||
instance_info.ppEnabledExtensionNames = enabled_extensions.data();
|
instance_info.ppEnabledExtensionNames = enabled_extensions.data();
|
||||||
|
|
||||||
auto err = vkCreateInstance(&instance_info, nullptr, &handle);
|
auto err = vkCreateInstance(&instance_info, nullptr, &handle);
|
||||||
|
if (err != VK_SUCCESS) {
|
||||||
|
XELOGE("vkCreateInstance returned %s", to_string(err));
|
||||||
|
}
|
||||||
switch (err) {
|
switch (err) {
|
||||||
case VK_SUCCESS:
|
case VK_SUCCESS:
|
||||||
// Ok!
|
// Ok!
|
||||||
|
|
Loading…
Reference in New Issue