[Mesa-dev] [PATCH 2/2] vulkan/wsi/x11: Smplify implementation of vkGetPhysicalDeviceSurfaceFormatsKHR

Jason Ekstrand jason at jlekstrand.net
Fri Oct 28 17:24:27 UTC 2016


This is nice.  Both are

Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>

On Oct 28, 2016 5:55 AM, "Eduardo Lima Mitev" <elima at igalia.com> wrote:

> This patch simplifies x11_surface_get_formats() and makes it more readable.
> It is actually an improvement over the patch I provided earlier this week
> (750d8cad72), which was not very "good-tasting". I'm sorry for the noise.
> ---
>  src/vulkan/wsi/wsi_common_x11.c | 11 +++--------
>  1 file changed, 3 insertions(+), 8 deletions(-)
>
> diff --git a/src/vulkan/wsi/wsi_common_x11.c b/src/vulkan/wsi/wsi_common_
> x11.c
> index 4a232f5..8142847 100644
> --- a/src/vulkan/wsi/wsi_common_x11.c
> +++ b/src/vulkan/wsi/wsi_common_x11.c
> @@ -396,16 +396,11 @@ x11_surface_get_formats(VkIcdSurfaceBase *surface,
>        return VK_SUCCESS;
>     }
>
> -   VkResult result = VK_SUCCESS;
> -
> -   if (*pSurfaceFormatCount > ARRAY_SIZE(formats))
> -      *pSurfaceFormatCount = ARRAY_SIZE(formats);
> -   else if (*pSurfaceFormatCount < ARRAY_SIZE(formats))
> -      result = VK_INCOMPLETE;
> -
> +   *pSurfaceFormatCount = MIN2(*pSurfaceFormatCount, ARRAY_SIZE(formats));
>     typed_memcpy(pSurfaceFormats, formats, *pSurfaceFormatCount);
>
> -   return result;
> +   return *pSurfaceFormatCount < ARRAY_SIZE(formats) ?
> +      VK_INCOMPLETE : VK_SUCCESS;
>  }
>
>  static VkResult
> --
> 2.8.1
>
> _______________________________________________
> 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/20161028/77e2bf62/attachment.html>


More information about the mesa-dev mailing list