[Mesa-dev] [PATCH 3/5] anv/image: Fix return type of make_surface()
Jason Ekstrand
jason at jlekstrand.net
Mon Mar 6 23:12:52 UTC 2017
With modifiers, aren't we going to want to be able to reject an image if
the provide bogus stuff?
On Mon, Mar 6, 2017 at 10:18 AM, Chad Versace <chadversary at chromium.org>
wrote:
> make_surface() always returns VK_SUCCESS, so change its return type to
> 'void'. This simplifies the return-code handling in
> anv_image_create_info() and removes a goto.
> ---
> src/intel/vulkan/anv_image.c | 15 ++-------------
> 1 file changed, 2 insertions(+), 13 deletions(-)
>
> diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c
> index ab92df5d754..8f4fbd56a16 100644
> --- a/src/intel/vulkan/anv_image.c
> +++ b/src/intel/vulkan/anv_image.c
> @@ -137,7 +137,7 @@ add_surface(struct anv_image *image, struct
> anv_surface *surf)
> *
> * Exactly one bit must be set in \a aspect.
> */
> -static VkResult
> +static void
> make_surface(const struct anv_device *dev,
> struct anv_image *image,
> const struct anv_image_create_info *anv_info,
> @@ -245,8 +245,6 @@ make_surface(const struct anv_device *dev,
> image->aux_usage = ISL_AUX_USAGE_MCS;
> }
> }
> -
> - return VK_SUCCESS;
> }
>
> VkResult
> @@ -258,7 +256,6 @@ anv_image_create(VkDevice _device,
> ANV_FROM_HANDLE(anv_device, device, _device);
> const VkImageCreateInfo *base_info = anv_info->vk_info;
> struct anv_image *image = NULL;
> - VkResult r;
>
> assert(base_info->sType == VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO);
>
> @@ -288,20 +285,12 @@ anv_image_create(VkDevice _device,
>
> uint32_t b;
> for_each_bit(b, image->aspects) {
> - r = make_surface(device, image, anv_info, (1 << b));
> - if (r != VK_SUCCESS)
> - goto fail;
> + make_surface(device, image, anv_info, (1 << b));
> }
>
> *pImage = anv_image_to_handle(image);
>
> return VK_SUCCESS;
> -
> -fail:
> - if (image)
> - vk_free2(&device->alloc, alloc, image);
> -
> - return r;
> }
>
> VkResult
> --
> 2.12.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170306/b8045881/attachment.html>
More information about the mesa-dev
mailing list