Fix possible exception on Vulkan example startup

This change fixes possible exception on Vulkan example startup when
validationLayers.size()) is zero.
This commit is contained in:
Anton Vasiliev 2021-12-07 05:48:09 +03:00 committed by Vittorio Romeo
parent 51ebeaf383
commit b9da3b879c

View File

@ -473,9 +473,9 @@ public:
instanceCreateInfo.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO; instanceCreateInfo.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
instanceCreateInfo.pApplicationInfo = &applicationInfo; instanceCreateInfo.pApplicationInfo = &applicationInfo;
instanceCreateInfo.enabledLayerCount = static_cast<sf::Uint32>(validationLayers.size()); instanceCreateInfo.enabledLayerCount = static_cast<sf::Uint32>(validationLayers.size());
instanceCreateInfo.ppEnabledLayerNames = &validationLayers[0]; instanceCreateInfo.ppEnabledLayerNames = validationLayers.data();
instanceCreateInfo.enabledExtensionCount = static_cast<sf::Uint32>(requiredExtentions.size()); instanceCreateInfo.enabledExtensionCount = static_cast<sf::Uint32>(requiredExtentions.size());
instanceCreateInfo.ppEnabledExtensionNames = &requiredExtentions[0]; instanceCreateInfo.ppEnabledExtensionNames = requiredExtentions.data();
// Try to create a Vulkan instance with debug report enabled // Try to create a Vulkan instance with debug report enabled
VkResult result = vkCreateInstance(&instanceCreateInfo, 0, &instance); VkResult result = vkCreateInstance(&instanceCreateInfo, 0, &instance);