KhronosGroup / Vulkan-LoaderAndValidationLayers

**Deprecated repository** for Vulkan loader and validation layers
Apache License 2.0
414 stars 172 forks source link

VK_IMAGE_CREATE_EXTENDED_USAGE_BIT is ignored when creating multiplanar images with unsupported flags #2538

Closed ghost closed 6 years ago

ghost commented 6 years ago

Creating a multiplane image (for example with a format of VK_FORMAT_G8_B8R8_2PLANE_420_UNORM) with the VK_IMAGE_CREATE_EXTENDED_USAGE_BIT flag and the VK_IMAGE_USAGE_STORAGE_BIT flag reports the following error:

vkCreateImage: usage bit VK_IMAGE_USAGE_STORAGE_BIT is not supported for format VK_FORMAT_G8_B8R8_2PLANE_420_UNORM with tiling VK_IMAGE_TILING_OPTIMAL. The spec valid usage text states 'If tiling is VK_IMAGE_TILING_OPTIMAL, and VkFormatProperties::optimalTilingFeatures (as returned by vkGetPhysicalDeviceFormatProperties with the same value of format) does not include VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT, usage must not contain VK_IMAGE_USAGE_STORAGE_BIT' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-VkImageCreateInfo-tiling-00984)

This is technically valid as implementations won't flag the STORAGE bit for multiplane VkFormats (since you can't expose the VkImage as a single image2D), however the EXTENDED_USAGE bit allows you to create images with unsupported usage flags (as long as they're supported by a VkImageView). Hence, the error should be silenced (or better, printed out if the format of the VkImageView created from the image doesn't support the USAGE flags as well).

daveh-lunarg commented 6 years ago

With PR #2567 the false error above will be avoided at image creation time and will (potentially) be flagged at imageview creation time if image and imageview usages don't match.