radv: Add missing checks in radv_get_image_format_properties.
authorBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Wed, 29 Aug 2018 15:04:25 +0000 (17:04 +0200)
committerBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Wed, 29 Aug 2018 23:21:20 +0000 (01:21 +0200)
CC: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
src/amd/vulkan/radv_formats.c

index f0cc0fc5f95111e2d52307c0f5511869227bc819..6253c27b95d0ebdde4cbb8bdf1dfb4fd3b5f7b6c 100644 (file)
@@ -1112,6 +1112,25 @@ static VkResult radv_get_image_format_properties(struct radv_physical_device *ph
                }
        }
 
+       if (info->usage & VK_IMAGE_USAGE_TRANSFER_SRC_BIT) {
+               if (!(format_feature_flags & VK_FORMAT_FEATURE_TRANSFER_SRC_BIT)) {
+                       goto unsupported;
+               }
+       }
+
+       if (info->usage & VK_IMAGE_USAGE_TRANSFER_DST_BIT) {
+               if (!(format_feature_flags & VK_FORMAT_FEATURE_TRANSFER_DST_BIT)) {
+                       goto unsupported;
+               }
+       }
+
+       if (info->usage & VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT) {
+               if (!(format_feature_flags & (VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT |
+                                             VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT))) {
+                       goto unsupported;
+               }
+       }
+
        *pImageFormatProperties = (VkImageFormatProperties) {
                .maxExtent = maxExtent,
                .maxMipLevels = maxMipLevels,