Skip to content

Commit

Permalink
Vulkan: Retry instance creation if validation layer is not present (#909
Browse files Browse the repository at this point in the history
)
  • Loading branch information
ColinKinloch authored Aug 3, 2023
1 parent 7111cbb commit 1d1e1e7
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/Cafe/HW/Latte/Renderer/Vulkan/VulkanRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,15 @@ VulkanRenderer::VulkanRenderer()
create_info.ppEnabledLayerNames = m_layerNames.data();
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));

if (!InitializeInstanceVulkan(m_instance))
Expand Down

0 comments on commit 1d1e1e7

Please sign in to comment.