Skip to content

Commit

Permalink
Do not try to enable Validation Layers if they are not available
Browse files Browse the repository at this point in the history
  • Loading branch information
corporateshark committed Dec 21, 2024
1 parent 12bbe18 commit c297911
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions lvk/vulkan/VulkanClasses.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5732,6 +5732,24 @@ bool lvk::VulkanContext::getQueryPoolResults(QueryPoolHandle pool,
void lvk::VulkanContext::createInstance() {
vkInstance_ = VK_NULL_HANDLE;

// check if we have validation layers in the system
{
uint32_t numLayerProperties = 0;
vkEnumerateInstanceLayerProperties(&numLayerProperties, nullptr);
std::vector<VkLayerProperties> layerProperties(numLayerProperties);
vkEnumerateInstanceLayerProperties(&numLayerProperties, layerProperties.data());

[this, &layerProperties]() -> void {
for (const VkLayerProperties& props : layerProperties) {
for (const char* layer : kDefaultValidationLayers) {
if (!strcmp(props.layerName, layer))
return;
}
}
config_.enableValidation = false; // no validation layers available
}();
}

std::vector<const char*> instanceExtensionNames = {
VK_KHR_SURFACE_EXTENSION_NAME,
VK_EXT_DEBUG_UTILS_EXTENSION_NAME,
Expand Down

0 comments on commit c297911

Please sign in to comment.