Skip to content

Commit

Permalink
Only enable instance validation layers when requested and available
Browse files Browse the repository at this point in the history
  • Loading branch information
fleroviux committed Apr 7, 2024
1 parent 1361400 commit ae3c801
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion app/next/src/main_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,12 @@ namespace zephyr {
required_extension_names.resize(extension_count);
SDL_Vulkan_GetInstanceExtensions(m_window, &extension_count, required_extension_names.data());

m_vk_instance = VulkanInstance::Create(app_info, required_extension_names, {"VK_LAYER_KHRONOS_validation"});
std::vector<const char*> required_layer_names{};
if(enable_validation_layers && VulkanInstance::QueryInstanceLayerSupport("VK_LAYER_KHRONOS_validation")) {
required_layer_names.push_back("VK_LAYER_KHRONOS_validation");
}

m_vk_instance = VulkanInstance::Create(app_info, required_extension_names, required_layer_names);
}

VulkanPhysicalDevice* MainWindow::PickPhysicalDevice() {
Expand Down

0 comments on commit ae3c801

Please sign in to comment.