anv/image: Assert that the image format is actually supported
authorJason Ekstrand <jason.ekstrand@intel.com>
Thu, 21 Jul 2016 04:10:20 +0000 (21:10 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Fri, 22 Jul 2016 23:48:54 +0000 (16:48 -0700)
Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: "12.0" <mesa-dev@lists.freedesktop.org>
src/intel/vulkan/anv_image.c

index e467e87d2299c5634543ace0608a1782de01b3a0..dff51bc78a3a36a8d3b7ba4dc6c8f9f961ef7042 100644 (file)
@@ -137,10 +137,13 @@ make_surface(const struct anv_device *dev,
    image->extent = anv_sanitize_image_extent(vk_info->imageType,
                                              vk_info->extent);
 
+   enum isl_format format = anv_get_isl_format(&dev->info, vk_info->format,
+                                               aspect, vk_info->tiling);
+   assert(format != ISL_FORMAT_UNSUPPORTED);
+
    ok = isl_surf_init(&dev->isl_dev, &anv_surf->isl,
       .dim = vk_to_isl_surf_dim[vk_info->imageType],
-      .format = anv_get_isl_format(&dev->info, vk_info->format,
-                                   aspect, vk_info->tiling),
+      .format = format,
       .width = image->extent.width,
       .height = image->extent.height,
       .depth = image->extent.depth,