From: Jason Ekstrand Date: Wed, 25 Jan 2017 00:43:15 +0000 (-0800) Subject: vulkan/wsi/wayland: Handle VK_INCOMPLETE for GetPresentModes X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=659edd9f5ce995aa47e2ab02425508cc29140cce;p=mesa.git vulkan/wsi/wayland: Handle VK_INCOMPLETE for GetPresentModes Reviewed-by: Lionel Landwerlin Cc: "17.0" --- diff --git a/src/vulkan/wsi/wsi_common_wayland.c b/src/vulkan/wsi/wsi_common_wayland.c index d745413c403..04cea97f421 100644 --- a/src/vulkan/wsi/wsi_common_wayland.c +++ b/src/vulkan/wsi/wsi_common_wayland.c @@ -443,11 +443,13 @@ wsi_wl_surface_get_present_modes(VkIcdSurfaceBase *surface, return VK_SUCCESS; } - assert(*pPresentModeCount >= ARRAY_SIZE(present_modes)); + *pPresentModeCount = MIN2(*pPresentModeCount, ARRAY_SIZE(present_modes)); typed_memcpy(pPresentModes, present_modes, *pPresentModeCount); - *pPresentModeCount = ARRAY_SIZE(present_modes); - return VK_SUCCESS; + if (*pPresentModeCount < ARRAY_SIZE(present_modes)) + return VK_INCOMPLETE; + else + return VK_SUCCESS; } VkResult wsi_create_wl_surface(const VkAllocationCallbacks *pAllocator,