[Mesa-dev] [PATCH] anv: GetDeviceImageFormatProperties: fix TRANSFER formats

Lionel Landwerlin lionel.g.landwerlin at intel.com
Thu Jul 28 12:06:46 UTC 2016


We let the user believe we support some transfer formats which we don't.
This can lead to crashes when actually trying to use those formats.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
---
 src/intel/vulkan/anv_formats.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/intel/vulkan/anv_formats.c b/src/intel/vulkan/anv_formats.c
index b26e48a..88ab4a9 100644
--- a/src/intel/vulkan/anv_formats.c
+++ b/src/intel/vulkan/anv_formats.c
@@ -514,8 +514,11 @@ VkResult anv_GetPhysicalDeviceImageFormatProperties(
       }
    }
 
-#if 0
    if (usage & VK_IMAGE_USAGE_TRANSFER_DST_BIT) {
+      if (!(format_feature_flags & VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT)) {
+         goto unsupported;
+      }
+#if 0
       if (anv_format_for_vk_format(format)->has_stencil) {
          /* Not yet implemented because copying to a W-tiled surface is crazy
           * hard.
@@ -524,8 +527,8 @@ VkResult anv_GetPhysicalDeviceImageFormatProperties(
                       "stencil format");
          goto unsupported;
       }
-   }
 #endif
+   }
 
    if (usage & VK_IMAGE_USAGE_SAMPLED_BIT) {
       if (!(format_feature_flags & VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT)) {
-- 
2.8.1



More information about the mesa-dev mailing list