In the third paragraph, titled "Using extensions", the second code snippet uses wrong variable names. As the logic is the same as for the layer support check, it appears to be copied and pasted from there, but the variable names mismatch (layer <-> extension).
Wrong code snippet in documentation on the page:
// Get the required extensions.
auto requiredExtensions = getRequiredInstanceExtensions();
// Check if the required extensions are supported by the Vulkan implementation.
auto extensionProperties = context.enumerateInstanceExtensionProperties();
auto unsupportedLayerIt = std::ranges::find_if(requiredLayers,
[&layerProperties](auto const &requiredLayer) {
return std::ranges::none_of(layerProperties,
[requiredLayer](auto const &layerProperty) { return strcmp(layerProperty.layerName, requiredLayer) == 0; });
});
if (unsupportedPropertyIt != requiredExtensions.end())
{
throw std::runtime_error("Required extension not supported: " + std::string(*unsupportedPropertyIt));
}
Correct code snippet in the codebase:
// Get the required extensions.
auto requiredExtensions = getRequiredInstanceExtensions();
// Check if the required extensions are supported by the Vulkan implementation.
auto extensionProperties = context.enumerateInstanceExtensionProperties();
auto unsupportedPropertyIt =
std::ranges::find_if(requiredExtensions,
[&extensionProperties](auto const &requiredExtension) {
return std::ranges::none_of(extensionProperties,
[requiredExtension](auto const &extensionProperty) { return strcmp(extensionProperty.extensionName, requiredExtension) == 0; });
});
if (unsupportedPropertyIt != requiredExtensions.end())
{
throw std::runtime_error("Required extension not supported: " + std::string(*unsupportedPropertyIt));
}
In the third paragraph, titled "Using extensions", the second code snippet uses wrong variable names. As the logic is the same as for the layer support check, it appears to be copied and pasted from there, but the variable names mismatch (layer <-> extension).
Wrong code snippet in documentation on the page:
Correct code snippet in the codebase: