I'm following a vulkan tutorial and when i'm trying to check for validation layer support. the function always returns false when it is supposed to return true. this is the code:
bool app::checkValidationLayersSupport() {
uint32_t layersCount = 0;
vkEnumerateInstanceLayerProperties(&layersCount, nullptr);
std::vector<VkLayerProperties> availableLayers(layersCount);
vkEnumerateInstanceLayerProperties(&layersCount, availableLayers.data());
std::cout << layersCount << "\n";
for (const char* layerName : validationLayers) {
std::cout << layerName << "\n";
for (const auto& layerProperties : availableLayers) {
if (strcmp(layerName, layerProperties.layerName) == 0) {
std::cout << layerProperties.layerName << std::endl;
return true;
}
}
}
return false;}
validationLayers
value is { "VK_LAYER_KHRONOS_validation" } (std::vector<const char*>)
after vkEnumerateInstanceLayerProperties
LayersCount
value is 5 so i think the problem is that the second vkEnumerateInstanceLayerProperties
can't change the value of availableLayers
so it remains empty
edit:
I checked it and the second vkEnumerateInstanceLayerProperties
is initializing the vector but the needed validation layer is not in it.
fix: i reinstalled the sdk