OSDN Git Service

vulkan/wsi/wayland: Handle VK_INCOMPLETE for GetPresentModes
authorJason Ekstrand <jason.ekstrand@intel.com>
Wed, 25 Jan 2017 00:43:15 +0000 (16:43 -0800)
committerJason Ekstrand <jason.ekstrand@intel.com>
Wed, 25 Jan 2017 17:05:25 +0000 (09:05 -0800)
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: "17.0" <mesa-dev@lists.freedesktop.org>
src/vulkan/wsi/wsi_common_wayland.c

index d745413..04cea97 100644 (file)
@@ -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,