anv: Assert the succes of isl_surf_init()
authorChad Versace <chad.versace@intel.com>
Mon, 7 Dec 2015 16:53:43 +0000 (08:53 -0800)
committerChad Versace <chad.versace@intel.com>
Mon, 7 Dec 2015 16:54:59 +0000 (08:54 -0800)
src/vulkan/anv_image.c

index b5c9a86ff181f43cecc8e2347ba76feafdd9f5c9..a3f6e753d2ddbfca85c85a7357fd1241a0bd3027 100644 (file)
@@ -136,6 +136,7 @@ anv_image_make_surface(const struct anv_device *dev,
                        struct anv_surface *out_anv_surf)
 {
    const VkImageCreateInfo *vk_info = anv_info->vk_info;
+   bool ok UNUSED;
 
    static const enum isl_surf_dim vk_to_isl_surf_dim[] = {
       [VK_IMAGE_TYPE_1D] = ISL_SURF_DIM_1D,
@@ -148,7 +149,7 @@ anv_image_make_surface(const struct anv_device *dev,
    if (vk_info->tiling == VK_IMAGE_TILING_LINEAR)
       tiling_flags &= ISL_TILING_LINEAR_BIT;
 
-   isl_surf_init(&dev->isl_dev, &out_anv_surf->isl,
+   ok = isl_surf_init(&dev->isl_dev, &out_anv_surf->isl,
       .dim = vk_to_isl_surf_dim[vk_info->imageType],
       .format = anv_get_isl_format(vk_info->format, aspect),
       .width = vk_info->extent.width,
@@ -162,6 +163,11 @@ anv_image_make_surface(const struct anv_device *dev,
       .usage = choose_isl_surf_usage(anv_info, aspect),
       .tiling_flags = tiling_flags);
 
+   /* isl_surf_init() will fail only if provided invalid input. Invalid input
+    * is illegal in Vulkan.
+    */
+   assert(ok);
+
    out_anv_surf->offset = align_u32(*inout_image_size,
                                     out_anv_surf->isl.alignment);