Vulkan: Retry instance creation if validation layer is not present (#909)

This commit is contained in:
Colin Kinloch 2023-08-03 14:16:22 +01:00 committed by GitHub
parent 7111cbb103
commit 1d1e1e781b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -350,7 +350,15 @@ VulkanRenderer::VulkanRenderer()
create_info.ppEnabledLayerNames = m_layerNames.data(); create_info.ppEnabledLayerNames = m_layerNames.data();
create_info.enabledLayerCount = m_layerNames.size(); create_info.enabledLayerCount = m_layerNames.size();
if ((err = vkCreateInstance(&create_info, nullptr, &m_instance)) != VK_SUCCESS) err = vkCreateInstance(&create_info, nullptr, &m_instance);
if (err == VK_ERROR_LAYER_NOT_PRESENT) {
cemuLog_log(LogType::Force, "Failed to enable vulkan validation (VK_LAYER_KHRONOS_validation)");
create_info.enabledLayerCount = 0;
err = vkCreateInstance(&create_info, nullptr, &m_instance);
}
if (err != VK_SUCCESS)
throw std::runtime_error(fmt::format("Unable to create a Vulkan instance: {}", err)); throw std::runtime_error(fmt::format("Unable to create a Vulkan instance: {}", err));
if (!InitializeInstanceVulkan(m_instance)) if (!InitializeInstanceVulkan(m_instance))