From: Chad Versace Date: Mon, 7 Dec 2015 16:53:43 +0000 (-0800) Subject: anv: Assert the succes of isl_surf_init() X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3d85a28e90b534bf032bc25ae661327b7e1c8758;p=mesa.git anv: Assert the succes of isl_surf_init() --- diff --git a/src/vulkan/anv_image.c b/src/vulkan/anv_image.c index b5c9a86ff18..a3f6e753d2d 100644 --- a/src/vulkan/anv_image.c +++ b/src/vulkan/anv_image.c @@ -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);