Clean up properly in case constructor throws

This commit is contained in:
Benau 2022-04-17 14:42:36 +08:00
parent 22f658239f
commit 3d6c86d04e

View File

@ -539,15 +539,24 @@ GEVulkanDriver::GEVulkanDriver(const SIrrlichtCreationParameters& params,
os::Printer::log("Vulkan driver version", getDriverVersionString().c_str());
for (const char* ext : m_device_extensions)
os::Printer::log("Vulkan enabled extension", ext);
GEVulkanCommandLoader::init(this);
createCommandBuffers();
GEVulkanShaderManager::init(this);
// For GEVulkanDynamicBuffer
GE::setVideoDriver(this);
GEVulkan2dRenderer::init(this);
createUnicolorTextures();
GEVulkanFeatures::printStats();
try
{
GEVulkanCommandLoader::init(this);
createCommandBuffers();
GEVulkanShaderManager::init(this);
// For GEVulkanDynamicBuffer
GE::setVideoDriver(this);
GEVulkan2dRenderer::init(this);
createUnicolorTextures();
GEVulkanFeatures::printStats();
}
catch (std::exception& e)
{
destroyVulkan();
throw std::runtime_error("GEVulkanDriver constructor failed");
}
} // GEVulkanDriver
// ----------------------------------------------------------------------------